CoCalc Public FilesTwo Equations of Lagrange.sagews
Author: Bill Page
Views : 61
Description: The two equations are not independent.
Compute Environment: Ubuntu 18.04 (Deprecated)

Two Equations of Lagrange in Terms of Differential Forms

We show that the "two equations of Lagrange" given by Oziewicz and Ramirez are not independent. The second equation is exactly $v$ times the first equation.

%typeset_mode True


Consider vectors and forms on a 6-dimensional manifold

M = Manifold(5,'M')
coord.<t, x, v, a, s> = M.chart()
f = M.scalar_field(function('f')(*list(coord)))
basis = coord.frame()
[Dt,Dx,Dv,Da,Ds] = [basis[i] for i in range(M.dim())]
cobasis=coord.coframe()
[dt,dx,dv,da,ds] = [cobasis[i] for i in range(M.dim())]
#d=xder
from sage.manifolds.utilities import exterior_derivative as d
def ev(N): return (lambda x: N.contract(x))


For the most general Lagrangian

L = M.scalar_field(function('L')(*list(coord))); L.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & L\left(t, x, v, a, s\right) \end{array}$
%md
f is a dependent variable


f is a dependent variable

f = M.scalar_field(var('f'))

%md
Kinematics


Kinematics

N = Dt + v*Dx + a*Dv + s*Da + f*Ds; N.display()

$\displaystyle \frac{\partial}{\partial t } + v \frac{\partial}{\partial x } + a \frac{\partial}{\partial v } + s \frac{\partial}{\partial a } + f \frac{\partial}{\partial s }$
N(M.scalar_field(t))==1
N(M.scalar_field(x))==v
N(M.scalar_field(v))==a
N(M.scalar_field(a))==s
N(M.scalar_field(s))==f

$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$

Define auxillary fields

r=Ds(L); r.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & \frac{\partial\,L}{\partial s} \end{array}$
q=Da(L)-N(r); q.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & -v \frac{\partial^2\,L}{\partial x\partial s} - a \frac{\partial^2\,L}{\partial v\partial s} - s \frac{\partial^2\,L}{\partial a\partial s} - f \frac{\partial^2\,L}{\partial s ^ 2} - \frac{\partial^2\,L}{\partial t\partial s} + \frac{\partial\,L}{\partial a} \end{array}$
p=Dv(L)-N(q); p.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & v^{2} \frac{\partial^3\,L}{\partial x ^ 2\partial s} + a^{2} \frac{\partial^3\,L}{\partial v ^ 2\partial s} + 2 \, a s \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, a f \frac{\partial^3\,L}{\partial v\partial s ^ 2} + s^{2} \frac{\partial^3\,L}{\partial a ^ 2\partial s} + 2 \, f s \frac{\partial^3\,L}{\partial a\partial s ^ 2} + f^{2} \frac{\partial^3\,L}{\partial s ^ 3} + {\left(2 \, a \frac{\partial^3\,L}{\partial x\partial v\partial s} + 2 \, s \frac{\partial^3\,L}{\partial x\partial a\partial s} + 2 \, f \frac{\partial^3\,L}{\partial x\partial s ^ 2} + 2 \, \frac{\partial^3\,L}{\partial t\partial x\partial s} - \frac{\partial^2\,L}{\partial x\partial a}\right)} v + 2 \, a \frac{\partial^3\,L}{\partial t\partial v\partial s} + 2 \, s \frac{\partial^3\,L}{\partial t\partial a\partial s} + 2 \, f \frac{\partial^3\,L}{\partial t\partial s ^ 2} + a \frac{\partial^2\,L}{\partial x\partial s} - a \frac{\partial^2\,L}{\partial v\partial a} + s \frac{\partial^2\,L}{\partial v\partial s} - s \frac{\partial^2\,L}{\partial a ^ 2} + \frac{\partial^3\,L}{\partial t ^ 2\partial s} - \frac{\partial^2\,L}{\partial t\partial a} + \frac{\partial\,L}{\partial v} \end{array}$

First Equation

(N(p)-Dx(L)).display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & v^{3} \frac{\partial^4\,L}{\partial x ^ 3\partial s} + a^{3} \frac{\partial^4\,L}{\partial v ^ 3\partial s} + 3 \, a^{2} s \frac{\partial^4\,L}{\partial v ^ 2\partial a\partial s} + 3 \, a^{2} f \frac{\partial^4\,L}{\partial v ^ 2\partial s ^ 2} + 3 \, a s^{2} \frac{\partial^4\,L}{\partial v\partial a ^ 2\partial s} + 6 \, a f s \frac{\partial^4\,L}{\partial v\partial a\partial s ^ 2} + 3 \, a f^{2} \frac{\partial^4\,L}{\partial v\partial s ^ 3} + s^{3} \frac{\partial^4\,L}{\partial a ^ 3\partial s} + 3 \, f s^{2} \frac{\partial^4\,L}{\partial a ^ 2\partial s ^ 2} + 3 \, f^{2} s \frac{\partial^4\,L}{\partial a\partial s ^ 3} + f^{3} \frac{\partial^4\,L}{\partial s ^ 4} + {\left(3 \, a \frac{\partial^4\,L}{\partial x ^ 2\partial v\partial s} + 3 \, s \frac{\partial^4\,L}{\partial x ^ 2\partial a\partial s} + 3 \, f \frac{\partial^4\,L}{\partial x ^ 2\partial s ^ 2} + 3 \, \frac{\partial^4\,L}{\partial t\partial x ^ 2\partial s} - \frac{\partial^3\,L}{\partial x ^ 2\partial a}\right)} v^{2} + 3 \, a^{2} \frac{\partial^4\,L}{\partial t\partial v ^ 2\partial s} + 6 \, a s \frac{\partial^4\,L}{\partial t\partial v\partial a\partial s} + 6 \, a f \frac{\partial^4\,L}{\partial t\partial v\partial s ^ 2} + 3 \, s^{2} \frac{\partial^4\,L}{\partial t\partial a ^ 2\partial s} + 6 \, f s \frac{\partial^4\,L}{\partial t\partial a\partial s ^ 2} + 3 \, f^{2} \frac{\partial^4\,L}{\partial t\partial s ^ 3} + 3 \, a^{2} \frac{\partial^3\,L}{\partial x\partial v\partial s} + 3 \, a s \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, a f \frac{\partial^3\,L}{\partial x\partial s ^ 2} - a^{2} \frac{\partial^3\,L}{\partial v ^ 2\partial a} + 3 \, a s \frac{\partial^3\,L}{\partial v ^ 2\partial s} - 2 \, a s \frac{\partial^3\,L}{\partial v\partial a ^ 2} + 3 \, f s \frac{\partial^3\,L}{\partial v\partial s ^ 2} - s^{2} \frac{\partial^3\,L}{\partial a ^ 3} + f s \frac{\partial^3\,L}{\partial a ^ 2\partial s} + 2 \, f^{2} \frac{\partial^3\,L}{\partial a\partial s ^ 2} + {\left(3 \, a^{2} \frac{\partial^4\,L}{\partial x\partial v ^ 2\partial s} + 6 \, a s \frac{\partial^4\,L}{\partial x\partial v\partial a\partial s} + 6 \, a f \frac{\partial^4\,L}{\partial x\partial v\partial s ^ 2} + 3 \, s^{2} \frac{\partial^4\,L}{\partial x\partial a ^ 2\partial s} + 6 \, f s \frac{\partial^4\,L}{\partial x\partial a\partial s ^ 2} + 3 \, f^{2} \frac{\partial^4\,L}{\partial x\partial s ^ 3} + 6 \, a \frac{\partial^4\,L}{\partial t\partial x\partial v\partial s} + 6 \, s \frac{\partial^4\,L}{\partial t\partial x\partial a\partial s} + 6 \, f \frac{\partial^4\,L}{\partial t\partial x\partial s ^ 2} + 3 \, a \frac{\partial^3\,L}{\partial x ^ 2\partial s} - 2 \, a \frac{\partial^3\,L}{\partial x\partial v\partial a} + 3 \, s \frac{\partial^3\,L}{\partial x\partial v\partial s} - 2 \, s \frac{\partial^3\,L}{\partial x\partial a ^ 2} + f \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, \frac{\partial^4\,L}{\partial t ^ 2\partial x\partial s} - 2 \, \frac{\partial^3\,L}{\partial t\partial x\partial a} + \frac{\partial^2\,L}{\partial x\partial v}\right)} v + 3 \, a \frac{\partial^4\,L}{\partial t ^ 2\partial v\partial s} + 3 \, s \frac{\partial^4\,L}{\partial t ^ 2\partial a\partial s} + 3 \, f \frac{\partial^4\,L}{\partial t ^ 2\partial s ^ 2} + 3 \, a \frac{\partial^3\,L}{\partial t\partial x\partial s} - 2 \, a \frac{\partial^3\,L}{\partial t\partial v\partial a} + 3 \, s \frac{\partial^3\,L}{\partial t\partial v\partial s} - 2 \, s \frac{\partial^3\,L}{\partial t\partial a ^ 2} + f \frac{\partial^3\,L}{\partial t\partial a\partial s} - a \frac{\partial^2\,L}{\partial x\partial a} + s \frac{\partial^2\,L}{\partial x\partial s} + a \frac{\partial^2\,L}{\partial v ^ 2} + {\left(a f + 3 \, s^{2}\right)} \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, f \frac{\partial^2\,L}{\partial v\partial s} - f \frac{\partial^2\,L}{\partial a ^ 2} + \frac{\partial^4\,L}{\partial t ^ 3\partial s} - \frac{\partial^3\,L}{\partial t ^ 2\partial a} + \frac{\partial^2\,L}{\partial t\partial v} - \frac{\partial\,L}{\partial x} \end{array}$

Second Equation

(Dt(L)-(N(L)-(p*a+q*s+r*f)-(v*N(p)+a*N(q)+s*N(r)))).display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & v^{4} \frac{\partial^4\,L}{\partial x ^ 3\partial s} + {\left(3 \, a \frac{\partial^4\,L}{\partial x ^ 2\partial v\partial s} + 3 \, s \frac{\partial^4\,L}{\partial x ^ 2\partial a\partial s} + 3 \, f \frac{\partial^4\,L}{\partial x ^ 2\partial s ^ 2} + 3 \, \frac{\partial^4\,L}{\partial t\partial x ^ 2\partial s} - \frac{\partial^3\,L}{\partial x ^ 2\partial a}\right)} v^{3} + {\left(3 \, a^{2} \frac{\partial^4\,L}{\partial x\partial v ^ 2\partial s} + 6 \, a s \frac{\partial^4\,L}{\partial x\partial v\partial a\partial s} + 6 \, a f \frac{\partial^4\,L}{\partial x\partial v\partial s ^ 2} + 3 \, s^{2} \frac{\partial^4\,L}{\partial x\partial a ^ 2\partial s} + 6 \, f s \frac{\partial^4\,L}{\partial x\partial a\partial s ^ 2} + 3 \, f^{2} \frac{\partial^4\,L}{\partial x\partial s ^ 3} + 6 \, a \frac{\partial^4\,L}{\partial t\partial x\partial v\partial s} + 6 \, s \frac{\partial^4\,L}{\partial t\partial x\partial a\partial s} + 6 \, f \frac{\partial^4\,L}{\partial t\partial x\partial s ^ 2} + 3 \, a \frac{\partial^3\,L}{\partial x ^ 2\partial s} - 2 \, a \frac{\partial^3\,L}{\partial x\partial v\partial a} + 3 \, s \frac{\partial^3\,L}{\partial x\partial v\partial s} - 2 \, s \frac{\partial^3\,L}{\partial x\partial a ^ 2} + f \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, \frac{\partial^4\,L}{\partial t ^ 2\partial x\partial s} - 2 \, \frac{\partial^3\,L}{\partial t\partial x\partial a} + \frac{\partial^2\,L}{\partial x\partial v}\right)} v^{2} + {\left(a^{3} \frac{\partial^4\,L}{\partial v ^ 3\partial s} + 3 \, a^{2} s \frac{\partial^4\,L}{\partial v ^ 2\partial a\partial s} + 3 \, a^{2} f \frac{\partial^4\,L}{\partial v ^ 2\partial s ^ 2} + 3 \, a s^{2} \frac{\partial^4\,L}{\partial v\partial a ^ 2\partial s} + 6 \, a f s \frac{\partial^4\,L}{\partial v\partial a\partial s ^ 2} + 3 \, a f^{2} \frac{\partial^4\,L}{\partial v\partial s ^ 3} + s^{3} \frac{\partial^4\,L}{\partial a ^ 3\partial s} + 3 \, f s^{2} \frac{\partial^4\,L}{\partial a ^ 2\partial s ^ 2} + 3 \, f^{2} s \frac{\partial^4\,L}{\partial a\partial s ^ 3} + f^{3} \frac{\partial^4\,L}{\partial s ^ 4} + 3 \, a^{2} \frac{\partial^4\,L}{\partial t\partial v ^ 2\partial s} + 6 \, a s \frac{\partial^4\,L}{\partial t\partial v\partial a\partial s} + 6 \, a f \frac{\partial^4\,L}{\partial t\partial v\partial s ^ 2} + 3 \, s^{2} \frac{\partial^4\,L}{\partial t\partial a ^ 2\partial s} + 6 \, f s \frac{\partial^4\,L}{\partial t\partial a\partial s ^ 2} + 3 \, f^{2} \frac{\partial^4\,L}{\partial t\partial s ^ 3} + 3 \, a^{2} \frac{\partial^3\,L}{\partial x\partial v\partial s} + 3 \, a s \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, a f \frac{\partial^3\,L}{\partial x\partial s ^ 2} - a^{2} \frac{\partial^3\,L}{\partial v ^ 2\partial a} + 3 \, a s \frac{\partial^3\,L}{\partial v ^ 2\partial s} - 2 \, a s \frac{\partial^3\,L}{\partial v\partial a ^ 2} + 3 \, f s \frac{\partial^3\,L}{\partial v\partial s ^ 2} - s^{2} \frac{\partial^3\,L}{\partial a ^ 3} + f s \frac{\partial^3\,L}{\partial a ^ 2\partial s} + 2 \, f^{2} \frac{\partial^3\,L}{\partial a\partial s ^ 2} + 3 \, a \frac{\partial^4\,L}{\partial t ^ 2\partial v\partial s} + 3 \, s \frac{\partial^4\,L}{\partial t ^ 2\partial a\partial s} + 3 \, f \frac{\partial^4\,L}{\partial t ^ 2\partial s ^ 2} + 3 \, a \frac{\partial^3\,L}{\partial t\partial x\partial s} - 2 \, a \frac{\partial^3\,L}{\partial t\partial v\partial a} + 3 \, s \frac{\partial^3\,L}{\partial t\partial v\partial s} - 2 \, s \frac{\partial^3\,L}{\partial t\partial a ^ 2} + f \frac{\partial^3\,L}{\partial t\partial a\partial s} - a \frac{\partial^2\,L}{\partial x\partial a} + s \frac{\partial^2\,L}{\partial x\partial s} + a \frac{\partial^2\,L}{\partial v ^ 2} + {\left(a f + 3 \, s^{2}\right)} \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, f \frac{\partial^2\,L}{\partial v\partial s} - f \frac{\partial^2\,L}{\partial a ^ 2} + \frac{\partial^4\,L}{\partial t ^ 3\partial s} - \frac{\partial^3\,L}{\partial t ^ 2\partial a} + \frac{\partial^2\,L}{\partial t\partial v} - \frac{\partial\,L}{\partial x}\right)} v \end{array}$

Multiplying by $v$

v*(N(p)-Dx(L)) == (Dt(L)-(N(L)-(p*a+q*s+r*f)-(v*N(p)+a*N(q)+s*N(r))))

$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$
%md
## Checking the calculations from the paper ##


Checking the calculations from the paper

L = M.scalar_field(function('L')(*list(coord)))
p = M.scalar_field(function('p')(*list(coord)))
q = M.scalar_field(function('q')(*list(coord)))
r = M.scalar_field(function('r')(*list(coord)))
t=M.scalar_field(t)
x=M.scalar_field(x)
v=M.scalar_field(v)
a=M.scalar_field(a)
s=M.scalar_field(s)


Action differential Form

alpha = L*dt + p*(dx-v*dt) + q*(dv-a*dt) + r*(da-s*dt)
alpha.display()

$\displaystyle \left( -v p\left(t, x, v, a, s\right) - a q\left(t, x, v, a, s\right) - s r\left(t, x, v, a, s\right) + L\left(t, x, v, a, s\right) \right) \mathrm{d} t + p\left(t, x, v, a, s\right) \mathrm{d} x + q\left(t, x, v, a, s\right) \mathrm{d} v + r\left(t, x, v, a, s\right) \mathrm{d} a$
alpha == L*dt+p*dx+q*dv+r*da-(p*v+q*a+r*s)*dt

$\displaystyle \mathrm{True}$
d(alpha).display()

$\displaystyle \left( v \frac{\partial\,p}{\partial x} + a \frac{\partial\,q}{\partial x} + s \frac{\partial\,r}{\partial x} - \frac{\partial\,L}{\partial x} + \frac{\partial\,p}{\partial t} \right) \mathrm{d} t\wedge \mathrm{d} x + \left( v \frac{\partial\,p}{\partial v} + a \frac{\partial\,q}{\partial v} + s \frac{\partial\,r}{\partial v} + p\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial v} + \frac{\partial\,q}{\partial t} \right) \mathrm{d} t\wedge \mathrm{d} v + \left( v \frac{\partial\,p}{\partial a} + a \frac{\partial\,q}{\partial a} + s \frac{\partial\,r}{\partial a} + q\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial a} + \frac{\partial\,r}{\partial t} \right) \mathrm{d} t\wedge \mathrm{d} a + \left( v \frac{\partial\,p}{\partial s} + a \frac{\partial\,q}{\partial s} + s \frac{\partial\,r}{\partial s} + r\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial s} \right) \mathrm{d} t\wedge \mathrm{d} s + \left( -\frac{\partial\,p}{\partial v} + \frac{\partial\,q}{\partial x} \right) \mathrm{d} x\wedge \mathrm{d} v + \left( -\frac{\partial\,p}{\partial a} + \frac{\partial\,r}{\partial x} \right) \mathrm{d} x\wedge \mathrm{d} a -\frac{\partial\,p}{\partial s} \mathrm{d} x\wedge \mathrm{d} s + \left( -\frac{\partial\,q}{\partial a} + \frac{\partial\,r}{\partial v} \right) \mathrm{d} v\wedge \mathrm{d} a -\frac{\partial\,q}{\partial s} \mathrm{d} v\wedge \mathrm{d} s -\frac{\partial\,r}{\partial s} \mathrm{d} a\wedge \mathrm{d} s$
d(alpha) == d(L).wedge(dt) + d(p).wedge(dx) + d(q).wedge(dv) + d(r).wedge(da) - d(p*v + q*a + r*s).wedge(dt)

$\displaystyle \mathrm{True}$
ev(alpha)(N)==L

$\displaystyle \mathrm{True}$
Omega = -(p*dx+q*dv+r*da).wedge(d(t)); Omega.display()

$\displaystyle p\left(t, x, v, a, s\right) \mathrm{d} t\wedge \mathrm{d} x + q\left(t, x, v, a, s\right) \mathrm{d} t\wedge \mathrm{d} v + r\left(t, x, v, a, s\right) \mathrm{d} t\wedge \mathrm{d} a$
alpha == L*dt + ev(N)(Omega)

$\displaystyle \mathrm{True}$
%md
Equation of Motion ($E=0$)


Equation of Motion ($E=0$)

E = ev(N)(d(alpha))
E.display()

$\displaystyle \left( -v^{2} \frac{\partial\,p}{\partial x} - a^{2} \frac{\partial\,q}{\partial v} - a s \frac{\partial\,q}{\partial a} - a f \frac{\partial\,q}{\partial s} - a s \frac{\partial\,r}{\partial v} - s^{2} \frac{\partial\,r}{\partial a} - f s \frac{\partial\,r}{\partial s} - {\left(a \frac{\partial\,p}{\partial v} + s \frac{\partial\,p}{\partial a} + f \frac{\partial\,p}{\partial s} + a \frac{\partial\,q}{\partial x} + s \frac{\partial\,r}{\partial x} - \frac{\partial\,L}{\partial x} + \frac{\partial\,p}{\partial t}\right)} v - a p\left(t, x, v, a, s\right) - s q\left(t, x, v, a, s\right) - f r\left(t, x, v, a, s\right) + a \frac{\partial\,L}{\partial v} + s \frac{\partial\,L}{\partial a} + f \frac{\partial\,L}{\partial s} - a \frac{\partial\,q}{\partial t} - s \frac{\partial\,r}{\partial t} \right) \mathrm{d} t + \left( v \frac{\partial\,p}{\partial x} + a \frac{\partial\,p}{\partial v} + s \frac{\partial\,p}{\partial a} + f \frac{\partial\,p}{\partial s} - \frac{\partial\,L}{\partial x} + \frac{\partial\,p}{\partial t} \right) \mathrm{d} x + \left( v \frac{\partial\,q}{\partial x} + a \frac{\partial\,q}{\partial v} + s \frac{\partial\,q}{\partial a} + f \frac{\partial\,q}{\partial s} + p\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial v} + \frac{\partial\,q}{\partial t} \right) \mathrm{d} v + \left( v \frac{\partial\,r}{\partial x} + a \frac{\partial\,r}{\partial v} + s \frac{\partial\,r}{\partial a} + f \frac{\partial\,r}{\partial s} + q\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial a} + \frac{\partial\,r}{\partial t} \right) \mathrm{d} a + \left( r\left(t, x, v, a, s\right) - \frac{\partial\,L}{\partial s} \right) \mathrm{d} s$

Rewriting it in various ways.

E == N(L)*dt - N(t) * d(L) + N(p)*dx - N(x)*d(p) + N(q)*dv - N(v)*d(q) + N(r)*da - N(a)*d(r) - N(p*v+q*a+r*s)*dt + N(t)*d(p*v+q*a+r*s)

$\displaystyle \mathrm{True}$
E == N(L)*dt - d(L) + N(p)*dx - v*d(p) + N(q)*dv - a*d(q) + N(r)*da - s*d(r) - N(p*v+q*a+r*s)*dt + d(p*v+q*a+r*s)

$\displaystyle \mathrm{True}$
E == N(L-p*v-q*a-r*s)*dt - d(L - p*v - q*a- r*s) - v*d(p) - a*d(q) - s*d(r) + N(p)*dx + N(q)*dv + N(r)*da

$\displaystyle \mathrm{True}$
d(p*v) == v*d(p) + p*d(v)

$\displaystyle \mathrm{True}$
d(q*a) == a*d(q) + q*d(a)

$\displaystyle \mathrm{True}$
d(r*s) == s*d(r) + r*d(s)

$\displaystyle \mathrm{True}$
E == N(L - p*v - q*a - r*s)*dt - d(L) + p*dv + q*da + r*ds + N(p)*dx + N(q)*dv + N(r)*da

$\displaystyle \mathrm{True}$
$\displaystyle \mathrm{True}$
N(p*v) == p*N(v) + v*N(p)

$\displaystyle \mathrm{True}$
E == N(L)*dt - (p*a+q*s+r*f)*dt -(v*N(p) + a*N(q) + s*N(r) )*dt - d(L) + p*dv + q*da + r*ds + N(p)*dx + N(q)*dv + N(r)*da

$\displaystyle \mathrm{True}$
E == ( N(L) - (p*a + q*s + r*f) - (v*N(p) + a*N(q) + s*N(r)))*dt + N(p)*dx + (N(q)+p)*dv + (N(r)+q)*da + r*ds - d(L)

$\displaystyle \mathrm{True}$
d(L) == Dt(L)*dt + Dx(L)*dx + Dv(L)*dv + Da(L)*da + Ds(L)*ds

$\displaystyle \mathrm{True}$
r=Ds(L); r.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & \frac{\partial\,L}{\partial s} \end{array}$
q=Da(L)-N(r); q.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & -v \frac{\partial^2\,L}{\partial x\partial s} - a \frac{\partial^2\,L}{\partial v\partial s} - s \frac{\partial^2\,L}{\partial a\partial s} - f \frac{\partial^2\,L}{\partial s ^ 2} - \frac{\partial^2\,L}{\partial t\partial s} + \frac{\partial\,L}{\partial a} \end{array}$
p=Dv(L)-N(q); p.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & v^{2} \frac{\partial^3\,L}{\partial x ^ 2\partial s} + a^{2} \frac{\partial^3\,L}{\partial v ^ 2\partial s} + 2 \, a s \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, a f \frac{\partial^3\,L}{\partial v\partial s ^ 2} + s^{2} \frac{\partial^3\,L}{\partial a ^ 2\partial s} + 2 \, f s \frac{\partial^3\,L}{\partial a\partial s ^ 2} + f^{2} \frac{\partial^3\,L}{\partial s ^ 3} + {\left(2 \, a \frac{\partial^3\,L}{\partial x\partial v\partial s} + 2 \, s \frac{\partial^3\,L}{\partial x\partial a\partial s} + 2 \, f \frac{\partial^3\,L}{\partial x\partial s ^ 2} + 2 \, \frac{\partial^3\,L}{\partial t\partial x\partial s} - \frac{\partial^2\,L}{\partial x\partial a}\right)} v + 2 \, a \frac{\partial^3\,L}{\partial t\partial v\partial s} + 2 \, s \frac{\partial^3\,L}{\partial t\partial a\partial s} + 2 \, f \frac{\partial^3\,L}{\partial t\partial s ^ 2} + a \frac{\partial^2\,L}{\partial x\partial s} - a \frac{\partial^2\,L}{\partial v\partial a} + s \frac{\partial^2\,L}{\partial v\partial s} - s \frac{\partial^2\,L}{\partial a ^ 2} + \frac{\partial^3\,L}{\partial t ^ 2\partial s} - \frac{\partial^2\,L}{\partial t\partial a} + \frac{\partial\,L}{\partial v} \end{array}$
%md
## For example: the Schiff and Poirier Lagrangian ##


For example: the Schiff and Poirier Lagrangian

hbar = var('hbar',latex_name='\hbar')
m = var('m')
V = M.scalar_field(function('V')(var('x')))
L = 1/2*m*v^2  - V - hbar^2/4/m*(s/v^3-5/2*a^2/v^4); L.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & \frac{4 \, m^{2} v^{6} - 8 \, m v^{4} V\left(x\right) + 5 \, a^{2} {{\hbar}}^{2} - 2 \, {{\hbar}}^{2} s v}{8 \, m v^{4}} \end{array}$
r=Ds(L); r.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & -\frac{{{\hbar}}^{2}}{4 \, m v^{3}} \end{array}$
q=Da(L)-N(r); q.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & \frac{a {{\hbar}}^{2}}{2 \, m v^{4}} \end{array}$
p=Dv(L)-N(q); p.display()

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & \frac{4 \, m^{2} v^{6} - 2 \, a^{2} {{\hbar}}^{2} + {{\hbar}}^{2} s v}{4 \, m v^{5}} \end{array}$

First Equation

(N(p)-Dx(L)).expr().expand()

$\displaystyle a m + \frac{5 \, a^{3} {{\hbar}}^{2}}{2 \, m v^{6}} - \frac{2 \, a {{\hbar}}^{2} s}{m v^{5}} + \frac{f {{\hbar}}^{2}}{4 \, m v^{4}} + \frac{\partial}{\partial x}V\left(x\right)$

Second Equation

(Dt(L)-(N(L)-(p*a+q*s+r*f)-(v*N(p)+a*N(q)+s*N(r)))).expr().expand()

$\displaystyle a m v + v \frac{\partial}{\partial x}V\left(x\right) + \frac{5 \, a^{3} {{\hbar}}^{2}}{2 \, m v^{5}} - \frac{2 \, a {{\hbar}}^{2} s}{m v^{4}} + \frac{f {{\hbar}}^{2}}{4 \, m v^{3}}$