---- Have you read: "Ghost of the Grand Banks" by Arthur C. Clark ?
---- It contains a subtle warning for all you M-setter's
Here's one for you. It even draws the result ... :-)
#!/bin/csh -f
# usage: fractal cx cy number_of_points
# plots Julia set of F(z) = z^2 + c
# Note the random number generator is AWFUL!
awk "BEGIN{cx=$1;cy=$2;n=$3;zx=0.5;zy=0;rnd=1234567; \
for (i=0;i<n;i++) { \
zx -= cx; zy -= cy; \
s = sqrt(zx*zx+zy*zy); \
x = sqrt((s+zx)/2); \
y = sqrt((s-zx)/2); \
if (zy>0) y = -y; \
zx = x; zy = y; \
rnd= rnd*7654321 % 1000000; \
if (rnd > 500000) {zx= -zx; zy= -zy}; \
print zx,zy; \
} exit}" | graph -g0 -m0 | plot
--
Andrew Yeomans | UUCP: a...@cel.uucp or ..!{ukc,mcsun,uunet}!cel!ajy
Crosfield Electronics Ltd | PSTN: +44 442 230000 X 3371 Fax: +44 442 232301
Three Cherry Trees Lane | These opinions are MINE, all MINE!
Hemel Hempstead | Ps 66: "Thou broughtest us into the net;
Herts, HP2 7RH, England | thou laidst affliction upon our loins."
za...@ddsw1.MCS.COM (Sameer Parekh) writes:
>> Are there any UNIX fractaling programs that will work w/o a grapics
>> terminal? If the program saved the image as a GIF that would be
>> optimal...
> Here's one for you. It even draws the result ... :-)
> # Note the random number generator is AWFUL!
Well, it works completely differently, and draws much prettier pictures,
with an improved random number generator, so here it is again with a
fairly arbitrary seed, and a multiplication factor shamelessly stolen
out of a thirty year old copy of Richard Hamming's Numerical Methods for
Scientists and Engineers:
#!/bin/csh -f
# usage: fractal cx cy number_of_points
# plots Julia set of F(z) = z^2 + c
# Note the random number generator is (no longer) AWFUL!
awk "BEGIN{cx=$1;cy=$2;n=$3;zx=0.5;zy=0;rnd=100111; \
for (i=0;i<n;i++) { \
zx -= cx; zy -= cy; \
s = sqrt(zx*zx+zy*zy); \
x = sqrt((s+zx)/2); \
y = sqrt((s-zx)/2); \
if (zy>0) y = -y; \
zx = x; zy = y; \
rnd= rnd*638671877 % 1000000; \
if (rnd > 500000) {zx= -zx; zy= -zy}; \
print zx,zy; \
} exit}" | graph -g0 -m0 | plot
The below particular call looks nice on my 48 by 80 character screen; be
prepared to wait a minute or two for drawing to start; note that you
have to have "csh", "awk", "graph" and "plot" in your path, and the
above script needs to be in your path, named "fractal", and made
executable.
fractal 0.263 0.215 1000
A thousand points is a lot. Cut it down to 50, and slowly walk a set
of tests with the first parameter varying from .250 to .267, I found
.263 to be the most interesting case, but you are (I think) watching
the Julia set go from connected to discrete as you cross the boundary
of the Mandelbrot set, and the effect is pretty dramatic. When you
find a spot that looks interesting, up the points to a few hundred to
a thousand to let the figure complete.
Enjoy!
Kent, the man from xanth.
<xant...@Zorch.SF-Bay.ORG> <xant...@well.sf.ca.us>