POV-Ray : Newsgroups : povray.off-topic : Differential equations FTW! Server Time
11 Oct 2024 07:14:25 EDT (-0400)
  Differential equations FTW! (Message 12 to 21 of 31)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Paul Fuller
Subject: Re: Differential equations FTW!
Date: 8 Jan 2008 19:52:33
Message: <47841ad1@news.povray.org>
>> Cellula Automata - Each cell (pixel) follows some simple rules based 
>> on its current state and that of its neighbours to determine its state 
>> in the next generation.
> 
> I thought a cellula automaton is where each cell has a *finite* number 
> of possible states? In this example, we have (conceptually) continuous 
> rather than discrete states.

I don't see anything in this case to say that the number of states of a 
cell is infinite :)

OK - this is more properly called a 'continuous automata' or a 
'continuous spatial automata' than a CA.  Very similar except that the 
future state is determined by functions rather than a state table. 
Still if you had a large enough state table...

Still the states here seem to converge to certain preferred values and 
patterns.  Like 'attractors' in a fractal.

> 
>> This particular example looks like it implements some equations that 
>> model the reaction of chemicals in 2D.  There are real mixtures that 
>> exhibit the pulsating and alternating patterns that some settings 
>> reproduce.
> 
> Indeed. That's how I found the link. ;-) I saw a TV program mention that 
> the patterns of animal skins can be described by a single mathematical 
> formula. Searching for this formula, I came across a document claiming 
> it's due to reaction diffusion - and hence the second link, which is a 
> simulation of the reaction diffusion differential equation.
> 
> Now, if I could figure out what the equation is and how it works, I 
> might be able to simulate it...

Don't the references provided by the site give details ?

"It is based on the Gray-Scott model, and was taken from John E. 
Pearson's Complex Patterns in a Simple System - Science, 261, 189, 9 
July 1993.

More details about the type of system used can be found at the [Xmorphia 
web site].

> 
>> Fiddling around with the parameters gives some behaviours that are 
>> interesting and some that quickly lead to all dead, all alive or 
>> something else.
>>
>> The number of possible combinations of the parameters is huge but 
>> there are typically a small number of interesting classes of behaviour 
>> on the boundaries between boring and chaotic.
> 
> Indeed, this is the case with a lot of fractals. A simple set of rules, 
> iterated a sufficient number of times, gives rise to complicated and 
> unpredictable behaviour, which is often quite pretty to look at. :-)
> 

True.

>> Fun stuff.  Thanks for the link.
> 
> It's not quite as much fun, but do a search for "boids" to see some 
> interesting flocking behaviour...
> 

Been there.  Done that.  We have similar interests.

I first saw Chris Langton's work on Boids described in Scientific 
American.  Maybe 20 years ago (?).  Back then I wrote a version (in 2D) 
on the Apple ][ and it worked but very slowly.  There are many 
simulators out there to play around with now and machine performance is 
so much better that it is just ridiculous.

Ditto with fractals BTW.  I still have the August 1985 Scientific 
American with the Mandelbrot Set cover and article by AK Dewdney in his 
Computer Recreations column.  Talk about a bombshell !  Unfortunately at 
1MHz the old Apple was a little slow and the graphics a bit primitive. 
It wasn't until I wrote a multi-tasking version in assembler on a 
mainframe with output rendered to a laser printer that I was happy.

'Artificial Life' by Steven Levy is a good popular science book on the 
A-Life field including CAs, Boids and Genetic Algorithms.  It was 
published in 1992 so things have progressed a bit and there is a lot of 
more recent work available on the Web.  Still a good read though.


Post a reply to this message

From: Invisible
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 05:01:12
Message: <47849b68$1@news.povray.org>
>> I thought a cellula automaton is where each cell has a *finite* number 
>> of possible states? In this example, we have (conceptually) continuous 
>> rather than discrete states.
> 
> I don't see anything in this case to say that the number of states of a 
> cell is infinite :)
> 
> OK - this is more properly called a 'continuous automata' or a 
> 'continuous spatial automata' than a CA.  Very similar except that the 
> future state is determined by functions rather than a state table. Still 
> if you had a large enough state table...
> 
> Still the states here seem to converge to certain preferred values and 
> patterns.  Like 'attractors' in a fractal.

Indeed, yes.

>> Now, if I could figure out what the equation is and how it works, I 
>> might be able to simulate it...
> 
> Don't the references provided by the site give details ?
> 
> "It is based on the Gray-Scott model, and was taken from John E. 
> Pearson's Complex Patterns in a Simple System - Science, 261, 189, 9 
> July 1993.
> 
> More details about the type of system used can be found at the [Xmorphia 
> web site].

The Xmorphia web site apparently no longer exists. (Firefox tells me the 
server cannot be found.)

As for "Science, 261, 189, 9 July 1993", what does that actually *mean*?

>> It's not quite as much fun, but do a search for "boids" to see some 
>> interesting flocking behaviour...
>>
> 
> Been there.  Done that.  We have similar interests.
> 
> I first saw Chris Langton's work on Boids described in Scientific 
> American.  Maybe 20 years ago (?).  Back then I wrote a version (in 2D) 
> on the Apple ][ and it worked but very slowly.  There are many 
> simulators out there to play around with now and machine performance is 
> so much better that it is just ridiculous.

I could have chosen this for my final year project in my degree. 
(Actually I chose distributed MVC, because I figured OpenGL would be 
*way* too hard. You have to use C for a start...)

> Ditto with fractals BTW.  I still have the August 1985 Scientific 
> American with the Mandelbrot Set cover and article by AK Dewdney in his 
> Computer Recreations column.  Talk about a bombshell !  Unfortunately at 
> 1MHz the old Apple was a little slow and the graphics a bit primitive. 
> It wasn't until I wrote a multi-tasking version in assembler on a 
> mainframe with output rendered to a laser printer that I was happy.

I first came across the M set in an edition of the Guinness Book of 
Records. It held the record for "most complicated mathematical object". 
Not entirely sure how they arrived at that conclusion... ;-) The text 
accompanying it mumbled something about real and imaginary numbers, 
fluid dynamics and the stock market. It didn't make a lot of sense.

Later I found books such as The Beauty of Fractals and so on in the 
local library. Most of these consisted of miles of very advanced 
mathematics, most of it concerning the statistical properties of the 
coastline or something, and almost none of it to do with drawing these 
fantastic images that I longed for. The tiny selection of actual 
*pictures* present usually included only the vaguest suggestion of what 
the image *is*, and absolutely no suggestion about HOW TO MAKE IT. It 
was an extremely frustrating time...

Eventually, by dint of wading through many, many textbooks on advanced 
mathematical techniques, I was eventually able to grok the concept of 
complex numbers, and eventually to comprehend *why* the apparently 
unrelated formulas Z = Z^2 + C and (X,Y) = (X^2 - Y^2 + A, 2XY + B) are 
actually the same thing. This happened while I was at college, where 
they actually *had* math books on the shelves. Progress was much more 
rapid after that...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: scott
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 06:13:21
Message: <4784ac51$1@news.povray.org>
> The Xmorphia web site apparently no longer exists. (Firefox tells me the 
> server cannot be found.)
>
> As for "Science, 261, 189, 9 July 1993", what does that actually *mean*?

I dug around and found the equations in some PDF paper:

http://citeseer.ist.psu.edu/45188.html

They're on page two, and if you understood how the wave equation worked then 
it should be pretty trivial to implement.

If I get time I would like to try and implement this in a pixel shader, it's 
exactly the thing that GPUs are good at - performing the same code on a huge 
number of different pixels.

> Later I found books such as The Beauty of Fractals and so on in the local 
> library. Most of these consisted of miles of very advanced mathematics, 
> most of it concerning the statistical properties of the coastline or 
> something, and almost none of it to do with drawing these fantastic images 
> that I longed for. The tiny selection of actual *pictures* present usually 
> included only the vaguest suggestion of what the image *is*, and 
> absolutely no suggestion about HOW TO MAKE IT. It was an extremely 
> frustrating time...

I think I looked at a BASIC implementation and figured out what the core 
loop was doing.  It was pretty cool that such a small simple bit of code 
made such nice pictures.  I tried writing a version in assembler, it worked 
but using fixed point numbers meant you could only zoom in about 3 or 4 
times until it all went wrong (no FPU on that machine!).


Post a reply to this message

From: Invisible
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 06:31:27
Message: <4784b08f$1@news.povray.org>
scott wrote:
>> The Xmorphia web site apparently no longer exists. (Firefox tells me 
>> the server cannot be found.)
>>
>> As for "Science, 261, 189, 9 July 1993", what does that actually *mean*?
> 
> I dug around and found the equations in some PDF paper:
> 
> http://citeseer.ist.psu.edu/45188.html
> 
> They're on page two, and if you understood how the wave equation worked 
> then it should be pretty trivial to implement.

I see. So we have two chemicals, who's concentrations are governed by a 
new, more complicated pair of differential equations. Is that basically 
what it means?

> If I get time I would like to try and implement this in a pixel shader, 
> it's exactly the thing that GPUs are good at - performing the same code 
> on a huge number of different pixels.

More precisely, doing the some thing on a huge number of different 
pixels *independently*. ;-) All goes horribly wrong with lots of data 
dependencies. Still, for this, only neighboring pixels matter, so it 
should still move like lightning...

>> Later I found books such as The Beauty of Fractals and so on in the 
>> local library. Most of these consisted of miles of very advanced 
>> mathematics, most of it concerning the statistical properties of the 
>> coastline or something, and almost none of it to do with drawing these 
>> fantastic images that I longed for. The tiny selection of actual 
>> *pictures* present usually included only the vaguest suggestion of 
>> what the image *is*, and absolutely no suggestion about HOW TO MAKE 
>> IT. It was an extremely frustrating time...
> 
> I think I looked at a BASIC implementation and figured out what the core 
> loop was doing.

Me too.

When my dad purchased AMOS Professional (look it up), it came with a 
5-disk set of example programs. One was a thing that drew a litle 
jellyfish. (I now realise that this was the quadratic Julia set C = 0.26 
or so.) And another program drew the Mandelbrot set. Slowly. Very 
slowly. (Hello? Interpretted language on an 8 MHz CPU with no FPU?)

The program in question had lots of different colouring options and so 
forth. It took a while to dig out the core loop. I was especially 
surprised to find that it does all these complicated calculations, and 
then THROWS THE ANSWER AWAY and only counts HOW MANY TIMES it's been 
round the loop. That was quite unexpected!

> It was pretty cool that such a small simple bit of code 
> made such nice pictures.

Indeed yes! I found this to be quite amazing...

Eventually I came to know the Mandelbrot algorithm like the back of my 
hand. But how to make that "cubic Mandelbrot" you see in all the books? 
Various simple manipulations of the loop formula failed to produce the 
correct image. Compare:

   X = X*X - Y*Y + A
   Y = 2*X*Y + B

Obviously (?!), the correct formula is in fact

   X = X*X*X - 3*X*Y*Y + A
   Y = 3*X*X*Y - Y*Y*Y + B

I would never have thought of that in a million years. At least, not 
until I finally worked out what a "complex number" actually is and how 
to do arithmetic with them...

> I tried writing a version in assembler, it 
> worked but using fixed point numbers meant you could only zoom in about 
> 3 or 4 times until it all went wrong (no FPU on that machine!).

Took 2 hours at 320x240 on my Amiga 1200 with a 20 MHz FPU.

Took 6 hours on the RM Nimbus we had at school, with a 286 and a copy of 
RMBASIC. Damn that was slow...!

By the time I got to college, I was writing programs in Pascal with 
random dithering, multiple colouring algorithms and other bells and 
whistles.

[Other examples that came with AMOS included an L-system that draws 
plants. I never did figure out how. Later I saw a Blitz Basic example 
that uses the Chaos Game to draw lots of interesting stuff in realtime. 
On, and that's also where I first figured out how to do the infinite 
trails trick...]

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: scott
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 06:45:15
Message: <4784b3cb$1@news.povray.org>
> I see. So we have two chemicals, who's concentrations are governed by a 
> new, more complicated pair of differential equations. Is that basically 
> what it means?

I think the equations are actually *simpler* than the wave equation because 
it gives you the velocity of the concentrations directly (not the 
acceleration).  One less integration step to perform, and no need to keep an 
array of velocity information.

>> If I get time I would like to try and implement this in a pixel shader, 
>> it's exactly the thing that GPUs are good at - performing the same code 
>> on a huge number of different pixels.
>
> More precisely, doing the some thing on a huge number of different pixels 
> *independently*. ;-) All goes horribly wrong with lots of data 
> dependencies. Still, for this, only neighboring pixels matter, so it 
> should still move like lightning...

Doesn't matter, because you cannot read pixels from a texture you are 
rendering to currently.  So you need to have one texture that shows the 
previous state, and then your pixel shader will write the new state into a 
new texture, performing as many look-ups from the old texture as you like. 
After you've created the new states then obviously you can swap the textures 
around for the next generation.

I'd then write another pixel shader that read form the two state textures 
and outputted to the screen back-buffer some colours, possibly using a 3rd 
texture as a look-up-table for speed.

> Took 2 hours at 320x240 on my Amiga 1200 with a 20 MHz FPU.

Oh I was down to about a minute or two at 640x480 on my 12 MHz Acorn (no 
FPU).  Limited zooming possibilities though.  Actually someone had written a 
much more complicated version in assembler that got around the accuracy 
limitations of 32-bit ints somehow and also ran faster than mine...


Post a reply to this message

From: Bill Pragnell
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 06:53:14
Message: <4784b5aa@news.povray.org>
scott wrote:
> Oh I was down to about a minute or two at 640x480 on my 12 MHz Acorn (no 
> FPU).  Limited zooming possibilities though.  Actually someone had 
> written a much more complicated version in assembler that got around the 
> accuracy limitations of 32-bit ints somehow and also ran faster than 
> mine...

I had a really good Mandelbrot/Julia generator on the Acorn called 
!Mandy. That was bloody fast, and you could go really deep.


Post a reply to this message

From: Invisible
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 06:57:56
Message: <4784b6c4$1@news.povray.org>
>> Took 2 hours at 320x240 on my Amiga 1200 with a 20 MHz FPU.
> 
> Oh I was down to about a minute or two at 640x480 on my 12 MHz Acorn (no 
> FPU).  Limited zooming possibilities though.  Actually someone had 
> written a much more complicated version in assembler that got around the 
> accuracy limitations of 32-bit ints somehow and also ran faster than 
> mine...

Well, it was written in interpretted BASIC, what do you expect? ;-) 
[Also written very simply, with no evidence of any attempt at 
optimisation... And lots of configurable options which slow rendering 
down even if you don't use 'em.]

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Mike Raiford
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 07:46:38
Message: <4784c22e$1@news.povray.org>
Invisible wrote:

> Then again, when I was a child, I used to sit for hours watching the 
> washing machine. [Remember that when I was a child, "TV" was only 
> available for a few hours a day...]

Hmm... That does explain some things ...

> Does anybody know how either of these simulations actually work?

Sort of ... They're both cellular automata systems, I believe.

On a side note, the page that has the wave simulator has my favorite 
waste of time:

http://www.falstad.com/circuit/


Post a reply to this message

From: Invisible
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 08:00:47
Message: <4784c57f$1@news.povray.org>
>> Then again, when I was a child, I used to sit for hours watching the 
>> washing machine. [Remember that when I was a child, "TV" was only 
>> available for a few hours a day...]
> 
> Hmm... That does explain some things ...

._.

> On a side note, the page that has the wave simulator has my favorite 
> waste of time:
> 
> http://www.falstad.com/circuit/

Ah yes, another interesting toy. If only I knew what it all means...

Actually, that site has a whole heap of seriously interesting stuff. I 
also enjoy playing with the digital filters and so forth.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Mike Raiford
Subject: Re: Differential equations FTW!
Date: 9 Jan 2008 08:42:24
Message: <4784cf40$1@news.povray.org>
Invisible wrote:

>> http://www.falstad.com/circuit/
> 
> Ah yes, another interesting toy. If only I knew what it all means...

Heh. When I was a kid, I had one of those electronics kits where you 
wire things together with spring terminals. Great fun. This applet 
really makes me want to run out to the local Radio Shack and grab a few 
handfuls of components and a breadboard and start building stuff for the 
fun of it.

> Actually, that site has a whole heap of seriously interesting stuff. I 
> also enjoy playing with the digital filters and so forth.
> 

Electron orbitals was another fun one ... I believe there's a function 
in POV-Ray that generates an electron probability cloud.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.