Hi, i am trying to solve the following differential equations for a satellite travelling from earth to jupiter using a runge kutta algorithm.(adsbygoogle = window.adsbygoogle || []).push({});

The equations are:

dr/dt=+-(h/r)[((r/r0)-1)(1-(r/r1))]^(0.5)

and

dr/d(theta)=+-r[((r/r0)-1)(1-(r/r1))]^(0.5).

where r0 and r1 are the radii of earths and Jupiters orbits respectively.

The problem is when trying to solve with the runge kutta when the initial conditions are set (ie r = r0) the function returns 0 and hence there is nochange in further steps. The equations in polar co ords. and my RK is as follows:

double dr(double r)

{

double h,v0=38534.7, r0=0.1495*(pow(10.0,12)), r1=0.7778*(pow(10.0,12));

h=v0*r0;

return h/pow(r,2);

}

int main()

{

double t=0.0, s=10000,r1,th1,kr1,kr2,kr3,kr4; //Declaration and initiation of vars for use in 4th order runge kutta

int n=0;

while (t<=8000000)

{

t=n*s; //time

cout << t << "\t" << r0 << endl; //output data to terminal and file

outs1 << t << "\t" << r0 << endl;

//Runge Kutta Method

kr1=s*dr(r0);

kr2=s*dr(r0+kr1/2);

kr3=s*dr(r0+kr2/2);

kr4=s*dr(r0+kr3);

r1=r0+(kr1+2*kr2+2*kr3+kr4)/6.0;

r0=r1;

n++;

}

}

I am unsure if i am using the correct equations of motion to solve this and any help would be greatly appreciated

Cheers

Sol

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Satellite Orbit

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**