# Removing higher order terms

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

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]

• working like a charm. Thanks – qahtah Jul 28 '18 at 2:20
Series[Sin[x + y + z], {x, 0, 3}, {y, 0, 3}, {z, 0, 3}]