CoCalc Shared FilesHigherOrder.sagews
Authors: Bill Page, Harald Schilly, William A. Stein
Views : 13
Description: lines 72 and 75 have unnecessary horizontal scrollbars

# Higher-Order Equation of Motion

Our goal is to solve the equation of motion for the high-order acceleration $f$, a given higher-order Lagrangian $L$.

Calculations are done using SageManifolds.

%typeset_mode True

from sage.manifolds.utilities import exterior_derivative as d
def ev(N): return (lambda x: N.contract(x))


Variables

M = Manifold(5,'M')
coord.<t, x, v, a, s> = M.chart()


Vectors (partial derivatives)

[Dt,Dx,Dv,Da,Ds] = coord.frame()


Forms

[dt,dx,dv,da,ds] = coord.coframe()


## 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}$

## Kinematics

$f$ is an unknown function that is the analogue of acceleration for a higher-order equation of motion.

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

$\displaystyle \begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & f\left(t, x, v, a, s\right) \end{array}$
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\left(t, x, v, a, s\right) \frac{\partial}{\partial s }$

The Equation of Lagrange can be defined with the aid of the following 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\left(t, x, v, a, s\right) \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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial v\partial s ^ 2} + s^{2} \frac{\partial^3\,L}{\partial a ^ 2\partial s} + 2 \, s f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial a\partial s ^ 2} + f\left(t, x, v, a, s\right)^{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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial x\partial s ^ 2} + \frac{\partial^2\,L}{\partial s ^ 2} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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} + {\left(a \frac{\partial\,f}{\partial v} + s \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + \frac{\partial\,f}{\partial t}\right)} \frac{\partial^2\,L}{\partial s ^ 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}$
eq1 = (N(p)-Dx(L)); eq1.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\left(t, x, v, a, s\right) \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 s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial v\partial a\partial s ^ 2} + 3 \, a f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial v\partial s ^ 3} + s^{3} \frac{\partial^4\,L}{\partial a ^ 3\partial s} + 3 \, s^{2} f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial a ^ 2\partial s ^ 2} + 3 \, s f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial a\partial s ^ 3} + f\left(t, x, v, a, s\right)^{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\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial x ^ 2\partial s ^ 2} + 3 \, \frac{\partial^3\,L}{\partial x\partial s ^ 2} \frac{\partial\,f}{\partial x} + \frac{\partial^2\,L}{\partial s ^ 2} \frac{\partial^2\,f}{\partial x ^ 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\left(t, x, v, a, s\right) \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 \, s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial t\partial a\partial s ^ 2} + 3 \, f\left(t, x, v, a, s\right)^{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\left(t, x, v, a, s\right) \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} - s^{2} \frac{\partial^3\,L}{\partial a ^ 3} + s f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial a ^ 2\partial s} + {\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\left(t, x, v, a, s\right) \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 \, s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial x\partial a\partial s ^ 2} + 3 \, f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial x\partial s ^ 3} + 3 \, a \frac{\partial^3\,L}{\partial v\partial s ^ 2} \frac{\partial\,f}{\partial x} + 3 \, s \frac{\partial^3\,L}{\partial a\partial s ^ 2} \frac{\partial\,f}{\partial x} + 3 \, f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial s ^ 3} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, {\left(a \frac{\partial\,f}{\partial v} + s \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial x\partial s ^ 2} + {\left(2 \, a \frac{\partial^2\,f}{\partial x\partial v} + 2 \, s \frac{\partial^2\,f}{\partial x\partial a} + 2 \, f\left(t, x, v, a, s\right) \frac{\partial^2\,f}{\partial x\partial s} + \frac{\partial\,f}{\partial x} \frac{\partial\,f}{\partial s} + 2 \, \frac{\partial^2\,f}{\partial t\partial x}\right)} \frac{\partial^2\,L}{\partial s ^ 2} + 3 \, \frac{\partial^3\,L}{\partial t\partial s ^ 2} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial t\partial a\partial s} + 3 \, {\left(a \frac{\partial\,f}{\partial v} + s \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial t\partial s ^ 2} - 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(3 \, s^{2} + a f\left(t, x, v, a, s\right)\right)} \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, f\left(t, x, v, a, s\right) \frac{\partial^2\,L}{\partial v\partial s} + 3 \, {\left(a^{2} \frac{\partial\,f}{\partial v} + a s \frac{\partial\,f}{\partial a} + a f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + s f\left(t, x, v, a, s\right) + a \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial v\partial s ^ 2} - f\left(t, x, v, a, s\right) \frac{\partial^2\,L}{\partial a ^ 2} + {\left(3 \, a s \frac{\partial\,f}{\partial v} + 3 \, s^{2} \frac{\partial\,f}{\partial a} + 3 \, s f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + 2 \, f\left(t, x, v, a, s\right)^{2} + 3 \, s \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial a\partial s ^ 2} + {\left(a^{2} \frac{\partial^2\,f}{\partial v ^ 2} + 2 \, a s \frac{\partial^2\,f}{\partial v\partial a} + 2 \, a f\left(t, x, v, a, s\right) \frac{\partial^2\,f}{\partial v\partial s} + s^{2} \frac{\partial^2\,f}{\partial a ^ 2} + 2 \, s f\left(t, x, v, a, s\right) \frac{\partial^2\,f}{\partial a\partial s} + s \frac{\partial\,f}{\partial a} \frac{\partial\,f}{\partial s} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s}^{2} + f\left(t, x, v, a, s\right)^{2} \frac{\partial^2\,f}{\partial s ^ 2} + 2 \, a \frac{\partial^2\,f}{\partial t\partial v} + 2 \, s \frac{\partial^2\,f}{\partial t\partial a} + 2 \, f\left(t, x, v, a, s\right) \frac{\partial^2\,f}{\partial t\partial s} + a \frac{\partial\,f}{\partial x} + {\left(a \frac{\partial\,f}{\partial s} + s\right)} \frac{\partial\,f}{\partial v} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial a} + \frac{\partial\,f}{\partial t} \frac{\partial\,f}{\partial s} + \frac{\partial^2\,f}{\partial t ^ 2}\right)} \frac{\partial^2\,L}{\partial s ^ 2} + 3 \, {\left(a f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial v} + s f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right)^{2} \frac{\partial\,f}{\partial s} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial s ^ 3} + \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}$

Number of terms in this expression:

len(eq1.expr().expand())

$\displaystyle 116$

We want to solve this equation (eq1 = 0) for $f$ in terms of $L$.

The equation can also be written in the following form:

eq2 = N(Dv(L)) - N(N(Da(L))) + N(N(N(Ds(L)))) - Dx(L)

N.display()

$\displaystyle \frac{\partial}{\partial t } + v \frac{\partial}{\partial x } + a \frac{\partial}{\partial v } + s \frac{\partial}{\partial a } + f\left(t, x, v, a, s\right) \frac{\partial}{\partial s }$
eq1 == eq2

$\displaystyle \mathrm{True}$

But we would prefer to write it as a polynomial in $N(N(f))$, $N(f)$, and powers of $f$. If we write $f$ instead of $N(Ds(L))$, $N(Da(L))$ and $N(Dv(L))$ above then we get new coefficients and terms in powers of $f$.

N(N(f)).display()

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

Terms 2$^\textit{nd}$ order in $f$ arise from the Liebniz rule applied to the differential operator $N^2$ on the term $Ds\ f$ in $N(Ds(L))$. For example

t2 = eq1.expr().coefficient(diff(f.expr(),t,t))*diff(f.expr(),t,t); M.scalar_field(t2).display()

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

The necessary coefficient can be read from the above.

c2 = (Ds(Ds(L))*N(N(f))); c2.display()

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

After removing the term $c2$ above, the remaining terms are at most first-order in $f$.

eq1a = eq1-c2; eq1a.display()

$\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\left(t, x, v, a, s\right) \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 s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial v\partial a\partial s ^ 2} + 3 \, a f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial v\partial s ^ 3} + s^{3} \frac{\partial^4\,L}{\partial a ^ 3\partial s} + 3 \, s^{2} f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial a ^ 2\partial s ^ 2} + 3 \, s f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial a\partial s ^ 3} + f\left(t, x, v, a, s\right)^{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\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial x ^ 2\partial s ^ 2} + 3 \, \frac{\partial^3\,L}{\partial x\partial s ^ 2} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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 \, s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial t\partial a\partial s ^ 2} + 3 \, f\left(t, x, v, a, s\right)^{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\left(t, x, v, a, s\right) \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} - s^{2} \frac{\partial^3\,L}{\partial a ^ 3} + s f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial a ^ 2\partial s} + {\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\left(t, x, v, a, s\right) \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 \, s f\left(t, x, v, a, s\right) \frac{\partial^4\,L}{\partial x\partial a\partial s ^ 2} + 3 \, f\left(t, x, v, a, s\right)^{2} \frac{\partial^4\,L}{\partial x\partial s ^ 3} + 3 \, a \frac{\partial^3\,L}{\partial v\partial s ^ 2} \frac{\partial\,f}{\partial x} + 3 \, s \frac{\partial^3\,L}{\partial a\partial s ^ 2} \frac{\partial\,f}{\partial x} + 3 \, f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial s ^ 3} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial x\partial a\partial s} + 3 \, {\left(a \frac{\partial\,f}{\partial v} + s \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial x\partial s ^ 2} + 3 \, \frac{\partial^3\,L}{\partial t\partial s ^ 2} \frac{\partial\,f}{\partial x} + 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\left(t, x, v, a, s\right) \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\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial t\partial a\partial s} + 3 \, {\left(a \frac{\partial\,f}{\partial v} + s \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial t\partial s ^ 2} - 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(3 \, s^{2} + a f\left(t, x, v, a, s\right)\right)} \frac{\partial^3\,L}{\partial v\partial a\partial s} + 2 \, f\left(t, x, v, a, s\right) \frac{\partial^2\,L}{\partial v\partial s} + 3 \, {\left(a^{2} \frac{\partial\,f}{\partial v} + a s \frac{\partial\,f}{\partial a} + a f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + s f\left(t, x, v, a, s\right) + a \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial v\partial s ^ 2} - f\left(t, x, v, a, s\right) \frac{\partial^2\,L}{\partial a ^ 2} + {\left(3 \, a s \frac{\partial\,f}{\partial v} + 3 \, s^{2} \frac{\partial\,f}{\partial a} + 3 \, s f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial s} + 2 \, f\left(t, x, v, a, s\right)^{2} + 3 \, s \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial a\partial s ^ 2} + 3 \, {\left(a f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial v} + s f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial a} + f\left(t, x, v, a, s\right)^{2} \frac{\partial\,f}{\partial s} + f\left(t, x, v, a, s\right) \frac{\partial\,f}{\partial t}\right)} \frac{\partial^3\,L}{\partial s ^ 3} + \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}$

Similarly the first-order terms arise from $N$ applied to the term $Ds\ f$ in $N(Da(L))$.

N(f).display()

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

For example:

t1 = eq1a.expr().coefficient(diff(f.expr(),t))*diff(f.expr(),t); M.scalar_field(t1).display()

$\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, x, v, a, s\right) & \longmapsto & 3 \, {\left(v \frac{\partial^3\,L}{\partial x\partial s ^ 2} + a \frac{\partial^3\,L}{\partial v\partial s ^ 2} + s \frac{\partial^3\,L}{\partial a\partial s ^ 2} + f\left(t, x, v, a, s\right) \frac{\partial^3\,L}{\partial s ^ 3} + \frac{\partial^3\,L}{\partial t\partial s ^ 2}\right)} \frac{\partial\,f}{\partial t} \end{array}$
x1 = eq1a.expr().coefficient(diff(f.expr(),x))*diff(f.expr(),x); M.scalar_field(x1).display()

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