Plotting complex functions

Mathematica definitions

Load needed packages for this notebook

<< Graphics`Colors`;
<< Graphics`ComplexMap`;

Set up defaults

Turn off annoying warning messages

Off[General::spell];
Off[General::spell1];

Set default options for specific functions

SetOptions[Plot, Frame -> True];
SetOptions[ListPlot, Frame -> True,  PlotJoined -> True,  
        Axes -> {True, False}];

Plotting complex functions

Example set 1: 2d to 2d

Example #1

g1 = 
        CartesianMap[Identity, {-1, 1}, {-2, 2},  
          PlotStyle -> Blue,  Frame -> True,  
          DisplayFunction -> Identity];
g2 = 
        CartesianMap[Exp, {-1, 1}, {-2, 2}, PlotStyle -> Red,  
          Frame -> True,  
          DisplayFunction -> Identity];
Show[GraphicsArray[{g1, g2}], ImageSize -> 504];

Exp[-1 - 2  I]  //  N

Exp[1 - 2  I]  //  N

Example #2

g1 = 
        PolarMap[Identity, {0, 1}, {-π + 0.00001, π},  
          PlotStyle -> Blue,  Frame -> True,  
          DisplayFunction -> Identity];
g2 = 
        PolarMap[Sqrt, {0, 1}, {-π + 0.00001, π}, 
          PlotStyle -> Red, Frame -> True,  
          DisplayFunction -> Identity];
Show[GraphicsArray[{g1, g2}], ImageSize -> 504];

Sqrt[Exp[-2 I]]  //  FullSimplify

Example #3a

g1 = 
        CartesianMap[Identity, {-1, 1}, {-2, 2},  
          PlotStyle -> Blue,  Frame -> True,  
          DisplayFunction -> Identity];
g2 = 
        CartesianMap[Sin, {-1, 1}, {-2, 2}, PlotStyle -> Red,  
          Frame -> True,  
          DisplayFunction -> Identity];
Show[GraphicsArray[{g1, g2}], ImageSize -> 504];

Sin[-1 - 2  I]  //  N

Example #3b

g1 = 
        PolarMap[Identity, {0, 1}, {-π + 0.00001, π},  
          PlotStyle -> Blue,  Frame -> True,  
          DisplayFunction -> Identity];
g2 = 
        PolarMap[Sin, {0, 1}, {-π + 0.00001, π}, 
          PlotStyle -> Red, Frame -> True,  
          DisplayFunction -> Identity];
Show[GraphicsArray[{g1, g2}], ImageSize -> 504];

Example#2: 1d to 2d

Function definition

f[z_] := Exp[z];

Magnitude plot

g1 = 
        Plot[Abs[f[Exp[I θ]]], {θ, 0, 2  π},  
          PlotStyle -> {Blue}];

Phase plot

g2 = 
        Plot[Arg[f[Exp[I θ]]], {θ, 0, 2  π}, 
          PlotStyle -> {Red}];

Show[GraphicsArray[{g1, g2}],  ImageSize -> 504];

Example#3: 1d to 2d

Function definition

f[z_] := Sqrt[z];

Magnitude plot

g1 = 
        Plot[Abs[f[Exp[I θ]]], {θ, 0, 2  π},  
          PlotStyle -> {Blue},  PlotRange -> {- .01, 2.01}, 
          Axes -> False];

Phase plot

g2 = 
        Plot[Arg[f[Exp[I θ]]], {θ, 0, 2  π}, 
          PlotStyle -> {Red}];

Show[GraphicsArray[{g1, g2}],  ImageSize -> 504];

Example#3: 1d to 2d

Function definition

f[z_] := Sin[z];

Magnitude plot

g1 = 
        Plot[Abs[f[Exp[I θ]]], {θ, 0, 2  π},  
          PlotStyle -> {Blue}];

Phase plot

g2 = 
        Plot[Arg[f[Exp[I θ]]], {θ, 0, 2  π}, 
          PlotStyle -> {Red}];

Show[GraphicsArray[{g1, g2}],  ImageSize -> 504];