LOGO-L> Mandelbrot set. 
Author Message
 LOGO-L> Mandelbrot set.

This is a multi-part message in MIME format.
--------------537D90CB19C709E3C9727871
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

With all the recent talk about fractals on the list over the past few
days I was surprised that no mention was made of the mother of all
fractals, the Mandelbrot set.

The attached image was produced by the following code.  However on my
p75 Pentium it took most of the night. Logo just doesn't seem to be the
way to go.  Of course back in '85 I use to run multi day on a Pyramid 90
to get super high magnifications.  Later on I was fortunate enough to
work at a place that had lots of fun toys to play with.  I redid the
mandelbrots then in 3d. The z axis being the value of the cell.
Wonderful stuff.

The idea for the program was introduced in Scientific American, August
1985 in the 'Computer Recreations' column. If you can find this issue
you should check it out, the photo's alone make it worth.  The Computer
Recreations column was really wonderful.  Lot's of great ideas to
explore, 'core wars' was another favorite.  

What I'm working on now is a mandelbrot generator in java. The output of
that will go to a file which Logo can then read in and plot.  Should
make for the best of both worlds.  Speed in the computation and an easy
and rich way to plot it.

Anyway the program starts in 'begin'.  The parameters at the top of the
file set the view and magnification of the image.

acorner and bcorner set the starting point of the view. It's the lower
lefthand corner. picSize sets the size of the 2d array which holds the
set. Side is a bit harder to explain, basically it sets the
magnification.  LARGER numbers zoom OUT, smaller numbers zoom IN (or
magnify).

Calc does the actual work. for each cell in the array a number is
computed recursively.  We stop if the 'size' of the number > 2 or we
have run 1000 reps and the number is still below 2.  The size determines
if the cell is part of the mandelbrot set.  Cells that make it to 1000
are part of the set (black in the image). Cells that stop after only one
or two times around are out of the set (red in the image). Its the ones
in between that make it interesting.

Back in begin we store the size in a 2d array.  As a test I also
generated the image on the fly.  That's the image attached here.  The
good thing about storing the numbers and printing them out later is that
you can check the spread of the numbers and assign colors accordingly.
If I had used more colors and been more discriminating in their
assignment the image would have wonderful swirls around and coming out
of the set itself.

The really interesting thing is what happens as you zoom in on different
regions. In some places you get baby mandelbrots, other places look like
solar flares.  Does anyone know of a site on the web that has picture
for view?  I'd be surprised if one didn't exist.

Enjoy the code if you try to use it. If anyone has one of these new
super duper pentiums (or whatever) I'd be interested in hearing what
results you get.

;;
;; start of code.
;;
to setGap
        op :side / :picSize
end

to calc :count :az :bz

        localmake "oaz :az
        if :count > 1000 [op :count ]        

        make "az (:az * :az) + (:bz * :bz * minus 1)
        make "bz 2 * (:oaz * :bz)

        make "az :az + :complexReal
        make "bz :bz + :complexImg

        make "size sqrt ((:az * :az) + (:bz * :bz))
        if :size > 2 [op :count ]

        op calc (:count + 1) :az :bz

end

to begin
        make "acorner -2.0
        make "bcorner -1.25
        make "side 2.5
        make "picSize 400
        make "pic (mdarray list :picSize :picSize 0)
        make "size 0

        make "gap setGap
        pu penpaint ht
        setpensize [1 1]
        repeat :picSize [ make "row repcount - 1
                repeat :picSize [ make "column repcount - 1
                        make "complexReal :acorner + (:column * :gap)
                        make "complexImg :bcorner + (:row * :gap)

                        make "count calc 0 0 0

                        setpos list :row :column
                        setpencolor [255 0 0]
                        if :count > 250 [setpencolor [0 0 255]]
                        if :count > 500 [setpencolor [0 255 0]]
                        if :count > 1000 [setpencolor [0 0 0]]
                        putdot

                        mdsetitem list :row :column :pic :count
                ]]
end

to putdot
        pd
        fd 1 bk 1
        pu      
end

--
Frank Caggiano

http://www.*-*-*.com/ ~caggiano
--------------537D90CB19C709E3C9727871
Content-Type: image/gif; name="fbot.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="fbot.gif"

<encoded_portion_removed>
fwIaqGqD+llomAMiSmehhg6qqJmMXudopJRWupaAkWLaZ0AAOw==
--------------537D90CB19C709E3C9727871--

---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

There was quite a bit of talk on mandelbrot some time ago.
It may still be in the archives.

I did not look at your code closely but seems to be running
much slower than I've seen in the past.

Quote:

> With all the recent talk about fractals on the list over the past few
> days I was surprised that no mention was made of the mother of all
> fractals, the Mandelbrot set.

> The attached image was produced by the following code.  However on my
> p75 Pentium it took most of the night. Logo just doesn't seem to be the
> way to go.  Of course back in '85 I use to run multi day on a Pyramid 90
> to get super high magnifications.  Later on I was fortunate enough to
> work at a place that had lots of fun toys to play with.  I redid the
> mandelbrots then in 3d. The z axis being the value of the cell.
> Wonderful stuff.

> The idea for the program was introduced in Scientific American, August
> 1985 in the 'Computer Recreations' column. If you can find this issue
> you should check it out, the photo's alone make it worth.  The Computer
> Recreations column was really wonderful.  Lot's of great ideas to
> explore, 'core wars' was another favorite.

> What I'm working on now is a mandelbrot generator in java. The output of
> that will go to a file which Logo can then read in and plot.  Should
> make for the best of both worlds.  Speed in the computation and an easy
> and rich way to plot it.

> Anyway the program starts in 'begin'.  The parameters at the top of the
> file set the view and magnification of the image.

> acorner and bcorner set the starting point of the view. It's the lower
> lefthand corner. picSize sets the size of the 2d array which holds the
> set. Side is a bit harder to explain, basically it sets the
> magnification.  LARGER numbers zoom OUT, smaller numbers zoom IN (or
> magnify).

> Calc does the actual work. for each cell in the array a number is
> computed recursively.  We stop if the 'size' of the number > 2 or we
> have run 1000 reps and the number is still below 2.  The size determines
> if the cell is part of the mandelbrot set.  Cells that make it to 1000
> are part of the set (black in the image). Cells that stop after only one
> or two times around are out of the set (red in the image). Its the ones
> in between that make it interesting.

> Back in begin we store the size in a 2d array.  As a test I also
> generated the image on the fly.  That's the image attached here.  The
> good thing about storing the numbers and printing them out later is that
> you can check the spread of the numbers and assign colors accordingly.
> If I had used more colors and been more discriminating in their
> assignment the image would have wonderful swirls around and coming out
> of the set itself.

> The really interesting thing is what happens as you zoom in on different
> regions. In some places you get baby mandelbrots, other places look like
> solar flares.  Does anyone know of a site on the web that has picture
> for view?  I'd be surprised if one didn't exist.

> Enjoy the code if you try to use it. If anyone has one of these new
> super duper pentiums (or whatever) I'd be interested in hearing what
> results you get.

> ;;
> ;; start of code.
> ;;
> to setGap
>         op :side / :picSize
> end

> to calc :count :az :bz

>         localmake "oaz :az
>         if :count > 1000 [op :count ]

>         make "az (:az * :az) + (:bz * :bz * minus 1)
>         make "bz 2 * (:oaz * :bz)

>         make "az :az + :complexReal
>         make "bz :bz + :complexImg

>         make "size sqrt ((:az * :az) + (:bz * :bz))
>         if :size > 2 [op :count ]

>         op calc (:count + 1) :az :bz

> end

> to begin
>         make "acorner -2.0
>         make "bcorner -1.25
>         make "side 2.5
>         make "picSize 400
>         make "pic (mdarray list :picSize :picSize 0)
>         make "size 0

>         make "gap setGap
>         pu penpaint ht
>         setpensize [1 1]
>         repeat :picSize [ make "row repcount - 1
>                 repeat :picSize [ make "column repcount - 1
>                         make "complexReal :acorner + (:column * :gap)
>                         make "complexImg :bcorner + (:row * :gap)

>                         make "count calc 0 0 0

>                         setpos list :row :column
>                         setpencolor [255 0 0]
>                         if :count > 250 [setpencolor [0 0 255]]
>                         if :count > 500 [setpencolor [0 255 0]]
>                         if :count > 1000 [setpencolor [0 0 0]]
>                         putdot

>                         mdsetitem list :row :column :pic :count
>                 ]]
> end

> to putdot
>         pd
>         fd 1 bk 1
>         pu
> end

> --
> Frank Caggiano

> http://www.atlantic.net/~caggiano

>     ---------------------------------------------------------------
>  [Image]

--
===============================================================

http://www.softronix.com/
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

Thanks Frank!
This has always been a problematic hack in Logo(or any high level
language) due to the sheer weight of computation. A G3 Macintosh might be
the ticket.
I just hope your PUTDOT routine doesn't offend anyone...

cheers

Jeff Richardson
Faculty of Education
Monash University
---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

Quote:

> There was quite a bit of talk on mandelbrot some time ago.
> It may still be in the archives.

> I did not look at your code closely but seems to be running
> much slower than I've seen in the past.

I must of missed it I haven;t been on the list all that long, I'll have
to go back throughthe archives and see what I can find.

If you find any problems with the code please let me know.  I'm not a
mathamatician so I may be doing something that could be improved.

Quote:

> >                         setpos list :row :column

One thing I did notice after I sent this out is that the above setpos
should really be 'setpos list :column :row' .

regards

--
Frank Caggiano

http://www.atlantic.net/~caggiano
---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

Quote:

> I just hope your PUTDOT routine doesn't offend anyone...

Oh Oh, Didn't realize there was a PC way to make a dot.  Hope I don't
start a dot-war :-)
--
Frank Caggiano

http://www.atlantic.net/~caggiano
---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

<snip>

Quote:

> The attached image was produced by the following code.  However on my
> p75 Pentium it took most of the night.

Guess I will let it run all night on my 150MHz 586.

One fractal URL is http://www.cnam.fr/fractals.html  

Also there is a good book with a Fractal generator on the 3.5in disk and
a CD of 1800 Fractal Images plus source code for DOS and Unix described
by http://www.amazon.com as:

Fractal Creations/Book, Cd-Rom, Disk and 3-D Glasses
Second Edition          by Timothy Wegner, Mark Peterson
                        Availability: This title is out of print, but if
you place an order we may be able to find you a used copy within 1-3
months.
                        Published by Waite Group Pr
                        Publication date: December 1993
                        ISBN: 1878739344

I don't know about the 1-3 months part.  As I remember I received what
appears to be a new copy within a couple weeks.  

Anyway the address of the Waite Group Press, Inc. is(or was in 1993)
200 Tamal Plaza, Suite 101
Corte Madera, CA 94925

and their telephone #'s were, 1-800-368-9369
415-924-2575  FAX  415-924-2576

and the 3D glasses work fine when viewing George Mills' Space Shuttle.
Dale
--

---------------------------------------------------------------





Thu, 25 May 2000 03:00:00 GMT  
 LOGO-L> Mandelbrot set.

<snip>

Quote:
> If you find any problems with the code please let me know.  I'm not a
> mathamatician so I may be doing something that could be improved.

> > >                         setpos list :row :column

> One thing I did notice after I sent this out is that the above setpos
> should really be 'setpos list :column :row' .

Well it is bedtime again and this program has been running on my 150MHz
586 for 24 hours.  It is less than half way through and I am going to
turn it off.  

How come Frank's 75MHz machine did the whole thing overnight and my
machine took at least three times longer to do less than half as much?

I am using MSWLogo Version 6.2b and have 32Mb of memory.    Dale
--

---------------------------------------------------------------





Fri, 26 May 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. LOGO-L> Mandelbrot

2. LOGO-L> set LOGO-L nomail

3. x86 assembly implementation of Mandelbrot Set

4. CAPI,complex,and Mandelbrot set

5. Mandelbrot and Julia sets in LISP

6. LOGO-L> set color

7. LOGO-L> setting textboxes

8. Mandelbrot --> Julia

9. q: set x [ls]

10. LOGO-L> Mandelbrot Plotter in UCB logo (fwd)

11. LOGO-L> Apple logo/MSW Logo

12. LOGO-L> Reseach Machines Logo (RM LOGO)

 

 
Powered by phpBB® Forum Software