jmtome2
- 67
- 0
Homework Statement
OK so here goes.
I'm using an ODEsolver in java to plot the total energy over time of a planetary system. So I've been trying to calculate the rate of energy (per unit mass), \frac{E}{m}.
Homework Equations
The equation for total energy (per unit mass) of a planetary system is:
\frac{E}{m}=1/2\cdot v^2-\frac{G\cdot M}{r}
G is the gravitational constant
M is the mass of the sun (constant)
v is the velocity of the planet, v^2=v^{2}_{x}+v^{2}_{y}
r is the distance of the planet from the sun, r^2=x^{2}+y^{2}
Essentially I need help finding \frac{dE}{dt}
The Attempt at a Solution
The answer I got for the rate is:
\frac{dE}{dt}=v\cdot\left(a+\frac{G\cdot M}{r}\right)
where a is the acceleration of the planet, a^2=a^{2}_{x}+a^{2}_{y}
The problem is that everytime I throw this equation into the ODEsolver, I get a plot of ever-increasing energy as time goes on which I know is not correct.
Help anybody?