2
$\begingroup$

I'm plotting a 3d function and looking at it from above. here is the function definition:

lagz[n_, m_, z_, zbar_] := 
 1/Sqrt[Pi*a^2*n!*m!]* E^(z*zbar/(2.*a^4)) * (a)^(m + n)*
   D[ E^(-(z*zbar)/a^4), {z, n}, {zbar, m}] /. {a -> 1}
lagnlz[n_, l_, z_, zbar_] := 
 Sqrt[n!/(Pi*a^2*(n + l)!)]* (z/a)^l LaguerreL[n, l, z*zbar/a^2]*
   E^(-z*zbar/(2.*a^2)) /. {a -> 1}
lag[n_, l_, r_, \[Theta]_] := 
 lagnlz[n, l, z, zbar] /. {z -> r*E^(I*\[Theta]), 
   zbar -> r*E^(-I*\[Theta])}
lagcc[n_, l_, r_, \[Theta]_] := 
 lagnlz[n, l, z, zbar] /. {z -> r*E^(-I*\[Theta]), 
   zbar -> r*E^(I*\[Theta])}

And here is the code I'm using to plot:

RevolutionPlot3D[
 lag[1, 1, r, \[Theta]]*lagcc[1, 1, r, \[Theta]], {r, 0, 
  3}, {\[Theta], 0, 2 Pi}, ViewPoint -> Above]

From the "Above" view, it is not at all clear (at least to me) that the height of the inner ring is larger than the height of the outer ring. Is there some setting or coloring I can use that will make the height difference much more apparent from this "Above" view?

$\endgroup$
0

1 Answer 1

5
$\begingroup$
Clear["Global`*"]

Don't use machine numbers in the function definitions

lagz[n_, m_, z_, zbar_] := 
 1/Sqrt[Pi*a^2*n!*m!]*E^(z*zbar/(2*a^4))*(a)^(m + n)*
   D[E^(-(z*zbar)/a^4), {z, n}, {zbar, m}] /. {a -> 1}
lagnlz[n_, l_, z_, zbar_] := 
 Sqrt[n!/(Pi*a^2*(n + l)!)]*(z/a)^l LaguerreL[n, l, z*zbar/a^2]*
   E^(-z*zbar/(2*a^2)) /. {a -> 1}
lag[n_, l_, r_, θ_] := 
 lagnlz[n, l, z, zbar] /. {z -> r*E^(I*θ), zbar -> r*E^(-I*θ)}
lagcc[n_, l_, r_, θ_] := 
 lagnlz[n, l, z, zbar] /. {z -> r*E^(-I*θ), zbar -> r*E^(I*θ)}

min = MinValue[{lag[1, 1, r, θ]*lagcc[1, 1, r, θ], 0 <= r <= 3, 
   0 <= θ <= 2 Pi}, {r, θ}]

(* 0 *)

max = MaxValue[{lag[1, 1, r, θ]*lagcc[1, 1, r, θ], 0 <= r <= 3, 
    0 <= θ <= 2 Pi}, {r, θ}] // Simplify

(* ((31 - 7 Sqrt[17]) E^(1/2 (-5 + Sqrt[17])))/(4 π) *)

max // N

(* 0.109758 *)

RevolutionPlot3D[
 lag[1, 1, r, θ]*lagcc[1, 1, r, θ], {r, 0, 3}, {θ, 0, 
  2 Pi}, ViewPoint -> Above, ColorFunction -> "Rainbow",  
 PlotLegends -> BarLegend[{"Rainbow", {min, max}}]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you! Why do you suggest not using machine numbers in the function definition? $\endgroup$
    – Zonova
    Commented Jun 14, 2020 at 4:21
  • 3
    $\begingroup$ Using machine numbers introduces numerical errors that keep MaxValue from getting an accurate maximum. $\endgroup$
    – Bob Hanlon
    Commented Jun 14, 2020 at 4:23

Your Answer

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

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