scienalc
- 16
- 0
Homework Statement
I need to develop a macroscopic gravity simulation software. I have problems with representing vectors in a programming language (c++), because I need do develop my own mathematical infrastructure for the project. I asked for the Cartesian coordinates, but would also have no objections to a polar system.
Also I would like to collect some opinion on the correctness of my equations.
Homework Equations
Law of Gravity : Fg = Gm1m2r-2
Newtons second Law : F = ma
The Attempt at a Solution
First, I tried to determine the velocity of the first object (m1):
F = ma = m[itex]\frac{dv}{dt}[/itex] (1)
Gm1m2r-2 = m1[itex]\frac{dv}{dt}[/itex] (2)
v = ∫Gm2r-2dt | integrated from 0 to t (3)
v(t) = Gm2r-2t (4)
Next, I tried similarly to get the dependency of the radius vector r on time:
v = [itex]\frac{dr}{dt}[/itex] (5)
dr = Gm2r-2tdt (6)
∫r2dr = ∫Gm2tdt (7)
[itex]\frac{r<sup>3</sup>}{3}[/itex] = Gm2[itex]\frac{t<sup>2</sup>}{2}[/itex] (8)
r(t) = ([itex]\frac{3}{2}[/itex]Gm2t2)[itex]\frac{1}{3}[/itex] (9)
These results (if correct, of course) need to be supported by an infrastructure which will allow me to calculate the forces, distances, accelerations, velocities, ... between a number of objects. To me it seems the most easy way if I could from the above results somehow get rx, ry and using them vx and vy.
I hope I wasn't confusing.
Thanks a lot
Last edited: