Question: How to order with respect to functions AND derivatives

Good mornig,

I've this expression

diff(Q(theta, `ϕ`), `ϕ`, `ϕ`)+diff(S(theta, `ϕ`), `ϕ`, `ϕ`)+(diff(S(theta, `ϕ`), theta)+diff(Q(theta, `ϕ`), theta))*cos(theta)*sin(theta)+(4*M*G*k*(diff(Q(theta, `ϕ`), theta, theta))-4*M*G*k*S(theta, `ϕ`)+4*M*G*k*Q(theta, `ϕ`)-4*M*G*k*(diff(S(theta, `ϕ`), theta, theta))-(diff(S(theta, `ϕ`), theta, theta))-(diff(Q(theta, `ϕ`), theta, theta)))*sin(theta)^2

And I would order the factors in order to have all the factors with S(theta,phi) after (or before) ALL the factors with Q(theta,phi).

I've tried with sort(..., Q(theta,phi)) but this seems not work on the derivative like diff(Q(...),theta)

 

So, there is a metod to obtein this ordering? Or (better) to print this expression like two differential operator acting on S and Q?

 

Thank you

S.

Please Wait...