# Plot Complex Function [duplicate]

I want to have a 3D plot for the following function: (1.6 - 0.005 I) E^(-0.5 p^2 + ( 2. I) p q + (6.5 - 11 q) q) p and q from -10 to 10

Is there any way?

• Hi, welcome to Mathematica.SE, please consider taking the tour so you learn the basic rules of the site. Here its considered helpful to share your code attempts, hopefully is a well formatted way. Do you want to plot only of the real part? Please explain further what do you expect as an output. – rhermans Oct 11 '14 at 19:57

Here's an interesting way to do it using complex phase-amplitude plots:

hue = Compile[{{z, _Complex}}, {(1.0 Arg[-z] + \[Pi])/(2 \[Pi]),
Exp[1 - Max[Abs[z], 1]], Min[Abs[z], 1]},
CompilationTarget -> "C", RuntimeAttributes -> {Listable}];
ComplexPlot[f_, {x0_, x1_, \[Delta]x_}, {y0_, y1_, \[Delta]y_}] :=
Image[hue[
f[#[[All, All, 1]], #[[All, All, 2]]] &@
Outer[List, Range[x0, x1, \[Delta]x],
Range[y0, y1, \[Delta]y]]]\[Transpose], ColorSpace -> Hue,
Magnification -> 1];
ComplexPlot[f_, {x0_, x1_, \[Delta]x_}, {y0_, y1_, \[Delta]y_},
mag_] :=
Image[hue[
mag f[#[[All, All, 1]], #[[All, All, 2]]] &@
Outer[List, Range[x0, x1, \[Delta]x],
Range[y1, y0, -\[Delta]y]]]\[Transpose], ColorSpace -> Hue,
Magnification -> 1];
CCompile[expr_] :=
Compile[{{x, _Real}, {y, _Real}}, Evaluate[expr],
CompilationTarget -> "C", RuntimeAttributes -> {Listable}];


Then execute the following:

f = (1.6 -
0.005 I) E^(-0.5 p^2 + (2. I) p q + (6.5 - 11 q) q) /. {p -> x,
q -> y};
ComplexPlot[CCompile[f], {-2, 2, 0.005}, {-0.8, 1.2, 0.005}, 0.3]


which produces the following plot: Since the function is complex valued, you have to find its real and imaginary and plot these. This type of question has been asked before many times, so I am sure this is duplicate.

Clear[p, q]
f = (1.6 - 0.005 I) E^(-0.5 p^2 + (2. I) p q + (6.5 - 11 q) q)
p1 = Plot3D[Re@f, {p, -2, 2}, {q, -2, 2}, PlotRange -> All]
p2 = Plot3D[Im@f, {p, -2, 2}, {q, -2, 2}, PlotRange -> All] f = (1.6 - 0.005 I) E^(-0.5 p^2 + (2. I) p q + (6.5 - 11 q) q);

Partition[
Plot3D[#[f],
{p, -2, 2}, {q, -2, 2},
PlotRange -> All,
PlotPoints -> 51,
AxesLabel -> (Style[#, 14, Bold] & /@
{p,
q, #["f"]})] & /@
{Re, Im, Abs, Arg}, 2] // Grid 