Now, I apply ParallelEvaluate to the Solve step and it finished quickly, but the result is different from the one shown in the original notebook:
This is the result obtained via ParallelEvaluate:
HW#6 Problem 1: Differential form of Lz
In[41]:= Remove["Global`*"]
$Assumptions =
r > 0 && \[Theta] > 0 && \[Theta] < Pi && \[Phi] > 0 && \[Phi] <
2 Pi;
In[43]:= xp = r Cos[\[Phi]] Sin[\[Theta]];
yp = r Sin[\[Phi]] Sin[\[Theta]];
zp = r Cos[\[Theta]];
In[46]:= sol = Solve[{x == xp, y == yp, z == zp}, {r, \[Theta], \[Phi]}] //
ParallelEvaluate;
In[47]:= drdx = Simplify[D[r /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
d\[Theta]dx =
Simplify[D[\[Theta] /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
d\[Phi]dx =
Simplify[D[\[Phi] /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
drdy = Simplify[D[r /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
d\[Theta]dy =
Simplify[D[\[Theta] /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
d\[Phi]dy =
Simplify[D[\[Phi] /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
Out[47]= {-Cos[\[Phi]] Sin[\[Theta]], -Cos[\[Phi]] Sin[\[Theta]],
Cos[\[Phi]] Sin[\[Theta]], Cos[\[Phi]] Sin[\[Theta]]}
Out[48]= {ConditionalExpression[(Cos[\[Theta]] Cos[\[Phi]])/r,
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Cos[\[Theta]] Cos[\[Phi]])/r),
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Cos[\[Theta]] Cos[\[Phi]])/r),
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[(Cos[\[Theta]] Cos[\[Phi]])/r,
ConditionalExpression[1, \[Placeholder]] \[Element] Integers]}
Out[49]= {ConditionalExpression[-((Csc[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Csc[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Csc[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Csc[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[2, \[Placeholder]] \[Element] Integers]}
Out[50]= {-Sin[\[Theta]] Sin[\[Phi]], -Sin[\[Theta]] Sin[\[Phi]],
Sin[\[Theta]] Sin[\[Phi]], Sin[\[Theta]] Sin[\[Phi]]}
Out[51]= {ConditionalExpression[(Cos[\[Theta]] Sin[\[Phi]])/r,
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Cos[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[-((Cos[\[Theta]] Sin[\[Phi]])/r),
ConditionalExpression[1, \[Placeholder]] \[Element] Integers],
ConditionalExpression[(Cos[\[Theta]] Sin[\[Phi]])/r,
ConditionalExpression[1, \[Placeholder]] \[Element] Integers]}
Out[52]= {ConditionalExpression[(Cos[\[Phi]] Csc[\[Theta]])/r,
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[(Cos[\[Phi]] Csc[\[Theta]])/r,
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[(Cos[\[Phi]] Csc[\[Theta]])/r,
ConditionalExpression[2, \[Placeholder]] \[Element] Integers],
ConditionalExpression[(Cos[\[Phi]] Csc[\[Theta]])/r,
ConditionalExpression[2, \[Placeholder]] \[Element] Integers]}
This is the result given in the original notebook:
HW#6 Problem 1: Differential form of Lz
In[1]:= Remove["Global`*"]
$Assumptions =
r > 0 && \[Theta] > 0 && \[Theta] < Pi && \[Phi] > 0 && \[Phi] <
2 Pi;
In[3]:= xp = r Cos[\[Phi]] Sin[\[Theta]];
yp = r Sin[\[Phi]] Sin[\[Theta]];
zp = r Cos[\[Theta]];
In[6]:= sol = Solve[{x == xp, y == yp, z == zp}, {r, \[Theta], \[Phi]}];
drdx = Simplify[D[r /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
d\[Theta]dx =
Simplify[D[\[Theta] /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
d\[Phi]dx =
Simplify[D[\[Phi] /. sol[[3]], x] /. {x -> xp, y -> yp, z -> zp}]
drdy = Simplify[D[r /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
d\[Theta]dy =
Simplify[D[\[Theta] /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
d\[Phi]dy =
Simplify[D[\[Phi] /. sol[[3]], y] /. {x -> xp, y -> yp, z -> zp}]
Out[7]= Cos[\[Phi]] Sin[\[Theta]]
Out[8]= ConditionalExpression[-((Cos[\[Theta]] Cos[\[Phi]])/r),
C[1] \[Element] Integers]
Out[9]= ConditionalExpression[-((Csc[\[Theta]] Sin[\[Phi]])/r),
C[2] \[Element] Integers]
Out[10]= Sin[\[Theta]] Sin[\[Phi]]
Out[11]= ConditionalExpression[-((Cos[\[Theta]] Sin[\[Phi]])/r),
C[1] \[Element] Integers]
Out[12]= ConditionalExpression[(Cos[\[Phi]] Csc[\[Theta]])/r,
C[2] \[Element] Integers]
Why is such a difference happening and which one is correct?
Regards,
Zhao