Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have the following expresion

$$\hat{M}^2=-\left[\frac{1}{\sin\beta}\frac{\partial}{\partial\beta}\sin\beta\frac{\partial}{\partial\beta}+\frac{1}{sin^2\beta}\left(\frac{\partial^2}{\partial\alpha^2}+\frac{\partial^2}{\partial\gamma^2}\right)-2\frac{cot\beta}{sin\beta}\frac{\partial^2}{\partial\alpha\partial\gamma}\right]$$

In my problem i don't want to work with the angle $\beta$, instead i just want to work with the $\cos\beta$ (basically due to the convergence of Legendre functions with respect to spherical armonics), so i'm trying to make a transformation rule for the partial derivative. For instance, $$q=\cos\beta \quad; usin=\sin\beta=\sqrt{1-q^2} \quad and\quad dq=-\sin\beta d\beta$$

My expression for $\hat{M^2}$ is now: $$\hat{M}^2=-\left[\frac{\partial}{\partial q}usin^2\frac{\partial}{\partial q }+ \frac{1}{usin^2}\left(\frac{\partial^2}{\partial\alpha^2}+\frac{\partial^2}{\partial\gamma^2}\right)-2\frac{q}{usin^2}\frac{\partial^2}{\partial\alpha\partial\gamma}\right]$$

Subscript[w, 1] = f[Subscript[r, 1], Subscript[r, 2], α, β, γ, Subscript[Θ, 12]]

M = -(1/Sin[β] D[(Sin[β] D[Subscript[w, 1], β]), β] + 1/Sin[β]^2 (D[Subscript[w, 1], 
   {α, 2}] + D[Subscript[w, 1], {γ, 2}]) - 2 Cot[β]/Sin[β] D[Subscript[w, 1], α, γ])

I have written a few lines of code, however i don't know how to exactly proceed with the transformation.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Basing on the following thread: Change variables in differential expressions and using great code by Jens for visualisation purposes (I have replaced part [vars__Symbol] with [vars__] because you are using Substripted names which are not Symbols, but that's only about visualisation).

You can do the following in the first step:

M2 = M /. f -> (f[#, #2, #3, Cos[#4], #5, #6] &) /. β -> ArcCos[q]

enter image description here

The next substitution is not meant to affect differential expressions, it's only for clarity of the code. But first, we have to make assumption:

$Assumptions = usin > 0

so expressions like Sqrt[usin^2] will be simplified to usin.

M2 /. q^2 -> 1 - usin^2 // Simplify

enter image description here

The output is your desired result but in expanded form. I'm not sure how to make it in the exact same form as yours.

share|improve this answer
    
Many thanks for your help @Kuba it was really usefull, both the chain of variables and the formated output for derivatives. I'm wondering if i could apply the same procedure with more than one angle, for instance also for γ, Can i do this: M2 /. f -> (f[#, #2, #3, Cos[#4], Cos[#5], #6] &) /. β -> ArcCos[q] /. γ -> ArcCos[s]; $Assumptions = usinq > 0 && usins > 0 M2 /. q^2 -> 1 - usinq^2 /. s^2 -> 1 - usins^2 // ExpandAll. –  shadraws Mar 29 at 0:04
1  
@shadraws I hope so :) M2 = M /. f -> (f[#, #2, #3, Cos[#4], Cos[#5], #6] &) /. \[Beta] -> ArcCos[q] /. \[Gamma] -> ArcCos[s]; $Assumptions = usinq > 0 && usins > 0 ; M2 /. q^2 -> 1 - usinq^2 /. s^2 -> 1 - usins^2 // Simplify // ExpandAll –  Kuba Mar 29 at 7:18
    
Simplify is required to get rid of Sqrt[sin^2] –  Kuba Mar 29 at 7:19
    
Thanks a lot again @Kuba –  shadraws Mar 29 at 10:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.