Classical Kepler Problem (Analytical Solution)

Clear["Global`*"]

<< Graphics`Graphics`

?Graphics`Graphics`*

<< Algebra`Trigonometry`

?Algebra`Trigonometry`*

Potentail is V(r) = - G m1 m2 / r  [ 1 - G (m1+m2)/(2c^2 r)  + O(1/c^4) ]

v[u_] := -k/r + b/r^2 /. r -> 1/u

D[v[u],u]

u''[phi] + u[phi] == - (m/l^2) D[v[u[phi]],u[phi]] ;

Apart[#] & /@ %

eq = % ;

sol = DSolve[ eq, u[phi], phi] ;

u[phi] /. sol[[1]]

% /. Sqrt[-1-(2 b m)/l^2] -> I Sqrt[1+(2 b m)/l^2]

ExpToTrig[%] /.
                 {C[1]->(a+I b)/2,C[2]->(a-I b)/2} //
                 ExpandAll

solex = % ;

?ExpToTrig

k=1; l=1; m=1; b=0.1; n =10 ;

solex /. {a->0.4,b->0}

rfun = 1/% ;

Plot[ rfun, {phi, 0, n 2Pi}, PlotRange->{0,3}] ;

PolarPlot[ rfun, {phi,0,n 2Pi},
                  PlotStyle->RGBColor[0.1,0.1,1.0],
                  PlotPoints->100] ;

?PolarPlot