#! /usr/bin/perl # # This little perl script computes the locations of the # buds along the perimiter of the mandelbrot cardiod. # print " \n"; print " guesstimate for the bud locations on the main sequence\n"; print " accurate for the early part of the sequence, but fails long run\n"; print " \n"; print "n phi x-bud y-bud bud\n"; print " center center diameter\n"; print "---- ------ ------ ------ --------\n"; for ($i=1; $i<=25; $i++) { # $nume is the Farey numerator $nume = 1; # $nume = 2; # $deno is the Farey denominator $deno = $i+1; # $deno = 2*$i+1; # $t is natural parameter; $p is angle phi $t = $nume/$deno; $p = 2*3.14159265358979*$t; # x,y is on the cardiod $x = 0.5 * cos ($p) - 0.25 * cos (2*$p); $y = 0.5 * sin ($p) - 0.25 * sin (2*$p); $r = sqrt ($x*$x+$y*$y); # $br is our guesstimate for the bud radius $xx = $x - 0.25; $br = sqrt ($xx*$xx+$y*$y); $br = sqrt ($br); $br *= 1 / ($deno*$deno); # note that $br == $brr is an exact identity. $brr = sin ($p/2) / ($deno*$deno); # to get to the center of the bud, we need to compute # the tangent to the cardiod. $dx = -0.5 * (sin ($p) - sin (2*$p)); $dy = 0.5 * (cos ($p) - cos (2*$p)); # $m is the slope of the line perpendicular to the cardiod # x,y should now point at the bud center. $m = - $dx/$dy; $l = sqrt (1+$m*$m); if ($x > 0) { $x += $br/$l; } else { $x -= $br/$l; } if ($y > 0) { $y += $m*$br/$l; } else { $y -= $m*$br/$l; } printf "%3d %8.6f %8.6f %8.6f %8.6f\n", $i, $p, $x, $y, 2*$br; }