The fractal universe

What did you draw?
Post Reply
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

The fractal universe

Post by A Random Player »

No, the real universe is not fractal. But this one certainly can be:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: -10,y0: 0,vx: 0,vy: 3.213594362,t0: 0,who: 2,m: 100], [x0: 10,y0: 0,vx: 0,vy: 0.051316702,t0: 0,who: 2,m: 100], [x0: 100,y0: 0,vx: 0,vy: -0.367544468,t0: 0,who: 2,m: 200], [x0: 550,y0: 0,vx: 0,vy: -0.632455532,t0: 0,who: 2,m: 400]
I'll make a faster way to make these in a while.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: The fractal universe

Post by A Random Player »

And.. Here it is:
The script. Not a very good piece of code, but hey, it works!

Code: Select all

planets = 4
locexp = 5
initmass = 100
initloc = 10
masses = []
locs = []
velocities = [0]*planets
accum = 0
for a in range(planets):
 masses = masses + [initmass * 2**a]
 locs =  [accum + initloc * locexp**(planets - a-2)] + locs
 accum = accum - initloc * locexp**(planets - a-2)
locs[0] = locs[1]-2*initloc
masses = [initmass] + masses[:-1]
#print locs, masses
for a in range(planets-1,0,-1):
 #print "a:" + str(a)
 for b in range(0,a+1):
  #print "b:" + str(b)
  if b == a:
   sign = -1
  else:
   sign = 1
  #print "mass:" + str(1.0 * masses[a])
  #print "dist:" + str(2*initloc * locexp**(a-1))
  #print sign * ((1.0 * masses[a])/(2*initloc * locexp**(a-1)))**.5/(2**.5)
  velocities[b] = velocities[b] + sign * ((1.0 * masses[a])/(2*initloc * locexp**(a-1)))**.5/(2**.5)
#print velocities

output = "Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0]"
for a in range(planets):
 output = output + ", [x0: " + str(locs[a]) + ",y0: 0,vx: 0,vy: " + str(velocities[a]) + ",t0: 0,who: 2,m: " + str(masses[a]) + "]"
print output
Planets refers to the number of planets, locexp is the differences in scale in each level. initmass is the minimum mass. initloc was a bit hacky - It's the distance from the smallest planet to the barycenter of the smallest system.

I've created this:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 39000,ySet: 0], [x0: -39060,y0: 0,vx: 0,vy: 4.02657657493,t0: 0,who: 2,m: 100], [x0: -39040,y0: 0,vx: 0,vy: 0.864298914763,t0: 0,who: 2,m: 100], [x0: -38950,y0: 0,vx: 0,vy: 0.445437744847,t0: 0,who: 2,m: 200], [x0: -38500,y0: 0,vx: 0,vy: 0.18052668078,t0: 0,who: 2,m: 400], [x0: -36250,y0: 0,vx: 0,vy: 0.0129822128135,t0: 0,who: 2,m: 800], [x0: -25000,y0: 0,vx: 0,vy: -0.0929822128135,t0: 0,who: 2,m: 1600], [x0: 31250,y0: 0,vx: 0,vy: -0.16,t0: 0,who: 2,m: 3200]
(code edited to start at point of interest)
It appears buggy, but I think that's how it actually is supposed to go. (Can anyone run this for a few hours?)
Last edited by A Random Player on Sun Aug 04, 2013 9:38 am, edited 2 times in total.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
19683
Posts: 151
Joined: Wed Jun 05, 2013 12:15 pm

Re: The fractal universe

Post by 19683 »

Awesome! :D

Of course, over time it decays. :(
Binomial Theorem: ((a+b)^n)= sum k=0->k=n((n!(a^(n-k))(b^k))/(k!(n-k)!))
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: The fractal universe

Post by A Random Player »

19683 wrote:Awesome! :D

Of course, over time it decays. :(
It does? I've never seen it happen (the second one looks like it does, but is really just a chaotic pattern).
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: The fractal universe

Post by testtubegames »

So, I sit down to my computer for the first time in quite a few days -- returning from a trip to a place with very sparse internet. I boot up the forums to see what's up in the world... and I find this! So cool.

What a neat idea! I wasn't sure what to expect when I loaded it... but, yeah, you 'fractilized' that planetary system.

I plugged in your python code, too, and tried my hand (not so successfully) at making other neat systems. With too many planets, of course, you can't zoom out enough to see them. Or you have to cramp them in so close to one another that their motion chaotically decays.

What surprises me, in fact, is how little decay you notice in your examples. You take a couple of circularly co-orbiting planets, and replace one with a closer set of co-orbiting planets, moving about the same space. To the 0'th order, that's *kinda* not changed anything. But of course, it really has. Instead of a 2-body system, there's a 3-body system, and chaos will tend to take over. At least, in a bunch of my examples, chaos took over. But it seems you've been able to space things appropriately to keep order (for as long as I've had the patience to run them). There must be some rule that could tell you what values of locexp, say, you'd need to keep the pattern from decaying (for a given amount of time). Hrm, gotta think about it more...
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: The fractal universe

Post by A Random Player »

testtubegames wrote:So, I sit down to my computer for the first time in quite a few days -- returning from a trip to a place with very sparse internet. I boot up the forums to see what's up in the world... and I find this! So cool.

What a neat idea! I wasn't sure what to expect when I loaded it... but, yeah, you 'fractilized' that planetary system.

I plugged in your python code, too, and tried my hand (not so successfully) at making other neat systems. With too many planets, of course, you can't zoom out enough to see them. Or you have to cramp them in so close to one another that their motion chaotically decays.

What surprises me, in fact, is how little decay you notice in your examples. You take a couple of circularly co-orbiting planets, and replace one with a closer set of co-orbiting planets, moving about the same space. To the 0'th order, that's *kinda* not changed anything. But of course, it really has. Instead of a 2-body system, there's a 3-body system, and chaos will tend to take over. At least, in a bunch of my examples, chaos took over. But it seems you've been able to space things appropriately to keep order (for as long as I've had the patience to run them). There must be some rule that could tell you what values of locexp, say, you'd need to keep the pattern from decaying (for a given amount of time). Hrm, gotta think about it more...
To get a better view of the system, you could edit the starting X coordinate. (But be careful, Xset and x0 are opposites of each other: If the first (smallest) mass starts at -39000, Xset has to be 39000.

I think the problem is you're setting locexp to too small values. When I played around with the script, I found that 4 was too small, so I stuck with 5. (If it gets to still be an issue, there's always 6!)

Oh, and I found a bug related to initmass :oops: I've fixed it, but if you changed it earlier it might have caused problems. Edit: Actually I didn't, apparently. Will look closer later. Yes I did, I just forgot to update it in the interpreter. The link's fixed too. Have fun with a high-speed version of the original:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: -310,y0: 0,vx: 0,vy: 10.1622776602,t0: 0,who: 2,m: 1000], [x0: -290,y0: 0,vx: 0,vy: 0.162277660168,t0: 0,who: 2,m: 1000], [x0: -200,y0: 0,vx: 0,vy: -1.16227766017,t0: 0,who: 2,m: 2000], [x0: 250,y0: 0,vx: 0,vy: -2.0,t0: 0,who: 2,m: 4000]
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
DavidAllyn68
Posts: 28
Joined: Thu Aug 01, 2013 2:28 pm

Re: The fractal universe

Post by DavidAllyn68 »

this is awesome!
Post Reply