I am new to Mathematica, trying to plotting spherical harmonics of a wave functon. I want to plot ${}Y^0_3$. So I typed

SphericalPlot3D[5 Cos^3[θ] - 3 Cos[θ], {θ, 0, Pi}, {φ, 0, 2 Pi}]

It gives me an empty plot like this:


When I copy the same equation

(5 Cos^3[θ] - 3 Cos[θ], {θ, 0, Pi}, {φ, 0, 2 Pi}) 

into Wolfram|Alpha, it gives me a 3d plot looks like "waves"(sorry, I couldn't put the picture because my reputaion is less than 10)

My main question is What's wrong with my input in Mathematica?

  • $\begingroup$ I think the constant in the front of the equation is not important for spatial plot. So I didn't write it. $\endgroup$ – Chao Song Mar 26 '17 at 13:01
  • $\begingroup$ Possible duplicate of problem with coloring spherical harmonics $\endgroup$ – Artes Mar 27 '17 at 14:28

What is wrong is that Cos^3 is not a function. The following works:

SphericalPlot3D[5 Cos[theta]^3 - 3 Cos[theta], {theta, 0, Pi}, {phi, 0, 2 Pi}]


To debug your issue, you could have tried to plot 5 Cos^3[theta] - 3 Cos[theta] for example and see that it gives an empty plot. Then plot 3 Cos[theta], etc. until you understand what's wrong.

| improve this answer | |
  • $\begingroup$ I try it with ${}Y^1_3$ SphericalPlot3D[ E^(I$\phi$) Sin[$\theta$]] (5 Cos[$\theta$]^2 - 1), {$\theta$, 0, Pi}, {$\phi$, 0, 2 Pi}] It still empty. What's wrong? $\endgroup$ – Chao Song Mar 26 '17 at 14:08
  • $\begingroup$ E^(I*phi) is complex-valued. What output would you expect? $\endgroup$ – anderstood Mar 26 '17 at 14:18
  • $\begingroup$ may be it's a physics problem, It should be the Atomic d orbital. I misunderstood the physics process. $\endgroup$ – Chao Song Mar 26 '17 at 14:28
  • $\begingroup$ @Chao, shouldn't you be plotting the real part, the imaginary part, or the absolute value? $\endgroup$ – J. M.'s discontentment Mar 26 '17 at 14:35
  • $\begingroup$ @ChaoSong Maybe relevant: en.wikipedia.org/wiki/Spherical_harmonics#Real_form $\endgroup$ – anderstood Mar 26 '17 at 14:40

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