Modeling "Dynamical Relaxation"

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

Modeling "Dynamical Relaxation"

Post by A Random Player »

...Which according to Wikipedia, is when galaxies to throw away lighter objects. I'm using a simple Python script [edit: fixed link]

Code: Select all

import random
import math
output = "Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0]"
for a in range(24):
 rand = math.log(random.random(),.95)
 rand2 = random.random()*2*math.pi
 rand3 = math.log(random.random(),.5)
 rand4 = random.random()*2*math.pi
 rand5 = math.log(random.random(),.992)
 X = rand*math.cos(rand2)
 Y = rand*math.sin(rand2)
 XV = rand3*math.cos(rand4)
 YV = rand3*math.sin(rand4)
 output = output + ", [x0: " + str(X) + ",y0: " + str(Y) + ",vx: " + str(XV) + ",vy: " + str(YV) + ",t0: 0,who: 2,m: "+ str(rand5) + "]"
print output
to generate some codes, like this one:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceG: -2,Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: -2.35797261019,y0: 14.0612449195,vx: -1.21915939664,vy: 0.400289888786,t0: 0,who: 2,m: 176.125819905], [x0: 5.78584117151,y0: -1.21261539069,vx: -0.060418500047,vy: 0.154890776325,t0: 0,who: 2,m: 1.56786586166], [x0: -0.333726968204,y0: 6.02919642964,vx: -0.70445417451,vy: 0.610397808118,t0: 0,who: 2,m: 77.3422130093], [x0: 4.7540885605,y0: -2.34717345394,vx: -3.91881223044,vy: 0.0626716156819,t0: 0,who: 2,m: 72.648088603], [x0: -0.538890333636,y0: 5.97204621877,vx: 0.358641874052,vy: 0.028476468443,t0: 0,who: 2,m: 148.702718716], [x0: 1.59391059935,y0: -9.34228695815,vx: -1.58129699601,vy: -1.25586240523,t0: 0,who: 2,m: 34.1735270371], [x0: -17.1960114754,y0: 15.6158813992,vx: 1.02254113683,vy: -0.942167511134,t0: 0,who: 2,m: 221.749173044], [x0: 1.6817116193,y0: 17.3780249575,vx: 0.122765714967,vy: -0.0991790400716,t0: 0,who: 2,m: 87.4319843484], [x0: 32.7406192295,y0: 31.4803505023,vx: 0.194837217769,vy: 0.215973398121,t0: 0,who: 2,m: 78.43792617], [x0: 38.2255587309,y0: 1.91485862777,vx: 0.136948280953,vy: -0.904065241109,t0: 0,who: 2,m: 162.281647764], [x0: 4.20104232767,y0: 14.6324129993,vx: 0.0989210951729,vy: -0.0548832822774,t0: 0,who: 2,m: 63.6147448476], [x0: -12.5071049086,y0: -69.4877662502,vx: 0.336051779336,vy: 0.241043534679,t0: 0,who: 2,m: 166.470628777], [x0: 0.167491854237,y0: -3.73137974349,vx: -0.394977697786,vy: -0.368463433794,t0: 0,who: 2,m: 73.8661862523], [x0: -8.95819658409,y0: -9.06581462213,vx: -0.766825978296,vy: 1.49601846701,t0: 0,who: 2,m: 90.5468535621], [x0: -0.0845876561968,y0: 1.61573390039,vx: -1.06058260721,vy: -2.04414513121,t0: 0,who: 2,m: 322.623765312], [x0: -5.0019724,y0: -10.5383746277,vx: -0.395761026347,vy: -0.449018558361,t0: 0,who: 2,m: 12.6585117891], [x0: -3.01444478019,y0: -1.06036884849,vx: -1.18302545374,vy: -3.65622524611,t0: 0,who: 2,m: 187.718322592], [x0: -16.3803204876,y0: -14.0839969491,vx: -0.0901819300563,vy: 0.173157680307,t0: 0,who: 2,m: 149.34186091], [x0: -19.3773961747,y0: -16.7238210702,vx: -0.322239392541,vy: 0.952174154363,t0: 0,who: 2,m: 83.9190215893], [x0: -0.799482193901,y0: 19.096473783,vx: 0.0752216758956,vy: 0.504512916501,t0: 0,who: 2,m: 45.9719449014], [x0: 8.85476785956,y0: -68.8783613476,vx: 0.539562127422,vy: -1.25383920826,t0: 0,who: 2,m: 412.939080879], [x0: -6.85464555764,y0: -2.83570995432,vx: 3.27972019851,vy: 1.79255637625,t0: 0,who: 2,m: 42.7776407036], [x0: -13.2895946619,y0: -44.5641661074,vx: -0.243521465235,vy: -0.692397347663,t0: 0,who: 2,m: 1.82298993639], [x0: 7.35843575706,y0: 2.5163152672,vx: -0.876507586873,vy: 1.41357486829,t0: 0,who: 2,m: 18.6658993802]
I think it appears to be working, but I can't tell without a way to see the mass of ejected particles.
Last edited by A Random Player on Fri Jun 14, 2013 10:39 am, edited 1 time in total.
$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: Modeling "Dynamical Relaxation"

Post by testtubegames »

Interesting. I've heard of things getting thrown out of galaxies, but never of this phenomenon by name. In the simulation you ran, I have to agree, it does seem to be happening. You end up with a tightly bound, whirling ball of the leftover planets. In the update, I'm planning on not only having the planets' size reflect their mass, but letting you select any planet to see its data.

I might be able to do a quick-and-dirty hack to the current version, so we can indeed see whether it's the heavier planets that get left behind. I'll give it a shot.
Post Reply