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.

Sorry for the code, I

Sorry for the code, I don't know what happened. Here there is the more readable version:

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.

a trick

that you may use just for display purposes:

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;
B:=expand(%);
BQ:=select(has,B,Q):
BS:=select(has,B,S):
subs(Q=`Q `,BQ)+subs(S=`S `,BS);

and operator form

DepVars := [Q(theta, `ϕ`),S(theta, `ϕ`)];
BJ:= PDEtools:-ToJet(B, DepVars);
select(has,BJ,Q):
DQ:=subs(Q=D,D[]=1,%);
select(has,BJ,S):
DS:=subs(S=D,D[]=1,%);
DS*S+DQ*Q;

(D[2, 2]+cos(theta)*sin(theta)*D[1]-4*sin(theta)^2*M*G*k
-4*sin(theta)^2*M*G*k*D[1, 1]-sin(theta)^2*D[1, 1])*S
+(D[2, 2]+cos(theta)*sin(theta)*D[1]+4*sin(theta)^2*M*G*k*D[1, 1]
+4*sin(theta)^2*M*G*k-sin(theta)^2*D[1, 1])*Q; 

I see the html tags in my

I see the html tags in my posts after I post it, and I don't know why...

 

 

Will's picture

Plain text input format

 The problem was that you set your input format to "Plain Text" this causes everything that you type to appear in your post including the HTML tags.

The WYSYWIG editor automatically inserts tags for you, so you shouldn't need to use the plain text input format. I've set your post to the right format.

____
William Spaetzel
MaplePrimes Administrator
Software Developer, Maplesoft

Hi perphs ...

Ciao, I try using factor simply selecting your expression, and things came in order first Q then S.

I do know if the command alterate the original formula, since I'm not a Maple expert.

I'm not sure either this will answer your question since you are talking about operators (that I assumed be Qand S, but as  said I might be wrong)

Nevetheless it's worted to at list propose it...

take care

 

F.

Thankyou

Thanks everybody, expecially to Jakubi, for the tricks, it works perfectly!

S.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}