# How to properly plot the singularities of a non-trivial phase profile with DensityPlot?

Consider as an example the following function:

\[Psi][l_, p_, k_, w_][r_, \[Phi]_, z_] := (
r^Abs@l Exp[I l \[Phi]])/(w^2 + I z/k)^(Abs@l + 1)
Exp[-r^2/(2 (w^2 + I z/k))] LaguerreL[p, Abs@l, r^2/(
w^2 + z^2/(k^2 w^2))] ((w^2 - I z/k)/(w^2 + I z/k))^p


This is (one form of) a Laguerre-Gaussian mode of a beam of light. What I'm interested in is the phase profile of this function. I can plot this using DensityPlot in the trivial way, and here is what I get:

With[{w = 0.34, k = 1, l = 3, p = 2, z = .01},
DensityPlot[
Evaluate[Arg@\[Psi][l, p, k, w][Norm@{x, y}, ArcTan[x, y], z]],
{x, -2, 2},
{y, -2, 2},
ImageSize -> Large,
PlotPoints -> 100,
MaxRecursion -> 5
]
]


While not a bad result overall, I would like to improve the quality of this plot, in particular making the circle singularities nice smooth white circles.

Of course, I would like to do this without manually putting a white circle on the graphics, and without analytically find out the singularity structure of the function. With this I mean that I'm not looking for a mathematical (with pen and paper) way to extract from the function at hand the singularity structure so to plot it exactly over the DensityPlot, but a method that would allow Mathematica to automatically find such a singularity structure, even if not applicable to all types of functions, would already be something.

Also, in the solution of this problem one can assume some form of regularity in the structure of the singularity lines, so that a method that finds a certain number of singularity points and then interpolates between them is acceptable. Indeed, even just a way to programmatically exctract the excluded points in the DensityPlot and interpolate between them would be probably enough.

An equivalent form of this question is therefore: how can I extract the singularity lines of the given function?

How could I go about doing this?

• "assuming to not being able to analytically find out the singularity structure of the function." - but that's exactly why it looks fuzzy near the cuts! The built-in exclusions code can't figure your function out, and thus the plotter has to make the best out of a discontinuous function. – J. M. is away Jun 15 '16 at 13:57
• @J.M. yes, I appreciate why DensityPlot gives this kind of result. But I was thinking that maybe there is some way to specifically look out for the singularity structure of the function, and then assuming some regularity in it interpolate along a number of singular points found this way... do you think something like this would be doable? – glS Jun 15 '16 at 14:01
• @J.M. also, by not being able to find the structure analytically, I mean that I don't want to solve the function myself with pen and paper. A method that would allow Mathematica to do this automatically, even if it would not work for all types of functions, would already be something – glS Jun 15 '16 at 14:03
• Ah, that's a more reasonable expectation... please edit your question to add it. – J. M. is away Jun 15 '16 at 14:05
• @J.M. edited accordingly, thanks for the suggestion – glS Jun 15 '16 at 14:12

Specifying Exclusions specifically as the zero of the function whose argument you are plotting seems to be effective in this case

With[{w = 0.34, k = 1, l = 3, p = 2, z = .01},
DensityPlot[
Evaluate[Arg@\[Psi][l, p, k, w][Norm@{x, y}, ArcTan[x, y],
z]], {x, -2, 2}, {y, -2, 2}, ImageSize -> Large,
PlotPoints -> 100, MaxRecursion -> 5,
Exclusions -> (Evaluate[
Arg@\[Psi][l, p, k, w][Norm@{x, y}, ArcTan[x, y], z]] == 0)]]


• the problem with this is that it gives the wrong result: you get lines for the discontinuities of the phase and when the phase is 0, as you can see from the fact that in your plot you have twice the white lines in mine. – glS Jun 15 '16 at 20:47
• @gls I agree that these curves are not in the right place (but it does at least show how to make smooth curves if you use the right function). However, do you think the curves in your picture in the right place? You include phase-wrap discontinuities that presumably have no physical significance. – mikado Jun 15 '16 at 22:16