2
$\begingroup$

I found something odd in Mathematica when using the SphericalPlot3D command.

Ranges for $x,y∈[0,2 \pi]$ are the same. All I do is swap sine and cosine.

enter image description here

But when I additionally change the intervals in places, everything "normalizes".

enter image description here

If this is an internal error in Mathematica, I ask developers and users to pay attention. In theory, this should give exactly the same result, however...

SphericalPlot3D[Sin[x] Cos[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, 
  BoxRatios -> {1, 1, 1}, ImageSize -> Tiny];

SphericalPlot3D[Cos[x] Sin[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, 
  BoxRatios -> {1, 1, 1}, ImageSize -> Tiny];

I have version 12 of Mathematica and Windows 10.

$\endgroup$
6
  • $\begingroup$ Is there a special reason for using x,y instead of $\theta$, $\phi$ in the context of SphericalPlot3D? $\endgroup$
    – Syed
    Commented Feb 4, 2022 at 6:14
  • $\begingroup$ @Syed There is no particular reason, it's just for your own convenience. Any letters can be used. $\endgroup$
    – dtn
    Commented Feb 4, 2022 at 6:15
  • $\begingroup$ While specifying the function to be plotted, a change in the positions of x, y changes their meanings? $\endgroup$
    – Syed
    Commented Feb 4, 2022 at 6:42
  • 2
    $\begingroup$ There are a lot of confusion here. Once corrected, everything is fine. Voting to close. First of all, the range of the first argument is not $[0,2\pi]$, but $[0,\pi]$. Second, one should consider that the negative part of the function is not plotted. Third, Sin[x] Cos[y] and Cos[x] Sin[y] are not equivalent because the two angles have very different meaning. $\endgroup$
    – yarchik
    Commented Feb 4, 2022 at 6:51
  • 1
    $\begingroup$ Yes, it would be possible, but what is the end goal you are trying to achieve? Maybe you should explain a bit more your real problem. $\endgroup$
    – yarchik
    Commented Feb 4, 2022 at 7:36

1 Answer 1

4
$\begingroup$

We can compare the two cases in Cartesian coordinate.

r1[θ_, φ_] = Sin[θ] Cos[φ];
r2[θ_, φ_] = Sin[φ] Cos[θ];
result1=FromSphericalCoordinates[{r, θ, φ}] /.r -> r1[θ, φ]
result2=FromSphericalCoordinates[{r, θ, φ}] /.r -> r2[θ, φ]

$$\left\{\sin ^2(\theta ) \cos ^2(\varphi ),\sin ^2(\theta ) \sin (\varphi ) \cos (\varphi ),\sin (\theta ) \cos (\theta ) \cos (\varphi )\right\}$$

$$\left\{\sin (\theta ) \cos (\theta ) \sin (\varphi ) \cos (\varphi ),\sin (\theta ) \cos (\theta ) \sin ^2(\varphi ),\cos ^2(\theta ) \sin (\varphi )\right\}$$

It means that r1[θ_, φ_] = Sin[θ] Cos[φ] and r2[θ_, φ_] = Sin[φ] Cos[θ] is different.

$\endgroup$

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