 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Who says mathematics isn't fun? :-D
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
...and now *with* the attachment I meant to add the first time...
Post a reply to this message
Attachments:
Download 'test_drawrk.jpg' (31 KB)
Preview of image 'test_drawrk.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> ...and now *with* the attachment I meant to add the first time...
Go on then, what's the mathematics behind this one? Gravity?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>> ...and now *with* the attachment I meant to add the first time...
>
> Go on then, what's the mathematics behind this one? Gravity?
Well, I don't know about "gravity"... merely the damped oscilations of a
particle attracted to the center of the image.
If the force applied is proportional to the distance, you tend to can
spirals and sometimes stars. If the force is inversely proportional to
distance (e.g., inverse square), you get loops.
Now, if you add more than one attractor.....
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Go on then, what's the mathematics behind this one? Gravity?
>
> Well, I don't know about "gravity"... merely the damped oscilations of a
> particle attracted to the center of the image.
I should perhaps point out that the RED trace is the path of the
particle. The GREEN path is the object's velocity, and the BLUE path is
the object's acceleration.
...which means that there's no real way to correlate the three traces to
each other, which is kind of useless. Oh well!
> Now, if you add more than one attractor.....
...it goes completely scatty! o_O
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Now, if you add more than one attractor.....
>
> ...it goes completely scatty! o_O
It's called chaos :-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>>> Now, if you add more than one attractor.....
>>
>> ...it goes completely scatty! o_O
>
> It's called chaos :-)
Well, if you wanted to be technical about it, it's "chaos" if
arbitrarily close starting points diverge violently. ;-)
But yes, I'm pretty sure this system possesses such a property. Now, to
graph it.....
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> But yes, I'm pretty sure this system possesses such a property.
It might depend on how much damping you give it.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>> But yes, I'm pretty sure this system possesses such a property.
>
> It might depend on how much damping you give it.
Doubt it.
Consider a point exactly between two attractors. A particle at this
point experiences zero resultant force. Purturbing the point by any
finite amount to either side will make the resultant force non-zero.
This will cause a different path to be traced, regardless of how much
damping is applied.
In general, applying more damping makes the system *less* unstable, but
does not remove areas of chaotic behavious; it just makes them smaller.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
>> Now, if you add more than one attractor.....
>
> ...it goes completely scatty! o_O
Twisted and tangled, baby! :-D
Post a reply to this message
Attachments:
Download 'test_drawmany.jpg' (48 KB)
Preview of image 'test_drawmany.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
As an aside, I tried to implement this on my laptop at the weekend, but
it was hopelessly unstable. Today it seems very stable indeed. I can
only assume this is to do with replacing Euler with 4th-order
Runge-Kutta. I'm surprised it makes quite this much of a difference
though...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Consider a point exactly between two attractors. A particle at this
> point experiences zero resultant force. Purturbing the point by any
> finite amount to either side will make the resultant force non-zero.
> This will cause a different path to be traced, regardless of how much
> damping is applied.
>
> In general, applying more damping makes the system *less* unstable, but
> does not remove areas of chaotic behavious; it just makes them smaller.
I think you may have some misconceptions about what chaos is. First
off, sensitivity to initial conditions is a necessary but *not
sufficient* condition for chaotic behavior. Secondly your example of a
point between the two attractors only argues for this sensitivity at a
manifold of points, and many many non-chaotic systems have such a
feature (for example a simple pendulum).
Thirdly, although it's possible I'm wrong here, if you have *any*
dampening I don't think the system can be counted as chaotic because all
paths will eventually converge to a point. If the system would be
chaotic without dampening it's sort of a minor point since it can still
look a lot like chaos, but technically I think it's incorrect to call it
chaotic.
Finally, I'm not sure that your system is chaotic. For inverse-square
springs it's known as Euler's three-body problem and appears to have a
(rather complicated) analytic solution.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> Finally, I'm not sure that your system is chaotic. For inverse-square
> springs it's known as Euler's three-body problem and appears to have a
> (rather complicated) analytic solution.
This is for just two attractors of course with three or more I'd be
pretty surprised if it weren't chaotic (and I wouldn't be too surprised
to find out I'm wrong about the two attractor system).
Also, neat pictures! You should color-plot the basins of attraction
when you have a dampening factor.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> Also, neat pictures! You should color-plot the basins of attraction
> when you have a dampening factor.
This is my goal. Unfortunately, the GTK+ subsystem is giving me some
spurious error message about a missing DLL or some such stupidity... *sigh*
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 30-4-2009 21:12, Orchid XP v8 wrote:
> Kevin Wampler wrote:
>
>> Also, neat pictures! You should color-plot the basins of attraction
>> when you have a dampening factor.
>
> This is my goal. Unfortunately, the GTK+ subsystem is giving me some
> spurious error message about a missing DLL or some such stupidity... *sigh*
>
You could use something like POV to do that for you...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>> Also, neat pictures! You should color-plot the basins of attraction
>>> when you have a dampening factor.
>>
>> This is my goal. Unfortunately, the GTK+ subsystem is giving me some
>> spurious error message about a missing DLL or some such stupidity...
>> *sigh*
>>
> You could use something like POV to do that for you...
I could use PPM too. It's just irritating that GTK+ has decided to stop
working today. :-/
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 30-4-2009 21:26, Orchid XP v8 wrote:
>>>> Also, neat pictures! You should color-plot the basins of attraction
>>>> when you have a dampening factor.
>>>
>>> This is my goal. Unfortunately, the GTK+ subsystem is giving me some
>>> spurious error message about a missing DLL or some such stupidity...
>>> *sigh*
>>>
>> You could use something like POV to do that for you...
>
> I could use PPM too. It's just irritating that GTK+ has decided to stop
> working today. :-/
>
I am sure you didn't change anything
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible <voi### [at] dev null> wrote:
> As an aside, I tried to implement this on my laptop at the weekend, but
> it was hopelessly unstable. Today it seems very stable indeed. I can
> only assume this is to do with replacing Euler with 4th-order
> Runge-Kutta. I'm surprised it makes quite this much of a difference
> though...
The stability region for linear problems is a bit larger*, not to mention the
fact that it's, well, fourth order. Of course gravitation has ugly
singularities, so it usually just seems to be the case that it doesn't blow up
as badly as Euler near singularities. You can always divide by (r+epsilon)^2,
just to smooth things out--as long as you don't care about accuracy. There are
much more robust methods, though:
http://tableau.stanford.edu/~mwest/group/Variational_Integrators
http://tableau.stanford.edu/~mwest/full_text/LeMaOrWe2004.pdf
- Ricky
* http://www.scholarpedia.org/article/Runge-Kutta_methods#Stability
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler <wam### [at] u washington edu> wrote:
> I think you may have some misconceptions about what chaos is. First
> off, sensitivity to initial conditions is a necessary but *not
> sufficient* condition for chaotic behavior.
Indeed, according to Richard Fitzpatrick:
http://farside.ph.utexas.edu/teaching/329/lectures/node57.html
In short, chaos requires
1. Aperiodic time-asymptotic behaviour
2. Deterministic
3. Sensitive dependence on initial conditions
> Thirdly, although it's possible I'm wrong here, if you have *any*
> dampening I don't think the system can be counted as chaotic because all
> paths will eventually converge to a point.
Transient != asymptotic. Good catch.
> Finally, I'm not sure that your system is chaotic. For inverse-square
> springs it's known as Euler's three-body problem and appears to have a
> (rather complicated) analytic solution.
I'm not sure that immediately disqualifies it. That's an interesting question
though. Can a dynamical system with an analytical solution be chaotic?
Certainly not without a series solution, but still. It's easy enough to come
up with aperiodic functions that solve a deterministic, dynamic system (sin(x)
+ sin(pi x), for one), but I can't think of any ODE's with an analytical and
chaotic solution.
- Ricky
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
triple_r wrote:
>> Finally, I'm not sure that your system is chaotic. For inverse-square
>> springs it's known as Euler's three-body problem and appears to have a
>> (rather complicated) analytic solution.
>
> I'm not sure that immediately disqualifies it. That's an interesting question
> though. Can a dynamical system with an analytical solution be chaotic?
> Certainly not without a series solution, but still. It's easy enough to come
> up with aperiodic functions that solve a deterministic, dynamic system (sin(x)
> + sin(pi x), for one), but I can't think of any ODE's with an analytical and
> chaotic solution.
Yeah, I wasn't sure either. On further investigation it looks like it
probably doesn't. I was able to find some references to chaotic
difference equations which had analytic solutions. I couldn't find
anything about ODEs though (at least not without wading through some
papers).
I'm now much more curious about whether or not the system is indeed
chaotic. If I get enough time to actually digest them, maybe I'll take
a deeper look at the analytic solution and see if I can figure out
what's going on there.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> As an aside, I tried to implement this on my laptop at the weekend, but
>> it was hopelessly unstable. Today it seems very stable indeed. I can
>> only assume this is to do with replacing Euler with 4th-order
>> Runge-Kutta. I'm surprised it makes quite this much of a difference
>> though...
>
> The stability region for linear problems is a bit larger*, not to mention the
> fact that it's, well, fourth order.
I still don't really comprehend why RK4 is different to just integrating
in smaller steps. (That's all the algorithm appears to do.) But hey,
whatever.
> Of course gravitation has ugly
> singularities, so it usually just seems to be the case that it doesn't blow up
> as badly as Euler near singularities.
I've removed the singularities. They make the thing wildly unstable no
matter what integration method you use.
Even so, with Euler I couldn't make it stable, no matter how tiny I set
the integration steps. (I mean, I was approaching the limit of
machine-precision arithmetic with how tiny the steps were.) RK4 manages
apparently total stability with really quite large integration steps,
which is puzzling.
> There are much more robust methods, though:
>
> http://tableau.stanford.edu/~mwest/group/Variational_Integrators
> http://tableau.stanford.edu/~mwest/full_text/LeMaOrWe2004.pdf
>
> * http://www.scholarpedia.org/article/Runge-Kutta_methods#Stability
Heh. If I understood any of that, maybe I'd agree with you. ;-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Naughty boy. You've been doing a little bit too much acid. ;-)
Post a reply to this message
Attachments:
Download 'frame0039.jpg' (53 KB)
Preview of image 'frame0039.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> I think you may have some misconceptions about what chaos is. First
> off, sensitivity to initial conditions is a necessary but *not
> sufficient* condition for chaotic behavior.
According to Wikipedia (which is never wrong), a chaotic system must
possess three attributes:
1. Sensitive dependence on initial conditions.
2. Topologically mixing.
3. Its periodic orbits are dense.
I know the system has property #1. I believe it has property #2. I have
no idea WTF #3 even *means*.
> Thirdly, although it's possible I'm wrong here, if you have *any*
> dampening I don't think the system can be counted as chaotic because all
> paths will eventually converge to a point.
According to Wikipedia, the important thing is that the orbits have
"significantly different" behaviour. (And apparently what you define as
"significant" can affect what counts as chaos.)
> Finally, I'm not sure that your system is chaotic. For inverse-square
> springs it's known as Euler's three-body problem and appears to have a
> (rather complicated) analytic solution.
Well, maybe...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Pop quiz: The image shows signs of instability. (Those raggid edges are
probably supposed to be perfect curves.) How do I solve this?
1. Decrease the maximum time step size?
2. Decrease the minimum time step size?
3. Decrease the maximum error bound?
Answers on a postcard. ;-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Now with 2x supersampling antialias - and a lot less JPEG compression...
Post a reply to this message
Attachments:
Download 'frame0039.jpg' (95 KB)
Preview of image 'frame0039.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Pop quiz: The image shows signs of instability. (Those raggid edges are
> probably supposed to be perfect curves.) How do I solve this?
>
> 1. Decrease the maximum time step size?
> 2. Decrease the minimum time step size?
> 3. Decrease the maximum error bound?
>
> Answers on a postcard. ;-)
Well, #1 is unlikely to have an effect. The operative question, though,
is whether the minimum time step size is actually being reached or not.
I don't have an answer to that question, but I just reduced the maximum
error bound ten-fold, and suddenly the images seem significantly less
"noisy".
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
...and now with max_error = 0.001
Post a reply to this message
Attachments:
Download 'frame0039.jpg' (91 KB)
Preview of image 'frame0039.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Invisible wrote:
Insanity? What's the first sign of madness??
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Weee... I think I might have to Zazzle some of these when I got the
program working smoothly. ;-)
I could stare at this for quite some time. (Especially if it was at a
decent resolution.) But nothing compares to seeing it move! ;-)
Post a reply to this message
Attachments:
Download 'frame0062.jpg' (389 KB)
Preview of image 'frame0062.jpg'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> According to Wikipedia (which is never wrong), a chaotic system must
> possess three attributes:
>
> 1. Sensitive dependence on initial conditions.
> 2. Topologically mixing.
> 3. Its periodic orbits are dense.
>
> I know the system has property #1. I believe it has property #2. I have
> no idea WTF #3 even *means*.
Basically it means that there are infinitely many periodic solutions as
well as the non-repeating ones, which I'm pretty sure is true of this
system. I was more just pointing out that your assertion a few posts
back "chaos if arbitrarily close starting points diverge violently" was
incomplete.
Note that this is *total* nit-picking on my part, I know that you
intuitively understand what chaos is.
>> Thirdly, although it's possible I'm wrong here, if you have *any*
>> dampening I don't think the system can be counted as chaotic because
>> all paths will eventually converge to a point.
>
> According to Wikipedia, the important thing is that the orbits have
> "significantly different" behaviour. (And apparently what you define as
> "significant" can affect what counts as chaos.)
I can believe this, and certainly it's fine to call the dampened system
chaotic since everyone will know what you mean. I think (without proof)
that the issue is that a dampened system doesn't actually display
sensitivity conditions in that points which are close enough will be
sucked into one of the attractors before they can diverge. Of course,
this distance will probably shrink exponentially and you increase the
dampening half-life so it'll be below numerical precision pretty quickly.
>> Finally, I'm not sure that your system is chaotic. For inverse-square
>> springs it's known as Euler's three-body problem and appears to have a
>> (rather complicated) analytic solution.
>
> Well, maybe...
I'm actually way less sure than I used to be on this. This is
extra-interesting, as I wasn't aware that it was possible to
analytically solve a chaotic ODE at all.
Reading back, my email comes off as more snarkey than I intended.
Basically what I mean to convey is that there's a whole large and
interesting mathematical theory of chaos beyond one's intuitive
understanding of it, and it strikes me like the sort of thing you might
be interested in.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible wrote:
> Weee... I think I might have to Zazzle some of these when I got the
> program working smoothly. ;-)
>
> I could stare at this for quite some time. (Especially if it was at a
> decent resolution.) But nothing compares to seeing it move! ;-)
Sweet! What's the coloring scheme?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> Sweet! What's the coloring scheme?
For each pixel, initialise a particle to that starting point, and let it
wander under the influence of the attractors in the system. (Three
"magnets" plus a "string" force to simulate a gravitational pull towards
the center.) Colour each pixel according to the current X, Y coordinates
of the particle. (X = red, Y = green.)
It actually comes out looking far more interesting if you colour by
magnet proximity, and I'm investigating other possible colouring
algorithms too. (The sharp lines are where the red or green intensity
"wraps around" back to zero. They're not part of the actual system. It's
just quick and easy to implement the colouring this way to check whether
the rest of the program is working OK.)
Obviously, since all these particles are in motion, the image constantly
changes colour - most obviously with large repeating oscilations, which
gradually go out of phase with each other as various areas of particles
pass particularly near a magnet. Hence the fractal nature of the image.
If you're paying attention, you'll note that the magnets aren't *quite*
in a triangle formation; the top two are slightly too close together,
compared to the bottom one. Hence the lack of 3-fold symmetry.
There are *so* many animation possibilities here. You can animate the
orbits of the system, or you can show the system after X seconds and
move the magnets around. Or just change the colouring algorithm. (Thus
far I haven't used particle velocity at all yet...)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> I still don't really comprehend why RK4 is different to just integrating
> in smaller steps.
RK4 takes into account how the slope of the function changes during the
step, Euler just assumes it's constant (equal to the value at the beginning
of the step). Of course to the "outside" user of such a function there is
no difference, RK4 just gives a certain level of accuracy or stability for
much less CPU time than Euler.
> RK4 manages apparently total stability with really quite large integration
> steps, which is puzzling.
The effect of RK4 over Euler is squared when you are doing it twice (from
acceleration to velocity, and from velocity to position) so it's not too
surprising. Also your forces are smooth and easily predictable for RK4
(just sums of 1/r^2) so it should perform very well. Compare to eg a car
suspension going over rough terrain, there are often sharp changes in forces
which RK4 (or any other continuous curve predictor) is not so good at.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> For each pixel, initialise a particle to that starting point, and let it
> wander under the influence of the attractors in the system. (Three
> "magnets" plus a "string" force to simulate a gravitational pull towards
> the center.) Colour each pixel according to the current X, Y coordinates
> of the particle. (X = red, Y = green.)
Those images are really cool! So let me get this straight, you colour each
pixel based on where the point that started at that pixel is at that
instant?
Must be really cool to see it being animated.
You could calculate the speed of each point, and assign that to the blue
channel :-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
scott wrote:
>> For each pixel, initialise a particle to that starting point, and let
>> it wander under the influence of the attractors in the system. (Three
>> "magnets" plus a "string" force to simulate a gravitational pull
>> towards the center.) Colour each pixel according to the current X, Y
>> coordinates of the particle. (X = red, Y = green.)
>
> Those images are really cool!
Thank you. :-D
> So let me get this straight, you colour
> each pixel based on where the point that started at that pixel is at
> that instant?
Yep, that's the one. Start a particle from each pixel, colour that pixel
according to where the particle is now. (Using any arbitrary colouring
algorithm you fancy.) You *could* use an image map, for example...
> Must be really cool to see it being animated.
Clearly I'll have to put the result on YouTube at some point. ;-)
> You could calculate the speed of each point, and assign that to the blue
> channel :-)
Yeah, possibly. Or maybe add some white or something. Of course, when
it's in motion, you can tell by how quickly each point changes colour.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Kevin Wampler wrote:
> Sweet! What's the coloring scheme?
The *other* possibility is to colour each pixel by the density of points
that have reached there. (Kind of "backwards" compared to the current
algorithm.) I suspect the result wouldn't be as pretty though.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
OK, now this is just *weird*... I just reimplemented the same program at
home, and it now produces the same images. However, it runs very, very
much slower than at work. And yet, the PC at work is an AMD AthlonXP
1700+, while the PC here is an AMD Athlon64 X2 4200+.
In other words, somehow I've made a mistake somewhere that makes the
program slower than it should be. But it produces the right answers, so
finding the program is going to be... uh... "interesting". o_O
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |