1
$\begingroup$

I'm trying to recreate a graph from a paper, and the function that I'm plotting involves three separate parabolic cylinder functions that all have a complex Nu value. After getting it all typed out, I end up with an empty plot. I've gone back to basics and have fiddled around with ParabolicCylinderD, and have found that I can plot it no problem with a real Nu, but as soon as I make Nu complex I end up with an empty plot. What am I doing wrong?

Edit:

I'll put in the test code I used while playing with the function to see if it worked, but it's just a case of using a complex input with the function to see if it works.

Plot[ParabolicCylinderD[2,p],{p,0,50}]

That one worked totally fine, got a good plot from it.

Plot[ParabolicCylinderD[2 I,p],{p,0,50}]

This one didn't work at all, got an empty plot as a result.

$\endgroup$
6
  • $\begingroup$ We cannot reproduce or work on the problem without the code for a minimal example. $\endgroup$
    – Bob Hanlon
    Commented Jul 29, 2020 at 15:16
  • $\begingroup$ I've adjusted the main question to include my tinkering example but it's literally just a case of putting a complex number in the nu value for the ParabolicCylinderD function $\endgroup$
    – PewtDmD
    Commented Jul 29, 2020 at 15:22
  • 1
    $\begingroup$ @PewtDmD Plot will not show complex numbers. You need to take real Re and imaginary Im separately, or if you only care about the norm, then use Abs $\endgroup$
    – flinty
    Commented Jul 29, 2020 at 15:34
  • 2
    $\begingroup$ Depending on your version of Mathematica, one or more of the following will work: ReImPlot[ParabolicCylinderD[2 I, p], {p, 0, 8}, PlotRange -> All, PlotLegends -> Placed["ReIm", {0.5, 0.5}]] or Plot[Evaluate@ReIm@ParabolicCylinderD[2 I, p], {p, 0, 8}, PlotRange -> All, PlotLegends -> Placed[{Re, Im}, {0.5, 0.5}]] or Plot[Evaluate[#[ParabolicCylinderD[2 I, p]] & /@ {Re, Im}], {p, 0, 8}, PlotRange -> All, PlotLegends -> Placed[{Re, Im}, {0.5, 0.5}]] $\endgroup$
    – Bob Hanlon
    Commented Jul 29, 2020 at 15:44
  • $\begingroup$ Perhaps if you had added a link to the paper you speak of, it would be easier to see what the function to be plotted is supposed to be. $\endgroup$ Commented Sep 25, 2020 at 0:44

1 Answer 1

1
$\begingroup$

Yes certainly. If you have a fixed complex $\nu$ then use ComplexPlot not Plot like so:

ComplexPlot[ParabolicCylinderD[0.3 + 0.2 I, z], {z, -1 - I, 1 + I}]

enter image description here

... or if you still want to use Plot, then take the real and imaginary parts separately:

Plot[{Re[ParabolicCylinderD[0.3 + 0.2 I, x]], 
  Im[ParabolicCylinderD[0.3 + 0.2 I, x]]}, {x, -3, 3}, 
 PlotStyle -> {Directive[Red], Directive[Blue]}]

enter image description here

For $\nu=2\mathbf{i}$ we have real and imaginary parts quickly decaying towards zero:

Plot[{
  Re[ParabolicCylinderD[2 I, x]],
  Im[ParabolicCylinderD[2 I, x]], 
  Abs[ParabolicCylinderD[2 I, x]]}, {x, 0, 10}, 
 PlotStyle -> {Directive[Red], Directive[Blue], Directive[Thick, Darker@Green]}, 
 PlotRange -> All, 
 PlotLegends -> {"Re", "Im", "Abs"}]

enter image description here

$\endgroup$
2
  • $\begingroup$ The result of ComplexPlot3D[ParabolicCylinderD[0.3 + 0.2 I, z], {z, -1 - I, 1 + I}] is more informative. $\endgroup$
    – user64494
    Commented Jul 29, 2020 at 15:38
  • 1
    $\begingroup$ Also note you can do: FunctionExpand[Abs[ParabolicCylinderD[2 I, x]]], FunctionExpand[Re[ParabolicCylinderD[2 I, x]]], and FunctionExpand[Im[ParabolicCylinderD[2 I, x]]] to get forms in exponentials, cosines, and HermiteH functions. $\endgroup$
    – flinty
    Commented Jul 29, 2020 at 15:46

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.