kill(all)$
load(lrats)$

Lagrangian and two mass problem ( = orbit diff eq), version 1.0.
peter.vlasschaert@gmail.com,08/08/2018.

see : transformation of two massproblem : total energy,version 1.0
========================================================
get : T,V, μ.

E = T + V : Total Energy  .
L = T -  V :  Lagrangian    .

p1:T=((r^2*('diff(θ,t,1))^2+('diff(r,t,1))^2)*μ)/2;
p2:V=-G*(m[1]*m[2])/r;

 definition :μ ,'reduced mass'
=========================

see : Transformation of two mass( diff eq.),version 1.0 from 'p21a'
---------------------------------------------------------------------------------------------------

p3:μ=(m[1]*m[2])/(m[2]+m[1]);

assume(r>0,μ>0);

definition: L
==========

p4:L=T-V;

p5:lhs(p4) = subst([T=rhs(p1),V=rhs(p2)],rhs(p4));

p6:['diff(θ,t,1)=θt,'diff(θ,t,2)=θtt, 'diff(r,t,1)=rt,'diff(r,t,2)=rtt];

p6a:p6[1];

p6b:p6[3];

p6c:p6[4];

p7:subst(p6,p5);

Lagrangian : equation.
===================

p8:'diff(L,q)$
p8a:'diff(L,qt)$
p8b:'diff(p8a,t)-p8 =0;

q = θ  =>  qt = θt    : into 'p8b'
=======================

p9:subst([q=θ],p8) = ev(subst([q=θ,p7],p8),diff);

p9a:subst([qt=θt],p8a) = subst([qt=θt,p7],p8a);

p9b:lhs(p9a) = ev(rhs(p9a),diff);

rem : θ, equations (p8b)
====================

p9c:subst([q=θ ,qt=θt],(p8b) );

insert : value  'p9'

p9d:subst([p9],p9c);

from , 'p9b' and 'p9d' ,  follows 'p9b' =constant = l

definition l: ' constant for orbit '.
=========

p10:l  = subst([rhs(p6a)=lhs(p6a)],rhs(p9b));

rem :('diff(θ,t,1)) = ω,ω*r = v,l =r*v*μ
-------------------------------------------------------

rem : r, equations(p8b)
===================

p11:subst([q=r],p8) = subst([q=r,p7],p8);

p11a:lhs(p11)=ev(rhs(p11),diff);

p11a1:lhs(p11a) =subst([rhs(p6a)=lhs(p6a)],rhs(p11a));

p11b:subst([qt=rt],p8a) = subst([qt=rt,p7],p8a);

p11c:lhs(p11b) = ev(rhs(p11b),diff);

p11d:lhs(p11c) = subst([rhs(p6b)=lhs(p6b)],rhs(p11c));

p11e:'diff(lhs(p11d),t) =subst([rt=rtt],rhs(p11c));

p11f:lhs(p11e)=subst([rhs(p6c)=lhs(p6c)],rhs(p11e));

p11g :subst([q=r ,qt=rt],(p8b) );

p11h:subst([p11a1,p11f],p11g);

rem :  second law newton  ( = gravitation)
            ==============================
            F = -(m[1]*m[2]*G)/r^2
            ==============================

p11i :(-1)*(m[1]*m[2]*G)/r^2 = F;

p11j:lratsubst([p11i],p11h);

p11k:p11j+F;

F = m*a  =>  F = μ*a , Law from Newton
===========================================
F = force must be so that  the object stays in orbit.
===========================================

Equations of  ( Motion ), for orbit ( = polar equation)
===========================================

p12:p10;
p12a: p11k;
p12b:p3;

rem : orbit differential equations = {p12,p12a,p12b}

---------------------------------------------------------------------------------------------------------------------------------