6
$\begingroup$

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?

$\endgroup$

3 Answers 3

4
$\begingroup$

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

higher

$\endgroup$
2
  • $\begingroup$ Thank you for rectifying my error ! $\endgroup$
    – codebpr
    Apr 25 at 14:29
  • $\begingroup$ @codebpr you are most welcome. Thanks for the accept :) $\endgroup$
    – bmf
    Apr 25 at 14:29
6
$\begingroup$

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

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

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

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

c[1][t_] := \[Epsilon] C[1][t] + \[Epsilon]^2 \[Alpha]3 C[0][t] C[1][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[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, \[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$.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.