# Neglecting higher order terms in a Lagrangian

I have a lagrangian which is modified by variable change. I want to neglect all the 4th order and higher terms in the new lagrangian. The code being used is given below:


lagrangian =
Sum[c[n]'[t]^2 - c[n][t]^2 ωsq[n], {n, {0, 1}}] +
11.3 c[t]^3 + 21.5 c[t] c[t]^2 +
10.7 c[t] c'[t]^2 + 3.32 c[t] c'[t]^2 +
6.64 c'[t] c[t] c'[t];

c[t_] := C[t] + α1 C[t]^2 + α2 C[t]^2;

c[t_] := C[t] + α3 C[t] C[t];

α1 = -1.5; α2 = -0.5; α3 = -1;

n = Expand[lagrangian]


I tried using this code to neglect the higher-order terms:

vars = {C[t], C[t]};
Normal[Series[n /. Thread[vars -> m*vars], {m, 0, 3}]] /. m -> 1


which does part of the job but there are still some higher-order derivative terms present. How to go about removing them too from the modified lagrangian?

If I understand correctly you just have to include the derivatives in the vars

vars = {C[t], C[t], C'[t], C'[t]};
Normal[Series[n /. Thread[vars -> m*vars], {m, 0, 3}]] /. m -> 1 • Thank you for rectifying my error ! Apr 25, 2022 at 14:29
• @codebpr you are most welcome. Thanks for the accept :)
– bmf
Apr 25, 2022 at 14:29

Another approach to insert the "smallness" parameter is:

Normal[
Series[n /. C[i_] :> Function[m C[i][#]], {m, 0, 3}]
] /. m->1


-ωsq C[t]^2 + 11.3 C[t]^3 + 3. ωsq C[t]^3 - ωsq C[t]^2 + 21.5 C[t] C[t]^2 + 1. ωsq C[t] C[t]^2 + 2 ωsq C[t] C[t]^2 + C'[t]^2 + 4.7 C[t] C'[t]^2 + 2.64 C[t] C'[t] C'[t] + C'[t]^2 + 1.32 C[t] C'[t]^2

• Heh, I thought of trying something like that but I couldn't get the syntax to work. Thanks for figuring it out & posting it. Apr 25, 2022 at 21:14
• That's the most resilient approach. Thumbs up!
– bmf
Apr 26, 2022 at 0:07

Another way to do this is to "tag" the expressions in the original code with some formal parameter $$\epsilon$$:

c[t_] := \[Epsilon] C[t] + \[Epsilon]^2 \[Alpha]1 C[t]^2 + \[Epsilon]^2 \[Alpha]2 C[t]^2;

c[t_] := \[Epsilon] C[t] + \[Epsilon]^2 \[Alpha]3 C[t] C[t];

\[Alpha]1 = -1.5; \[Alpha]2 = -0.5; \[Alpha]3 = -1;

newlagrangian =
Sum[c[n]'[t]^2 - c[n][t]^2 \[Omega]sq[n], {n, {0, 1}}] +
11.3 c[t]^3 + 21.5 c[t] c[t]^2 +
10.7 c[t] c'[t]^2 + 3.32 c[t] c'[t]^2 +
6.64 c'[t] c[t] c'[t];

newn = Expand[newlagrangian]


You can then take the coefficients order by order in $$\epsilon$$, either using Normal and Series or by using CoefficientList:

result = Total[Take[CoefficientList[newn, \[Epsilon]], 4]]


The 4 in there is because you want to keep the first four terms of the coefficient list, which correspond to terms of order $$\epsilon^0$$, $$\epsilon^1$$, $$\epsilon^2$$, and $$\epsilon^3$$.