5
$\begingroup$

I want to plot the real part of the SphericalHarmonicY[1,1,θ,φ]. That is, I want to plot

$$ - \frac{1}{2}\sqrt {\frac{3}{{2\pi }}} \cos[\phi ]\sin[\theta ]$$

To do so, I evaluated the following expression:

SphericalPlot3D[-(1/2) Sqrt[3/(2 π)] Cos[φ] Sin[θ], {θ, 0, π}, {φ, 0, 2 π}]

But the result I got doesn't show the negtive part. What is wrong?

spherical

$\endgroup$
4
  • $\begingroup$ What a negative part do you expect ? $\endgroup$
    – Artes
    Jan 1, 2013 at 13:41
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/16534/… $\endgroup$
    – Mr.Wizard
    Jan 1, 2013 at 14:22
  • $\begingroup$ @Mr.Wizard, I don't think it's a duplicate. That question is about colouring the plot; this one is about parts of the desired plot not showing up at all. Unless there's some subtle property of Mathematica I'm missing that makes these the same thing, which, given that Mathematica is sufficiently complicated, is a possibility I won't dismiss... $\endgroup$
    – user484
    Jan 1, 2013 at 14:36
  • $\begingroup$ @Rahul Someone flagged this post to be closed but didn't post that link. I chose not to close the question myself, but I put the link there for others to decide. $\endgroup$
    – Mr.Wizard
    Jan 1, 2013 at 14:38

1 Answer 1

12
$\begingroup$

The negative part is plotted with negative radius, so it's at the opposite position of where you expect it -- it's exactly overlapping the positive part. You'll have to plot its absolute value or its square, as Nasser suggests, and indicate its negativeness using a different colour or something. Here's one way to do it:

f[θ_, φ_] := -(1/2) Sqrt[3/(2 π)] Cos[φ] Sin[θ]
pos[x_] := If[x >= 0, x, Null]
SphericalPlot3D[{pos[f[θ, φ]], pos[-f[θ, φ]]},
 {θ, 0, π}, {φ, 0, 2 π}, 
 PlotStyle -> {Lighter@Lighter@Red, Lighter@Lighter@Blue}, 
 Lighting -> "Neutral"]

enter image description here

$\endgroup$
10
  • 2
    $\begingroup$ Is there an easy way to replace the escaped characters with their Unicode equivalents? I searched on meta but only found rcollyer saying they would do this, but not how to do so. $\endgroup$
    – user484
    Jan 1, 2013 at 14:27
  • $\begingroup$ Oh well, I pasted them in from Character Map. Hope I didn't make a mistake somewhere. $\endgroup$
    – user484
    Jan 1, 2013 at 15:09
  • $\begingroup$ you can type $\phi$ within the editor and then cut an paste the rendered version. $\endgroup$
    – chris
    Jan 1, 2013 at 15:56
  • $\begingroup$ +1 and thanks for the concern about rendered chars. I hate having to read \[WhateverCharYouWant] $\endgroup$ Jan 1, 2013 at 17:47
  • 2
    $\begingroup$ @RahulNarain Have you seen this: How to “Copy as Unicode” from a Notebook? $\endgroup$
    – Jens
    Jan 1, 2013 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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