# Solve takes too long with parametric system

**URL:** <https://community.wolfram.com/t/solve-takes-too-long-with-parametric-system/23325>\
**Category:** Questions\
**Tags:** algebra, equation-solving, high-performance-computing, symbolic-computations\
**Created:** [December 29, 2023, 2:21am UTC](https://community.wolfram.com/t/solve-takes-too-long-with-parametric-system/23325 "2023-12-29T02:21:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hongyizhao](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@hongyizhao](https://community.wolfram.com/u/hongyizhao)\
**Post date:** [December 29, 2023, 2:21am UTC](https://community.wolfram.com/t/solve-takes-too-long-with-parametric-system/23325/1 "2023-12-29T02:21:46Z")

</div>

The notebook was given by Jim Napolitano [tuf43817@temple.edu](mailto:tuf43817@temple.edu) and it gets stuck in the “sol” step:

[Open in Wolfram Cloud ↗](https://www.wolframcloud.com/obj/96dab939-fd59-4e4a-97bd-a6837eabc040)

How to fix this problem?

Regards,  
Zhao

---

<div class="post-metadata">

**Author:** ![danl](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/danl/32/41267_2.png) [@danl](https://community.wolfram.com/u/danl)\
**Post date:** [December 29, 2023, 3:19am UTC](https://community.wolfram.com/t/solve-takes-too-long-with-parametric-system/23325/2 "2023-12-29T03:19:15Z")

</div>

Aborting the Solve step will have that effect.

---

<div class="post-metadata">

**Author:** ![hongyizhao](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@hongyizhao](https://community.wolfram.com/u/hongyizhao)\
**Post date:** [December 29, 2023, 5:31am UTC](https://community.wolfram.com/t/solve-takes-too-long-with-parametric-system/23325/3 "2023-12-29T05:31:43Z")

</div>

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
