File talk:Circle area Monte Carlo integration.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

The main part of the picture consists of 900 "dart throws", small dots within the square.
Besides all other very awkward coding, each dot is coded like

 <path
 sodipodi:type="arc"
 style="opacity:1;fill:#bc1e47;fill-opacity:1;
   fill-rule:evenodd;stroke:none;stroke-width:4;
   stroke-linecap:butt;stroke-linejoin:miter;
   stroke-miterlimit:4;stroke-dasharray:none;
   stroke-dashoffset:0;stroke-opacity:1"
 id="path4456"
  sodipodi:cx="529.50891"
  sodipodi:cy="130.3125"
  sodipodi:rx="2.0758929"
  sodipodi:ry="2.0758929"
 d="M 531.5848,130.3125 A 2.0758929,2.0758929 0 1
   1 527.43302,130.3125 A 2.0758929,2.0758929 0 1
   1 531.5848,130.3125 z"
 transform="matrix(0.9634408,0,0,0.9634408,212.66922,1109.5845)" />

which needs about 610 bytes, 900 times it gives 549 000 bytes of coding.


Exactly the same, just without the redundant decimal fractions and transformations, the above example can as well be coded

M510,126h0

with only 10 bytes, still needing 9 000 bytes for all the 900 dots.

Together with the drawing of the other elements of the picture, the simplified version needs 9 302 bytes.


Recoding the points with relative adressed coordinates it could be a bit smaller. Coded this way

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="420" height="420">
<path fill-opacity=".1" stroke="#094" stroke-width="4" d="m30,30h360v360H30z"/>
<path fill-opacity=".2" stroke="#000" stroke-width="2" d="m209,32a178,178 0 1,0 2,0z"/>
<g style="font-size:85px;font-weight:bold;line-height:125%;opacity:.5;font-family:Arial">
<text fill="#BC1E47" x="140" y="240">709</text>
<text fill="#009246" x="240" y="380">900</text></g>
<g stroke-width="4" stroke-linecap="round">
<path stroke="#BC1E47" d="m34,219h0m8-19h0m2,33h0m1-67h0m0,15h0m4-42h0m0,17h0m0,118h0m1-64h0m1-66h0...
(709 dots)..."/>
<path stroke="#0081CD" d="m34,99v0m1,190v0m0,17v0m0,22v0m1-292v0m0,89v0m0,224v0m1-199v0m0-40v0...
(191 dots)..."/>
</g></svg>

it can be done using 7 220 bytes.