Shop OBEX P1 Docs P2 Docs Learn Events
RIP Benoit Mandelbrot- Propeller demo attached... — Parallax Forums

RIP Benoit Mandelbrot- Propeller demo attached...

HannoHanno Posts: 1,130
edited 2012-01-07 13:53 in Propeller 1
Benoit Mandelbrot died yesterday at 85. He discovered the fractal that bears his name and contributed to mathematics- especially "roughness". Here's a TED talk he gave earlier this year:
http://www.ted.com/talks/lang/eng/benoit_mandelbrot_fractals_the_art_of_roughness.html
A while ago I did some fractals with 12Blocks- here's a quick SPIN program that draws the Mandelbrot fractal to a VGA attached to a DemoBoard:
CON
  'Run on a DemoBoard with 5MHz crystal and vga pins starting at P12
  _clkmode = xtal1+pll16x
  _xinfreq = 5_000_000
  _videopin=12  
OBJ
   _gfx:"vgagfx"     'draw graphics to VGA
VAR
  long xs,ys,xmin,ymin,xmax,ymax
  long p,q,i,x,y,xn,y0,x0 
pub _main
  _gfx.start(_videopin)
  'use integral math- divide by 1000 to get actual value
  'view from (-2.5,-1.5) to (1.5,1.5)
  xmin:=-2500
  ymin:=-1500
  xmax:=1500  
  ymax:=1500
  xs:=(xmax-xmin)/200
  ys:=(ymax-ymin)/200

  'loop over x,y
  repeat y from 0 to 200
   q:=ymin+y*ys
    repeat x from 0 to 200
     p:=xmin+x*xs
     xn:=0
     x0:=0
     y0:=0
     repeat i from 0 to 20
       'quit loop when sqrt(xn^2+y0^2)>2 
       if (xn*xn+y0*y0 > 4_000_000)
         quit
       'calculate z=(zold)^2+c in complex space   
       xn:=(x0+y0)*(x0-y0)/1000+p
       y0:=(x0*y0/500)+q
       x0:=xn
     'plot color at current x,y
     _gfx.color(i)
     _gfx.plot(x-100,y-100)
     _gfx.update
Attached is the resulting image. This program should really be optimized for the propeller- written in PASM and distributed among multiple cogs...
Hanno
1024 x 768 - 295K

Comments

  • Ahle2Ahle2 Posts: 1,179
    edited 2010-10-17 14:58
    At least he lived long enough to see the mandelbulb fractal. :)
    Nice to see a mandelbrot fractal being rendered on a prop, even tough it's SLOOOOW.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-10-17 14:59
    How's that pronounced?
    behn-wah mahn-dehl-broh?
    beh-noyt man-dehl-braht?
  • Brian RileyBrian Riley Posts: 626
    edited 2010-10-17 17:34
    _videopin=12
    

    pin 12 ?????????? DemoBoard VGA starts at 16 .... doesn't it?

    cheers ... BBR
  • kuronekokuroneko Posts: 3,623
    edited 2010-10-17 18:29
    pin 12 ?????????? DemoBoard VGA starts at 16 .... doesn't it?

    Don't worry, the 12 is wishful thinking. The pins are still hardwired at a lower level to 16..23.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-17 18:45
    Hanno wrote: »
    [code]
    _videopin=12
    OBJ
    _gfx:"vgagfx" 'draw graphics to VGA

    This program should really be optimized for the propeller- written in PASM and distributed among multiple cogs... Hanno

    Where do we get vgagfx? My install of the Proptool does not appear to have it, and I did not find it in OBEX.

    EDIT - Never mind, found it in the ZIP file
  • Heater.Heater. Posts: 21,230
    edited 2010-10-17 22:44
    I hope Humanoid is on this with his 40 Prop machine. The "MandelProp" set.

    What fun we had with this, when we should have been working, back in 1985.

    Thank you Benoit.
  • W9GFOW9GFO Posts: 4,010
    edited 2010-10-17 23:01
    PJ Allen wrote: »
    How's that pronounced?
    behn-wah mahn-dehl-broh?
    beh-noyt man-dehl-braht?

    I think it is behn-wah man-dehl-braht.

    Rich H
  • HarleyHarley Posts: 997
    edited 2010-10-17 23:24
    Heater said it the way I remember
    What fun we had with this, when we should have been working, back in 1985.

    Thank you Benoit.

    Many man hours 'down the drain' though immensely enjoyed seeing the results of a run on a high res monitor for the day. One fellow had access to a mini-computer and the high res monitor was in another part of the building. That Scientific American issue on the Mandelbrot sure did catch on fast across the country.
  • AleAle Posts: 2,363
    edited 2010-10-18 06:51
    It is pronounced (if you know German or Spanish)... Mandelbrot :).... bread made with almonds :)
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-10-19 03:53
    Heater. wrote: »
    I hope Humanoid is on this with his 40 Prop machine. The "MandelProp" set. What fun we had with this, when we should have been working, back in 1985. Thank you Benoit.
    I'm on it. What a great man and what great things he left for this world! Hanno's program version is just what I was looking for.
  • HannoHanno Posts: 1,130
    edited 2010-10-19 11:33
    Yeah! Looking forward to seeing Humanoido's version. Should be pretty straightforward to convert to PASM running on ~6 cogs- that should give a speedup of roughly a 1000x faster. Of course, the more cogs the better! Make sure to try out fractint on your pc...
    Hanno
  • potatoheadpotatohead Posts: 10,261
    edited 2010-10-19 13:11
    I'll clean this up a bit later and post the project code, but I thought I would drop a screen shot of the fractal running more colors. I very quickly dropped the fractal code into a older high-color driver of mine.

    This is 160x96 high color display, NTSC.

    A few more adjustments to the color lookup and pixel plotter will make a nicer picture... I'll post up the toy later today. Just had to sneak this in, because I always loved fractals...
    720 x 540 - 333K
    720 x 540 - 327K
  • jazzedjazzed Posts: 11,803
    edited 2010-10-19 14:28
    potatohead wrote: »
    I'll clean this up a bit later and post the project code, but I thought I would drop a screen shot of the fractal running more colors. I very quickly dropped the fractal code into a older high-color driver of mine.
    Very nice :) Fat pixel raster driver ?

    Looks like a program I used to run in DOS full screen mode.
    Fractal landscapes can look scary real.
  • Christof Eb.Christof Eb. Posts: 1,237
    edited 2010-10-20 03:47
    Hi Hanno,
    the answer for speed might be .... is ....PropBasic....?....!
    http://forums.parallax.com/showthread.php?t=122103&highlight=Mandelbrot

    Christof

    Edit:
    In this special case, speed is mainly governed by multiplications. The propeller has not got hardware multiply. So multiply has to be done in a small assembler routine, which can be very similar in SPIN or assembler.
    Therefore in this special case there is no great benefit for PropBasic....
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-20 18:14
    Heater. wrote: »
    I hope Humanoid is on this with his 40 Prop machine. The "MandelProp" set.

    What fun we had with this, when we should have been working, back in 1985.

    Thank you Benoit.

    1985? What if a kid like me wants to learn about the algorithm and make my own? What's a good reference?
  • Heater.Heater. Posts: 21,230
    edited 2010-10-21 11:09
    prof_braino,

    Well thinking about it I'm not sure I ever saw the famous Scientific American article on fractals in 1985 and was messing around with implementing them in 32 bit assembler on a Compaq DespPro 386 which was released in 1986.

    Anyway why not start with the SciAm article which they kindly make available for download here:
    http://www.scientificamerican.com/article.cfm?id=mandelbrot-set

    You will find a lot of Mandlebrot set and fractal info and example programs on the net. Google knows where to find them.
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-21 19:10
  • potatoheadpotatohead Posts: 10,261
    edited 2010-10-24 16:11
    Here's a 4 cog version, that computes the screen in quadrants.

    It's got a zoom problem, and I've spent the time I have today trying to figure it out! Render the set, which is the default, then try closer zooms, and it will break. Not sure why...

    Includes nice, simple high-color TV bitmap driver. 80Mhz Demoboard, NTSC.

    A full screen, single cog render works just fine. It's how I'm calculating the screen quadrants for the 4 cogs at issue. Also, if you want to use a single cog, it's possible to run it at 160x192. Change vertical size in the TV driver to 0, and double the display buffer, and the Y maximum values.

    Doing that just barely fits in the 32K.

    Comment out the 4 render cogs, uncomment the single display cog line you find below to render full screen in color on a single cog. Zoom is fine in that case. If you happen to see what goofy thing I got stuck on, let me know...

    Screenshot shows partial multi-cog render, not resulting display.
  • HannoHanno Posts: 1,130
    edited 2010-10-26 00:25
    potatohead- Great job taking Mandelbrot to the next level! 4 cogs is very impressive- next challenge is to do it in pasm...
    Hanno
  • potatoheadpotatohead Posts: 10,261
    edited 2010-10-26 11:43
    Thanks!

    I'm kind of stumped as to why it doesn't always render the right picture at closer zooms though. Any hints??

    If we get the PASM math, it will then be possible to do interactive fractals, kind of like FRACTINT.

    One could use the keyboard to pan and zoom, with a quick, lower resolution render happening to help the user guide themselves to a point of interest, then when there is no keyboard, just refine detail...
  • prof_brainoprof_braino Posts: 4,313
    edited 2010-10-26 18:30
    potatohead wrote: »
    kind of like FRACTINT.

    One could use the keyboard to pan and zoom, with a quick, lower resolution render happening to help the user guide themselves to a point of interest, then when there is no keyboard, just refine detail...

    THAT's what I'm talking about! I wonder how hard it would be to do the line by line method heater described?

    http://forums.parallax.com/showpost.php?p=947156&postcount=22

    I guess I'll have to get busy this weekend...
  • GarethGareth Posts: 278
    edited 2012-01-01 06:38
    Thanks a million for the code.....i searched high and low for some simple well written code ....well done.
    I did a few mods to it and was able to control two servos firing a UV laser at a phosphor screen using my RBBB propeller system i made 4 months ago..... I used the colour information to vary the "burn time" of the laser.
    mandlebrot_010.jpg
    mandlebrot_007_0.jpg
    mandlebrot_004.jpg
  • AleAle Posts: 2,363
    edited 2012-01-01 10:41
    That is cool !!, do you have photos of the setup ? (I may have missed your 4 months old thread :D )
  • Heater.Heater. Posts: 21,230
    edited 2012-01-01 19:29
    UV laser, phosphor screen. What exactly and where do I get them? I have to have that.
  • VIRANDVIRAND Posts: 656
    edited 2012-01-06 14:32
    Heater. wrote: »
    UV laser, phosphor screen. What exactly and where do I get them? I have to have that.
    On ebay you can get a 405nm laser pointer, and a glow in the dark exit sign. I couldn't find blank sheets.

    @potatohead:
    Could Zoom problems be caused by the limitations of 32 bit math?
  • JasonDorieJasonDorie Posts: 1,930
    edited 2012-01-06 17:35
    Go to an art supply store and look in the screen printing section. They usually have acrylic fabric paint that glows in the dark. You can apply it to just about anything and make your own sheets. It can be diluted with water and airbrushed, applied with a roller, etc, etc..

    Jason
  • ratronicratronic Posts: 1,451
    edited 2012-01-06 19:03
    I bought my UV pad here part way down the page under "Ultraviolet art"and the UV laser from Ebay.
  • GarethGareth Posts: 278
    edited 2012-01-07 06:05
    OK....due to the interest i have posted the system with all details here :- [h=2]The UV Propeller Green_Board Laser System [/h]....(to stop further hijacking of Hannos post here)....
  • potatoheadpotatohead Posts: 10,261
    edited 2012-01-07 13:53
    Re: Zoom. I don't think it's 32 bit math limitations. I do think it's a scaling problem; the code could be improved.
Sign In or Register to comment.