# Gravity

## Recommended Posts

llutyo    122
Hi! I would like to model gravity, using Newton's laws. F=G*M*m/(r^2) Every other forces are irrelevant, so according to Newton's 2nd law: m*a=G*m*M/(r^2) a(t)=G*M/(r(t)^2) (d^2/dt^2)r(t)=G*M/(r(t)^2) Now I would like to solve this differential equation for r(t). I was told to multiply each side by (d/dt)r(t), so after some more step, I got: ((d/dt)r(t))^2=2*G*M/r(t)+C Do you have any idea how to solve this for r(t)? I have tried with Maple, but it still gives me a horrible solution (although not as horrible as for the first formula). This equation can be seperated, however: integral( 1/sqrt( G*M/r(t) + c ) )=? Thanks: Lutyo [Edited by - llutyo on March 5, 2007 1:24:12 PM]

##### Share on other sites
I don't see what you have done after multiplying through by the integrating factor r', but it seems impossible. I get:

(1/2) d/dt(r')2 = GMr'/r + C1

(' represents differentiation with respect to t)

which is nearly a first-order ordinary differential equation, but it is still highly nonlinear. In general, nonlinear ODEs can't be solved, but there is often a transformation into canonical variables that will save the day. I've found no such transformation.

Typically, these celestial problems become far more palatable when you make the substitution r(t) = 1/u(t), often leading to a harmonic oscillator equation. However, under this transformation I get the slightly-more-horrible:

2u'2 - uu'' = GMu5

The power-five looks familiar to me (I'm sure I studied similar problems similar to this in my first year of university), but I can't think how to proceed.

This isn't homework, by the way, is it?

##### Share on other sites
llutyo    122
Quote:
 I don't see what you have done after multiplying through by the integrating factor r', but it seems impossible.

What I did:

r' '=G*M/r^2
Multiply each side by r'.

r' '*r'=G*M/r^2*r'

next step:
r' ' * r'=0.5 d/dt(r' * r')
r' /r^2=d/dt (1/r)

so:
0.5 d/dt (r'*r')=G*M d/dt (1/r)

Integrate both side:

0.5 (r')^2=G*M/r+C
(r')^2=2*G*M/r+2*C

I have missed the 0.5 in the first post. Sorry for that.
It is much simpler to check to force frequently, thus I get a constant
acceleration at the given time.

a=F/m
v=a*dt+v0
r=0.5*a*dt+v0*dt+r0

However, this is far from perfect simulation.

Quote:
 This isn't homework, by the way, is it?

No.

Thanks:
Lutyo

##### Share on other sites
biscuitz    127
What are you trying to do? It looks like something I'm trying to do except you're working with gravity. It looks like you're trying to calculate velocity...

Quote:
 m*a=G*m*M/(r^2)a(t)=G*M/(r(t)^2)

Where did the t come from?

##### Share on other sites
llutyo    122
Quote:
 What are you trying to do? It looks like something I'm trying to do except you're working with gravity. It looks like you're trying to calculate velocity...

No, I want to get displacement function(r(t)) in an explict form. Of course, it is easy to get the velocity, and the acceleration, from the displacement function (differentiation with respect to t) and vica versa.

What I want to actually do is to simulate sattelites orbiting around a planet.

Quote:
 Where did the t come from?

Actually t is always there, because, acceleration, velocity, and displacement functions' argument is t (time).

And what would you like to do? Maybe I can help.

Lutyo

##### Share on other sites
TGA    134
So you want to find the position of an object under gravity at an arbitary point in time?

http://en.wikipedia.org/wiki/Kepler%27s_Laws_of_Planetary_Motion#Position_as_a_function_of_time

##### Share on other sites
biscuitz    127
I'm trying to simulate the velocity of an object with respect to time t (calculate velocity at any point in time, which I can't figure out with drag effecting it). In other words I'm trying to simulate the movement of an object including air resistance/drag.

##### Share on other sites
Zipster    2365
Usually when dealing with a central force problem you don't see r(t), but rather t(r), which is equation (5.3.3) here. You then have to invert that rather nasty integral to get r(t). I personally haven't seen it down before, and I find it a bit ominous that neither this site nor my classical dynamics textbook actually perform the inversion to get r(t)...

##### Share on other sites
descendency    124
Wow. Let me do you a favor.

d^2/dt^2 is NOT (d/dt)^2.

That is a notation error. The 'square' is just a notation for a second derivative. It can NOT be factored out. It is nothing more than a symbol.

it literally means d/dt(d/dt(r(t))). This integration requires two integrals. However, (From my knowledge of mathematics and physics - quite a bit) You will need to know more than just Newton's Law of Gravity.

This is where my physics gets a bit rusty. I do know how to trace a path if given the information about the ellipse, however, this is basic geometry. If you want to assume your satellite travels in a circle, then you can apply the rules for centripetal acceleration and use an arbitrary radius or you can define an ellipse and calculate the acceleration due to gravity at a point on that ellipse, but you can NOT find a general equation for motion due to gravity without at least some basic information about the curve.

I think (I could be forgetting something) you need to know at least a point in space of where your satellite is, it's velocity, and it's acceleration at that point at very minimum to determine it's motion. Then you use a basic equation for kinematics.

However, the bigger issue in my opinion is your lack of knowledge of calculus. Find a better teacher if you can. If you are trying to learn on your own, cool. Derivatives are functions like the sine function or like the 'f' function. They can be multiplied like any other function. Like [d/dx(f(x))][d/dx(g(x))] and [d/dx(f(x))][d/dx(f(x))] but the second is NOT f''(x). d/dx(d/dx(f(x))) is a second derivative.

##### Share on other sites
descendency    124
Also, there is an equation for the acceleration of arbitrary motion introduced in 3rd semester calculus.

It uses the sum of tangential acceleration and normal (centripetal) acceleration.

##### Share on other sites
llutyo    122
descendency:

Quote:
 Wow. Let me do you a favor.d^2/dt^2 is NOT (d/dt)^2.

True, but I did not do that. [lol] Read my 2nd post, I tried to explain step by step what I did. The result is correct:

((d/dt)r(t))^2=2*G*M/r(t)+C

Quote:
 ...you can NOT find a general equation for motion due to gravity without at least some basic information about the curve.

Also true, that is why, the constant c appeared. You can define c by initial conditions.

##### Share on other sites
Raghar    96
And what you are trying to do? A simple integration of orbit around the planet, or something that takes more factors. For example if you would need an orbit around earth, you would need to calculate.
acceleration caused by earth.
acceleration caused by gravity field of moon.
Sun inhomogeneous gravity field.
Solar wind.
Sagnac gravity effect.
Pressure of photons.
Air pressure at that altitude.

If you need just a simple approximation for massless object on an orbit around a homogeneous perfect sphere. You can just define a simple variable, initial position at closest distance to the planet and then approximate the curve to reasonable accuracy.

this is a Literka page.

And here you might look for the required anomaly. Thought for many systems it's easier to count positions by.
va = previous va + sum of accelerations
position = previousPosition + va

Then record positions into an array, and use them. If you clamp each computed position so an energy would be preserved, even better.

If you would like to compute the curve yourself, as an exercise. It might be easier to use energy preservation as helper function.

BTW look at burtleburtle site.