.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Space Empires: IV & V (http://forum.shrapnelgames.com/forumdisplay.php?f=20)
-   -   Calculating a planet's mass & gravitational pull (http://forum.shrapnelgames.com/showthread.php?t=10165)

dogscoff August 22nd, 2003 03:26 PM

Re: Calculating a planet\'s mass & gravitational pull
 
That would make it too cluttered. I'm not talking about the spreadsheet any more, I'm currently putting the whole thing into javascript for my webpage.

Suicide Junkie August 27th, 2003 02:17 PM

Re: Calculating a planet\'s mass & gravitational pull
 
Looks good to me

dogscoff August 27th, 2003 03:06 PM

Re: Calculating a planet\'s mass & gravitational pull
 
Yeah, I thought it looked ok, but all the numbers come out wrong.
Here's the line from the code. Something just has to be wrong with it, but I'll be stuffed if I can figure it out.

cells[radius].value=Math.pow(((cells[gravity].value/GRAV)/cells[mass].value),1/3)/1000;

I've also just put in an alert statement to display the output of the same calculation (in case the number was getting jiggered about elsewhere) but apparently it isn't.

[ August 27, 2003, 14:11: Message edited by: dogscoff ]

dogscoff August 27th, 2003 04:03 PM

Re: Calculating a planet\'s mass & gravitational pull
 
Hmm, I was *way* off, but now I'm closer. I went back to S_J's original calculation of g = GM/(1000*R)^2
(dunno where I got g=G*m*(r*1000)^3 from)

g = GM/(1000*R)^2
g*(1000*R)^2 = GM
(1000*R)^2 = GM/g
(1000*R) = squareroot(GM/g)
R=(squareroot(GM/g))/1000

In javascript, that comes out as
radius=(Math.sqrt(GRAV*mass)/gravity)/1000

and it works. Sorry for all the fuss, ppl.

[ August 27, 2003, 15:12: Message edited by: dogscoff ]

Suicide Junkie August 27th, 2003 07:01 PM

Re: Calculating a planet\'s mass & gravitational pull
 
radius=(Math.sqrt(GRAV*mass)/gravity)/1000

Shouldn't you Math.sqrt( grav*mass/gravity ) or somesuch?

Puke August 27th, 2003 07:54 PM

Re: Calculating a planet\'s mass & gravitational pull
 
GURPS Space (from Steve Jackson Games) used to have work sheets for generating alien planets, that included orbital radius and period, roation, gravity, mass, temerature, etc, etc..

might look for an old copy, or a PDF of the reference sheets Online.

Ack August 28th, 2003 12:22 AM

Re: Calculating a planet\'s mass & gravitational pull
 
Hmm... I've often wondered about the error associated with using point source gravitational equations. Too lazy to look it up, so maybe someone here knows.

The equations posted here all assume that gravity comes from a point source at the core of a planet. This is fine when you are many, many planet diameters away from a planet. But when you get within some distance, the gravitation effects should be distributed across the planet's height, width, and thickness. The gravitational force that a body feels when within this distance is the vectored sum of all these components. Additionally, each layer of a planet has a different density and therefore differing gravitational contributions.

A second option is that during planet formation, the denser elements settle more towards the planet core. In effect, the bulk of the planet's mass resides in the core. This would make the point source error very small until you've pierced the surface and moved very close to the planet's core.

dogscoff August 28th, 2003 01:58 AM

Re: Calculating a planet\'s mass & gravitational pull
 
*sigh*

sorry to bother y'all again, but...
Where am I going wrong? I'm trying to work out the calculation needed to derive radius (in km) from a known mass and surface gravity (in metres per second per wotsit):

g=surface gravity, G= gravitational constant, m=mass, r=radius.

g=G*m*(r*1000)^3 - this one works in my excel sheet.
therefore
g/G=m*(r*1000)^3
therefore
(g/G)/m=(r*1000)^3
therefore
cuberoot((g/G)/m)=r*1000
therefore
cuberoot((g/G)/m)/1000=r

Or is that all crud? It's a long time since I studied or used this kind of maths.

Apart from this, the javascript sheet is coming along nicely.

dogscoff August 28th, 2003 12:21 PM

Re: Calculating a planet\'s mass & gravitational pull
 
Ack: I don't doubt that these equations have a certain level of innaccuracy built in, but I'm only using them for writing purposes, so I can be sufficiently vague to leave room for correction.
When the program goes up on my website though I fully intend to list all the known areas of innaccuracy. I'll add your comments to my list, thanks=-)

Suicide Junkie August 28th, 2003 02:17 PM

Re: Calculating a planet\'s mass & gravitational pull
 
Differing densities at various depths does not affect the calculation, assuming that at any particular depth, the density is the same all the way around the planet.
If the density is not the same (ocean water vs rock, say) it still only has a small effect, which is swamped by the effect of the 1000's of km of rock below it.

Distance from the planet surface has the biggest effect.
If you are on top of a mountain, the gravity is lower. While there is a bit more mass directly below you, the 1/r<sup>2</sup> decrease hits much harder.

However, its still a fraction of a percent change.

You'd need something with an irregular shape, like an asteroid to get decent changes in gravity, but then the gravity is so low to begin with, it really dosen't matter.

Stuff with higher gravity smushes itself into an ovoid ball, and the approximations apply.


All times are GMT -4. The time now is 12:30 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.