Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a function $\psi(r,\theta,\phi=\phi_0)$ with $\phi_0\in \Re$, $r\in[0,R]$ with $R\in \Re$, and $\theta \in [0,\pi]$ (spherical polar coordinates) and I want to plot it in Mathematica. I guess the proper way to do that is in polar coordinates, but how do I do that?

The function is:

$$\psi(r,\theta,\phi=0)=r^2e^{-r}\cos \theta $$

share|improve this question
    
Have you tried searching the docs? Lookup PolarPlot... –  rm -rf Oct 25 '13 at 15:40
2  
How about ParametricPlot3D[{r Cos[θ], r Sin[θ], r^2 Exp[-r] Cos[θ]}, {r,0,4}, {θ,0,π}]. –  RiemannZeta Oct 25 '13 at 16:29
    
@rm-rf Yeah, but PolarPlot needs $r$ as function of $\theta$. –  Anuar Oct 25 '13 at 16:38
    
What coordinate is supposed to represent $\psi$? –  Michael E2 Oct 25 '13 at 19:46
    
@MichaelE2 Actually $\psi$ is a wave function for the Hydrogen Atom. –  Anuar Oct 27 '13 at 3:21
show 3 more comments

1 Answer

First find the condition for $\phi=0$ in cartesian coordinates.

Last@CoordinateTransform["Cartesian" -> "Spherical", {x, y, z}];
Solve[% == 0, y]

{{y -> 0}}

Convert the expression to cartesian coordinates, apply the condition, and plot.

TransformedField["Spherical" -> "Cartesian", 
r^2 Exp[-r] Cos[θ], {r, θ, ϕ} -> {x, y, z}] /. %;

Plot3D[%, {x, -5, 5}, {z, -5, 5}, AxesLabel -> {x, z, ψ}]

enter image description here

Hope this is what you were looking for.

share|improve this answer
    
First you set y -> 0, which I agree with. But I do have a criticism/question: Next in Plot3D you plot the transformed expression (let expr = %) as if it were the graph of y == expr. Why y == expr if y is 0? –  Michael E2 Oct 26 '13 at 1:06
    
Michael E2, Hopefully this fig en.wikipedia.org/wiki/File:3D_Spherical.svg will clear things. $\phi==0$ corresponds to $y==0$. $expr$ is a function of $x$ and $z$, and its values are plotted along the $y$ axis. –  Suba Thomas Oct 27 '13 at 0:12
1  
I know all that. That means the $y$ on the $y$ axis is not the same $y$ that is zero when $\phi=0$. That's confusing to me. I think $\psi$ ought to be treated as an intensity (as in DensityPlot) or as you have done (but not labeled $y$). –  Michael E2 Oct 27 '13 at 0:26
    
I think you are taking issue with just the label? My thought flow is that there is one $y$ axis, the abscissae lie on $y==0$ and the ordinate can take values along the $y$ axis; and I also labeled it $y$. Now, I have changed it to $\psi$. –  Suba Thomas Oct 27 '13 at 0:56
    
Yes, I had read it that the $y$'s were the same. With relabeling the confusion disappears. I don't think the OP's question is sufficiently clear yet, but this is a reasonable interpretation. +1. –  Michael E2 Oct 27 '13 at 1:09
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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