8
$\begingroup$

I have a very long expression in terms of the three functions u1, u2, u3. I am writing below only a small number of terms. I would like to define a rule that keeps terms of order three or less of any multiplication of u1, u2,u3 and their derivatives.

 ss=  u2[x, y, z, t]^3 + A*u2[x, y, z, t]^4 + Derivative[0, 0, 0, 2][u1][x, y, z, t] + 
 (3*λ*Derivative[0, 0, 1, 0][u1][x, y, z, t]^2*Derivative[0, 0, 2, 0]  [u1][x, y, z, t])/2 + 
  (5*CC*Derivative[0, 0, 1, 0][u1][x, y, z, t]^4*Derivative[0, 0, 2, 0][u1][x,y, z, t])/4 + μ*Derivative[0, 0, 2, 0][u2][x, y, z, t]

The output should be:

  u2[x, y, z, t]^3 + Derivative[0, 0, 0, 2][u1][x, y, z, t] + (3*λ*Derivative[0, 0, 1, 0][u1][x, y, z, t]^2*Derivative[0, 0, 2, 0][u1][x, y, z, t])/2 + 
 μ*Derivative[0, 0, 2, 0][u2][x, y, z, t]

Thanks

$\endgroup$
2

2 Answers 2

9
$\begingroup$

You can use a variation of the idea I gave here:

Normal @ Series[
    ss /. {f:u1|u2 -> (s f[#1,#2,#3,#4]&)},
    {s, 0, 3}
] /. s->1

u2[x, y, z, t]^3 + Derivative[0, 0, 0, 2][u1][x, y, z, t] + (3*λ*Derivative[0, 0, 1, 0][u1][x, y, z, t]^2*Derivative[0, 0, 2, 0][u1][x, y, z, t])/2 + μ*Derivative[0, 0, 2, 0][u2][x, y, z, t]

$\endgroup$
1
  • $\begingroup$ working like a charm. Thanks $\endgroup$ Commented Jul 28, 2018 at 2:20
-5
$\begingroup$
Series[Sin[x + y + z], {x, 0, 3}, {y, 0, 3}, {z, 0, 3}] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.