kill(all)$
load(lrats)$

Lagrangian and two mass problem( = total energy ) ,version 1.0
peter.vlasschaert@gmail.com,07/08/2018

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

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

rem : R = r = distance

definition :μ
==========
see : Transformation of two mass( diff eq.),from 'p21a'

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

E = total energy = T+ V
===================

p4:E=rhs(p1)+rhs(p2)$
p4a:lhs(E) = subst([R=r],rhs(p4));

assume(r>0,μ>0);

L = lagrangian = T-V
=================

p5:L=T-V$
p5a: lhs(p5) = rhs(p1)-rhs(p2)$
p5b:lhs(p5) = subst([R=r],rhs(p5a));

 =>     L= L(r,'diff(θ,t,1),'diff(r,t,1))

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

p6:'diff(L,q)$
p6a:'diff(L,q[t])$
p6b:'diff(p6a,t)-p6 =0;

q[i] ; q=θ,r ; i=t ; p5b : new notation, L
===============================

p7:['diff(θ,t,1)=θ[t],'diff(r,t,1)=r[t]];

p7a:subst(p7,p5b);

=>   q=θ  ?
=========

p8a:subst([q=θ],p6) =subst([q=θ,p7a],p6);

p8b:lhs(p8a)=ev(rhs(p8a),diff);

p9a:subst([q=θ],p6a) =subst([q=θ,p7a],p6a);

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

definition  :p[θ]   'first integral of the motion'= rhs(p9b)
=============================================

p9b1:p[θ]=rhs(p9b);

p9b2:subst([θ[t]='diff(θ,t)],p9b1);

θ[t]=w1,r[t]=w2, because maxima.
============================

p9c:[θ[t]=w1,r[t]=w2];

p9d:subst(p9c,p9b);

depends([w1,w2],t);

p9e:'diff(lhs(p9b),t)=diff(rhs(p9d),t);
p9f:lhs(p9e) = subst([w1='diff(θ,t)],rhs(p9e));

lagrangian  : θ
===========

p10:p9f-p8b$

p10a:rhs(p10)=0;

?  How to solve 'p10a'
===================

p11:ode2(p10a,θ,t);

p11a:'diff(θ,t) =diff(rhs(p11),t);

rem : %k2 =constant

How get information : p[θ]
======================

combination : 'p11a' and 'p9b2'
-----------------------------------------------

p11b:subst([p11a],p9b2);

from ,'p11b' ,p[θ] = l =constant

definition l : p[θ]
==============

p11c:l = rhs(p9b2);

p11d:ratcoeff(rhs(p11c),'diff(θ,t,1));

p11e:'diff(θ,t,1) =lhs(p11c)/p11d;

total energy :  'use l ' inside .
========================

p12:subst([p11e],p4a);

p12a:expand(p12);

 U(r)  = - (m[1]*m[2]*G)/r   ?  into E ,'above'
==================================

general :total energy :  E = constant.
==================

p13:subst([rhs(p2)=U(r)],p12a);

rem: total energy E: constant ,because  we limited to nondissipative systems.

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