3
$\begingroup$

I want to plot intensity of Laguerre Gaussian wave, My code is running accurately with changing p(0,1,2...) and l=0 but when i want to plot with changing l(0,1,2...) and p(0,1,2...) it gives no output. How to plot it for l=0,1,2 and p=0,1,2?

LG[r_, ϕ_, p_, l_, w_] :=Sqrt[(2 p!)/(π (p + Abs[l])!)] (1/w) *
  Exp[-r^2/w^2] ((r Sqrt[2])/w)^Abs[l]*
   LaguerreL[p, Abs[l], (2 r^2)/w^2] Exp[I l ϕ]

t11 =ContourPlot@[
  LG[Sqrt[x^2 + y^2], ArcTan[x, y], 0, 0, 1]^2, {x, -3, 3}, {y, -4, 
   4}, PlotRange -> All, ColorFunction -> "SunsetColors", 
  PlotLegends -> Automatic]
$\endgroup$
4
  • 2
    $\begingroup$ just remove the @ and it works $\endgroup$ – chris Jun 21 '20 at 7:36
  • 1
    $\begingroup$ and note that with your definition for l≠0 LG is complex. This works for instance t11 = Table[ ContourPlot[ LG[Sqrt[x^2 + y^2], ArcTan[x, y], p, l, 1]^2 // Abs, {x, -3, 3}, {y, -4, 4}, PlotRange -> All, ColorFunction -> "SunsetColors"], {l, 0, 2}, {p, 0, 2}] $\endgroup$ – chris Jun 21 '20 at 7:39
  • 1
    $\begingroup$ Respected chris, Thanks for answering, on plotting a white line appears in the contour plots for all varying l=0,1, 2 how can we remove this? $\endgroup$ – Muhammad Arfan Jun 21 '20 at 7:53
  • 1
    $\begingroup$ try ContourPlot[ LG[Sqrt[x^2 + y^2], ArcTan[x, y], 2, 2, 1]^2 // Abs, {x, -3, 3}, {y, -4, 4}, PlotRange -> All, ColorFunction -> "SunsetColors", PlotPoints -> 50, Exclusions -> None] $\endgroup$ – chris Jun 21 '20 at 8:05
1
$\begingroup$

How about this?

Table[
   ContourPlot[
    LG[Sqrt[x^2 + y^2], ArcTan[x, y], p, l, 1]^2 // Abs, {x, -3, 
     3}, {y, -4, 4}, PlotRange -> All, 
    ColorFunction -> "SunsetColors", PlotPoints -> 50, 
    Exclusions -> None, FrameTicks -> None], {l, 0, 2}, {p, 0, 2}] // 
  GraphicsGrid

enter image description here

Note that I remove the @ and added // Abs because your definition of LG is complex for non zero l.

$\endgroup$
2
  • $\begingroup$ Now it is working well. Again Thank you very much Chris $\endgroup$ – Muhammad Arfan Jun 21 '20 at 11:13
  • 1
    $\begingroup$ if you are satisfied with the answer, unless you are waiting for another you could consider accepting this one? $\endgroup$ – chris Jun 21 '20 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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