Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UNIX fractaling programs

21 views
Skip to first unread message

Sameer Parekh

unread,
Feb 15, 1991, 9:55:15 PM2/15/91
to

Are there any UNIX fractaling programs that will work w/o
a graphics terminal? If the program saved the image as a GIF that would
be optimal...

--
za...@ddsw1.MCS.COM

Mike Hare

unread,
Feb 16, 1991, 9:48:12 AM2/16/91
to
Fractal programs are fairly easy to write on any plateform that
supports a 'c' compiler. I have written them on several unix based
computers and on the ibm-pc clones, they all work the same way.
One such program would output the data not to the screen but to a file
that could be transfered to other computers for viewing at a later time.


---- Have you read: "Ghost of the Grand Banks" by Arthur C. Clark ?
---- It contains a subtle warning for all you M-setter's

Andrew J. V. Yeomans (ext 3371)

unread,
Feb 18, 1991, 9:36:34 AM2/18/91
to
In article <1991Feb16.0...@ddsw1.MCS.COM> za...@ddsw1.MCS.COM (Sameer Parekh) writes:
>
> Are there any UNIX fractaling programs that will work w/o
>a graphics terminal? If the program saved the image as a GIF that would
>be optimal...

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."

Sameer Parekh

unread,
Feb 18, 1991, 9:10:30 PM2/18/91
to
In article <1991Feb16....@mips.mitek.com> m...@hp835.mitek.com (Mike Hare) writes:
>Fractal programs are fairly easy to write on any plateform that
>supports a 'c' compiler. I have written them on several unix based
>computers and on the ibm-pc clones, they all work the same way.
>One such program would output the data not to the screen but to a file
>that could be transfered to other computers for viewing at a later time.
I see, thanks. I guess I can try to write something in C. . .
How would I convert an array of integers (0-15) into a 16 color picture
file for viewing? GIF would be good. . .


--
za...@ddsw1.MCS.COM

Kent Paul Dolan

unread,
Mar 5, 1991, 10:14:43 PM3/5/91
to
A while back, a...@cel.co.uk (Andrew J. V. Yeomans) wrote:

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>

0 new messages