# 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[0][t]^3 + 21.5 c[0][t] c[1][t]^2 +
10.7 c[0][t] c[0]'[t]^2 + 3.32 c[0][t] c[1]'[t]^2 +
6.64 c[0]'[t] c[1][t] c[1]'[t];

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

c[1][t_] := C[1][t] + α3 C[0][t] C[1][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[0][t], C[1][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[0][t], C[1][t], C[0]'[t], C[1]'[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[0] C[0][t]^2 + 11.3 C[0][t]^3 + 3. ωsq[0] C[0][t]^3 - ωsq[1] C[1][t]^2 + 21.5 C[0][t] C[1][t]^2 + 1. ωsq[0] C[0][t] C[1][t]^2 + 2 ωsq[1] C[0][t] C[1][t]^2 + C[0]'[t]^2 + 4.7 C[0][t] C[0]'[t]^2 + 2.64 C[1][t] C[0]'[t] C[1]'[t] + C[1]'[t]^2 + 1.32 C[0][t] C[1]'[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[0][t_] := ϵ C[0][t] + ϵ^2 α1 C[0][t]^2 + ϵ^2 α2 C[1][t]^2;

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

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

newlagrangian =
Sum[c[n]'[t]^2 - c[n][t]^2 ωsq[n], {n, {0, 1}}] +
11.3 c[0][t]^3 + 21.5 c[0][t] c[1][t]^2 +
10.7 c[0][t] c[0]'[t]^2 + 3.32 c[0][t] c[1]'[t]^2 +
6.64 c[0]'[t] c[1][t] c[1]'[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, ϵ], 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$$.