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?


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.


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.

  • $\begingroup$ We cannot reproduce or work on the problem without the code for a minimal example. $\endgroup$ – Bob Hanlon Jul 29 '20 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 Jul 29 '20 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 Jul 29 '20 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 Jul 29 '20 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$ – J. M.'s torpor Sep 25 '20 at 0:44

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:

  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

  • $\begingroup$ The result of ComplexPlot3D[ParabolicCylinderD[0.3 + 0.2 I, z], {z, -1 - I, 1 + I}] is more informative. $\endgroup$ – user64494 Jul 29 '20 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 Jul 29 '20 at 15:46

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.