I'm using Mathematica 9 to try to manipulate a 3D plot. My code is:
Clear[f, α, n]
n = 0;
f = (1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h] - (2/3)*α*
p^3*D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h], p,
p] - (1/3)*α*p^2*
D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h],
p] + (1/2)*α^2*((39/9)*p^4*
D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h], p, p] + (28/9)*
p^5*D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h], p, p,
p] + (4/9)*p^6*
D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h], p, p, p,
p] + (6/9)*p^3*
D[(1/Pi)*(-1)^n*Exp[-2*H/h]*LaguerreL[n, 4 H/h], p])
Manipulate[Plot3D[f, {x, -10, 10}, {p, -10, 10}, PlotPoints -> 200, PlotRange -> All], {α, 0, 1, 1}]
where $h=1$ and $H=\frac{1}{2}(x^2+p^2)$.
This, however, just gives a blank plot.
Evaluating the function manually, I find that it is equal to:
$\frac{e^{-p^2-x^2}}{\pi }-\frac{1}{3} 2 \alpha p^3 \left(\frac{4 p^2 e^{-p^2-x^2}}{\pi }-\frac{2 e^{-p^2-x^2}}{\pi }\right)+\frac{2 \alpha p^3 e^{-p^2-x^2}}{3 \pi }+\frac{1}{2} \alpha ^2 \left(\frac{13}{3} p^4 \left(\frac{4 p^2 e^{-p^2-x^2}}{\pi }-\frac{2 e^{-p^2-x^2}}{\pi }\right)-\frac{4 p^4 e^{-p^2-x^2}}{3 \pi }+\frac{4}{9} p^6 \left(-\frac{48 p^2 e^{-p^2-x^2}}{\pi }+\frac{12 e^{-p^2-x^2}}{\pi }+\frac{16 p^4 e^{-p^2-x^2}}{\pi }\right)+\frac{28}{9} p^5 \left(\frac{12 p e^{-p^2-x^2}}{\pi }-\frac{8 p^3 e^{-p^2-x^2}}{\pi }\right)\right)$
In Manipulate, if I manually replace f with this function, I get exactly what I want.
Manipulate[ Plot3D[E^(-p^2 - x^2)/π - 2/3 p^3 (-((2 E^(-p^2 - x^2))/π) + (
4 E^(-p^2 - x^2) p^2)/π) α + ( 2 E^(-p^2 - x^2) p^3 α)/(3 π) + 1/2 (13/3 p^4 (-((2 E^(-p^2 - x^2))/π) + ( 4 E^(-p^2 - x^2) p^2)/π) +
28/9 p^5 ((12 E^(-p^2 - x^2) p)/π - ( 8 E^(-p^2 - x^2) p^3)/π) +
4/9 p^6 ((12 E^(-p^2 - x^2))/π - ( 48 E^(-p^2 - x^2) p^2)/π + ( 16 E^(-p^2 - x^2) p^4)/π) - (4 E^(-p^2 - x^2) p^4)/( 3 π)) α^2, {x, -10, 10}, {p, -10, 10}, PlotPoints -> 200, PlotRange -> All], {α, 0, 1, 1}]
Does anyone know why this difference occurs? How would I bypass this so that my first piece of code will work, that is, without having to manually input f i.e. get my second image as an output using my first piece of code? My goal is to be able to have Manipulate control the values of both n and $\alpha$.
Thanks