Title: n-body-fractal? Post by: kram1032 on February 08, 2010, 12:39:49 AM Pauldelbrot's Volterra-Lokta-Msets and the small Java-Apps, Gary found, brought me to a crazy idea:
Would it be possible to do some kind of 3-body (http://en.wikipedia.org/wiki/N-body_problem) fractals? (Finding cases in 3D where the bodies form circular or elliptical or cycloidical orbits or escape in parabolas or hyperbolas or those with totally chaotic behaviour and colour each start position variation accordingly, just like those magnetic pendulum fractals but more complex...) Not sure if I got it right with the short thinking I spent on this yet but I think, the resulting set would be 9-dimensional in total: 3Ds for startingpositions * 3 planets... julia-sets in that case would be the orbits for a single case, I guess... It would be possible to extend this even further, adding another 3 Dimensions for initial velocities or accelerations.... Title: Re: n-body-fractal? Post by: Timeroot on February 08, 2010, 03:43:04 AM Would these three bodies be in 2 or 3 dimensional space? I'll assume 2d for now...
If I count the dimensions, I think it would be 2 starting coordinates per planet, then 2 coordinates per planet for the initial velocity, and a final one parameter per planet indicating mass. That makes 15 dimensions, but we can subtract 5 because we can set one planet to a mass of 1, starting at the origin, and with no velocity, leaving us with 10. They don't have "initial acceleration", and I know what you mean by ".. * 3 planets"; if one does color based on the final result, then that wouldn't really introduce new dimensions. I think it might be interesting to color based on whether all planets escape one another, or if 2 collide and one escapes, or if they all collapse. I checked the public formula database, and there some things similar to this in lkm.ufm under "Gravity 2", "Gravity 3", and "Gravity 4". It seems interesting, but I can't get it to produce any images...maybe some here can provide a upr showing what gives us the pretty pictures? ;D Title: Re: n-body-fractal? Post by: kram1032 on February 08, 2010, 03:10:10 PM I thought about 3D, actually...
And you have 3 planets and thus 3*3 variables for the location, which left me with 9 Dimensions... And a 10th, 11th and 13th for masses, however, they will be fixed and maybe in the "standard case" (The equivalent to z²+c, rather than z³+c*tan(z) or what ever^^) will have all three masses set to 1 :) Title: Re: n-body-fractal? Post by: lkmitch on February 08, 2010, 08:21:07 PM Would these three bodies be in 2 or 3 dimensional space? I'll assume 2d for now... If I count the dimensions, I think it would be 2 starting coordinates per planet, then 2 coordinates per planet for the initial velocity, and a final one parameter per planet indicating mass. That makes 15 dimensions, but we can subtract 5 because we can set one planet to a mass of 1, starting at the origin, and with no velocity, leaving us with 10. They don't have "initial acceleration", and I know what you mean by ".. * 3 planets"; if one does color based on the final result, then that wouldn't really introduce new dimensions. I think it might be interesting to color based on whether all planets escape one another, or if 2 collide and one escapes, or if they all collapse. I checked the public formula database, and there some things similar to this in lkm.ufm under "Gravity 2", "Gravity 3", and "Gravity 4". It seems interesting, but I can't get it to produce any images...maybe some here can provide a upr showing what gives us the pretty pictures? ;D There's an example, "Gravity Example," in lkm.upr. I wrote this formula to draw the orbits of bodies in a gravitational n-body system (where n = 2, 3, or 4 only), in 2d. Here's the upr: GravitySample { ; copyright Kerry Mitchell 27jan2000 ::UUQhfin2tX5yutNMQU09CQ/DEavt5L9wtgr7iiuqfAF0SU2EhSUgi2NKf9d0DLZH7UkiWgmA kdizc5lzQOHoSnM3LNfKMAh8avRJi+iTeS77QfXW1YURofqL8HE8MM6gSv/gf4TjsT5aF8+9 l7UFafrI6rKnrD9NtP/gyY+MZDNdDFjxRhBD6HOlcZjXbrFR52KlHxiQ2GZOcgCaMCicwWIq Oa86GZbbYQlspRXvfcrqavyJwbwoK5+aBJMo06Axyh0VyH195ToZoGlDKi8HE2ySUp2oqlVQ vZeoa9xyqIE4krTEtfsXZrGKmoeXa+xT5YxK6mV41UY1JYFBORIOZ+LKoAvOeDedWSCmGzxs 0MOnllwTnMhNJZ19007L4GeDZU9pRDvVY/2j7FA29i5H9oCuvIC2aeSy0K6VrYzr86KVrX1A OinKgn8dNqzvJN2Wd/bUEkYnUbsH9CC8OGGorb1FqxpFnsutEuuzPuT5sW/zvmzNzXz7kt68 pb3crx621J6fB1+jFqwAw/bt1orVSXYA8EVoBfGy2WBH0BRnqFprLUPKwoB/Ekk00UKJeKc8 cceMjy3eOOpvJQnzRyobZE65czbKjjjx4sp4wE8Uc85IxX4y1iZzifm7sbKJovHH8vszqtzN 2CWE/b4H6C/wYv14HyH8z7c+ZLnmxJ3Ff4UYy/O0DBnR4vW65axL0z1mzee98vhdILsDcAvl YH8Hgz79f8AjecK+ukT/vMIp3SOcy2sY6rkcuW8C5ct5sbKo/W0p1LdtLgD0YfQO/PJHpxgm eTevCNkLGehoY+CBsMvjvzk+g4/oB6fBRav0rC== } Kerry Title: Re: n-body-fractal? Post by: kram1032 on February 08, 2010, 08:36:04 PM Hmm, probably my fault (just got the 30-days trial) but if I copy this and save it as a upr, it tells me "contains errors"
Title: Re: n-body-fractal? Post by: lkmitch on February 08, 2010, 08:41:35 PM Hmm, probably my fault (just got the 30-days trial) but if I copy this and save it as a upr, it tells me "contains errors" Hmmm... Did you try copying and pasting into another open fractal instead of saving it as a upr? Here's an uncompressed version so you can read what the layers are and how they're colored. I've attached the image (except, I changed the colors and modes a bit, but the orbits are the same). GravitySample { ; copyright Kerry Mitchell 27jan2000 fractal: title="Gravity Sample" width=480 height=480 layers=4 credits="Kerry Mitchell;1/27/2000" layer: caption="comet 3" opacity=25 method=multipass mapping: center=0/0 magn=1 formula: maxiter=628 percheck=off filename="lkm.ufm" entry="gravity3-comet" p_zc0=-2/-0.2 p_vc0=1/0 p_z10=1/0 p_z20=-0.5/0.866025403784438647 p_z30=-0.5/-0.866025403784438647 p_v10=0/1 p_v20=-0.866025403784438647/-0.5 p_v30=0.866025403784438647/-0.5 p_mass1=3.466 p_mass2=3.466 p_mass3=3.466 p_timestep=0.01 p_ztype="comet position" p_bailout=1000 inside: transfer=cuberoot filename="lkm.ucl" entry="basic" p_colorby=magnitude outside: transfer=linear gradient: smooth=yes index=0 color=16777215 index=50 color=14532495 index=100 color=11829312 index=150 color=8405008 index=200 color=0 index=250 color=8405008 index=300 color=11829312 index=350 color=14532495 opacity: smooth=no index=0 opacity=255 layer: caption="comet 2" opacity=33 method=multipass mapping: center=0/0 magn=1 formula: maxiter=628 percheck=off filename="lkm.ufm" entry="gravity3-comet" p_zc0=-2/-0.1 p_vc0=1/0 p_z10=1/0 p_z20=-0.5/0.866025403784438647 p_z30=-0.5/-0.866025403784438647 p_v10=0/1 p_v20=-0.866025403784438647/-0.5 p_v30=0.866025403784438647/-0.5 p_mass1=3.466 p_mass2=3.466 p_mass3=3.466 p_timestep=0.01 p_ztype="comet position" p_bailout=1000 inside: transfer=cuberoot filename="lkm.ucl" entry="basic" p_colorby=magnitude outside: transfer=linear gradient: smooth=yes index=0 color=16777215 index=50 color=9428415 index=100 color=4240512 index=150 color=1081408 index=200 color=0 index=250 color=1081408 index=300 color=4240512 index=350 color=9428415 opacity: smooth=no index=0 opacity=255 layer: caption="comet 1" opacity=50 method=multipass mapping: center=0/0 magn=1 formula: maxiter=628 percheck=off filename="lkm.ufm" entry="gravity3-comet" p_zc0=-2/0 p_vc0=1/0 p_z10=1/0 p_z20=-0.5/0.866025403784438647 p_z30=-0.5/-0.866025403784438647 p_v10=0/1 p_v20=-0.866025403784438647/-0.5 p_v30=0.866025403784438647/-0.5 p_mass1=3.466 p_mass2=3.466 p_mass3=3.466 p_timestep=0.01 p_ztype="comet position" p_bailout=1000 inside: transfer=cuberoot filename="lkm.ucl" entry="basic" p_colorby=magnitude outside: transfer=linear gradient: smooth=yes index=0 color=16777215 index=50 color=12554205 index=100 color=8405172 index=150 color=4198528 index=200 color=0 index=250 color=4198528 index=300 color=8405172 index=350 color=12554205 opacity: smooth=no index=0 opacity=255 layer: caption="stars" opacity=100 method=multipass mapping: center=0/0 magn=1 formula: maxiter=628 percheck=off filename="lkm.ufm" entry="gravity3-comet" p_zc0=-2/0 p_vc0=1/0 p_z10=1/0 p_z20=-0.5/0.866025403784438647 p_z30=-0.5/-0.866025403784438647 p_v10=0/1 p_v20=-0.866025403784438647/-0.5 p_v30=0.866025403784438647/-0.5 p_mass1=3.466 p_mass2=3.466 p_mass3=3.466 p_timestep=0.01 p_ztype="all stars" p_bailout=1000 inside: transfer=cuberoot filename="lkm.ucl" entry="basic" p_colorby=magnitude outside: transfer=linear gradient: smooth=yes index=0 color=16777215 index=100 color=8421504 index=200 color=0 index=300 color=8421504 opacity: smooth=no index=0 opacity=255 } Title: Re: n-body-fractal? Post by: Timeroot on February 09, 2010, 01:19:01 AM Oh, I see. Heheh, I didn't even know there were uprs in the Public Database. X-P As a suggestion, why not make either the imaginary part or the polar angle of Z equal to the speed of the object? This might produce more interesting colors. As far as I can tell, that just means adding "+flip(v1new)" (or 2, or 3, or c) after "rmin=r". Another interesting alteration would be giving faster stars/comets more brilliance; something like r=cabs(z1new-#pixel)/log(v1new) might give pretty pictures. You write great formulas, by the way. :)
Title: Re: n-body-fractal? Post by: Timeroot on February 09, 2010, 06:01:46 AM I think I've got a pretty good version of those alternate colorings working; I've only it done it for your 2-body formula so far, but once I get it all perfect it should be very easy it extend to more bodies. The options I've added are:
-Compounding - this takes the harmonic mean of the distance to the two stars, rather than just the closer one. It contains options so that it can either be done where it takes both distances on the same timestep, or keeps track of each star individually. This smooths out the lighting a lot, with the exception of a star looping back on itself. Eventually, though, I may add something where it does it using mathematically correct coloring, in which case that will also be fixed. -Velocity Brilliance - this can be activated so that with high velocities, the light extends further. For some reason, when this is used with simultaneous compounding, small noisy patches appear where two stars cross at high velocities. That can be fixed by unchecking "repeat gradient". -Velocity Conversion - takes the velocity of the star when it passes nearest and allows you to either include it as the argument or the imaginary part of z (or neither). So far, this produces greatly unsatisfying results visually, but I think with a custom direct coloring algorithm it would look nice. I've included what I have so far in an attachment, along with a sample upr. Of course, lkmitch wrote the formula, but let me know what you think of the modifications. Title: Re: n-body-fractal? Post by: kram1032 on February 09, 2010, 03:07:42 PM Hey, nice :)
So that image would be a Juliaset. Now what would be with a (partially) Mandelbrotesk set of this, where all the planets except for one keep their starting-values and for the last one, the location-parameter gets varied, then colour in some way to find the class of the orbit (To see, wether that orbit is stable, chaotic, somewhere in-between or the planet just escapes) That's actually what I meant in my first post :) Title: Re: n-body-fractal? Post by: Timeroot on February 10, 2010, 01:42:58 AM Actually, that wouldn't be the Julia set... this is really a dynamic system (think of pictures of the Lorenz equations), plotting the orbits. What you just described - keeping all parameters constant except for one location variable - would be the Julia Set. The Mandelbrot set doesn't have a very well defined analog here... Think of the Newton fractal. It's a Julia Set (with not really any parameters). You can create a Nova fractal which has a Mandelbrot set, but that's already a different idea of formula. To create a Mandelbrot Set for the n-body problem, you would basically move one planet a set amount each iteration. That makes for very poor results in dynamic systems. A better thing may be to take different slices of parameter space, such as the respective masses, locations, and velocities of the different stars.
Title: Re: n-body-fractal? Post by: kram1032 on February 10, 2010, 03:54:11 PM Ah, yes, sure...
True, the first thing is just the orbit (and would be so in the M-set aswell), by not describing the whole plane x²+c but only c²+c, so to say... the Julia is x²+c, the orbit c²+c and the Mset x²+x, where c_1 is a constant and x_1 is the location of the very first solution... Oh well, a Julia-Set then :) Actually it would work just as usual with the escape-time colouring, for the 3-body-system Julia-Set even possible for each planet seperately, by splitting up the r-g-b channel for the three planets. Not escaping -> black, one escapes -> blue (the quicker, the bluer), the other one escapes -> green (faster -> greener), the last one with red :) Title: Re: n-body-fractal? Post by: Timeroot on February 10, 2010, 07:24:08 PM Well, I've come down with a cold, so that should give me time to try to code that (unless my mom tells me not to use the computer. :P)
Title: Re: n-body-fractal? Post by: kram1032 on February 10, 2010, 08:57:40 PM already curious :)
It probably actually will be pretty computing-heavy... Title: Re: n-body-fractal? Post by: Timeroot on February 10, 2010, 09:56:02 PM It should take only as much computation as the current, "Orbit" image does. That version could actually be optimized a lot by calculating the positions of the stars in the global: section and then storing the values in an array. But the "Julia" set would not work like that, and would have to be fully computed for each pixel (like the current code does). Btw, I thought of an analog for the "Mandelbrot Set" for dynamic systems: Just have a constant force - the "c" value - acting on one star. If it acted on all stars, it would just be a shift of the coordinate system, but acting on only one will give other results. Another option would be having the force exert only on the comet; it reminds me of a talk on swarming behavior I once saw, in which it was demonstrated that if only 5% of the fish in a school know where to go - and are always "pulled" that direction - the entire school moves just as fast as if every fish knew.
Title: Re: n-body-fractal? Post by: kram1032 on February 10, 2010, 10:19:16 PM That effect also works with traffic ;)
If there is a traffic jam as well as an obvious alternative route, theory says that only about 10% of the people need to use that root and most of the others will follow along for some reason. Mass dynamics result in a lot of nice fractal patterns :) I once saw walk-simulations for crowds where each person enters and wants to leave a plazza at different sides, chosen randomly. The pattern that was created due to trying to get past all the other peoples resembled a fractal caridode :) Title: Re: n-body-fractal? Post by: Timeroot on February 12, 2010, 07:53:14 PM I just finished The Beauty of Fractals, and I learned that actually a Mandelbrot Set doesn't have to be related to constant addition. In fact, the "first" Mandelbrot Set was of the form z=c*(1+z^2)^2/(z*(z^2-1)), not z=z^2+c. The Julia Set, of course, is the "chaotic boundary", the points which never go to any attractor - infinite, fixed, periodic, or strange - but the Mandelbrot Set (for a given Julia Set) is just a control space for some parameter - any at all. For a polynomial map, that could mean z^c + 0.25. So with the N-body problem, I suppose the Julia Set would be a map of different initial positions and velocities for the stars. That's 8 dimensional, though, so you'd probably have to keep six as constants. You might get something where (for example) you have the location and velocity of one set, and the location of the other, and each point in the plane corresponds to a different velocity. Or maybe you have the locations of both set, and their angles of trajectory, and each point corresponds to a different initial speed. Because these are the only parameters which affect the simulation (besides the timestep), that means - if you have a simple, Newtonian gravity - each point in the plane would have to correspond to a different mass. I suppose you could say that one star is the variable z, and the initial conditions of the other are a constant parameter which are used to calculate the changes on z...but who says we strictly need to stick the Msets and Jsets anyway, huh? We'll call it a Julibrot and do whatever we want with it :evil1: |