7
$\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$
8
$\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$
  • $\begingroup$ working like a charm. Thanks $\endgroup$ – qahtah Jul 28 '18 at 2:20
-4
$\begingroup$
Series[Sin[x + y + z], {x, 0, 3}, {y, 0, 3}, {z, 0, 3}] 
$\endgroup$

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.