BeginPackage["Plot`", {"Useful`"}] PlotComplex::usage = "PlotComplex[f, {z, zmin, zmax}] generates a three-dimensional plot of f as a function of the complex variable z, where the x- and y-axes of the plot correspond to the real and imaginary portions of z." PlotComplex2::usage = "PlotComplex2[f, {z, zmin, zmax}] generates two three-dimensional plots: one of Abs[f], one of Arg[f]. In both cases the x- and y-axes correspond to the real and imaginary portions of z." PlotComplexR::usage = "PlotComplexR[f, {z, zmin, zmax}] generates two three-dimensional plots: one of Re[f], one of Im[f]. In both cases the x- and y-axes correspond to the real and imaginary portions of z." ContourComplex::usage = "ContourComplex[f, {z, zmin, zmax}] generates a contour plot of f as a function of the complex variable z, where the x- and y-axes of the contour plot correspond to the real and imaginary portions of z." ParametricComplex::usage = "ParametricComplex[z, {t, tmin, tmax}] generates a parametric plot (on the complex plane) of z as a function of t." TrimComplex::usage = "TrimComplex[z, {t, tmin, tmax}, r] generates a parametric plot on the complex plane, where x and y range from -r to r. The endpoints tmin and tmax are trimmed to fit inside the given plot." Begin["`Private`"] Clear[PlotComplex] PlotComplex[f_, {z_, zmin_, zmax_}, p___] := Module[{x, y}, Plot3D[f /. z -> (x + y I), {x, Re[zmin], Re[zmax]}, {y, Im[zmin], Im[zmax]}, p]] Clear[PlotComplex2] PlotComplex2[f_, z_, p___] := {PlotComplex[Abs[f], z, PlotLabel->"Abs", p], PlotComplex[Arg[f], z, PlotLabel->"Arg", p]} Clear[PlotComplexR] PlotComplexR[f_, z_, p___] := {PlotComplex[Re[f], z, PlotLabel->"Re", p], PlotComplex[Im[f], z, PlotLabel->"Im", p]} Clear[ContourComplex] ContourComplex[f_, {z_, zmin_, zmax_}, p___] := Module[{x, y}, ContourPlot[f /. z -> (x + y I), {x, Re[zmin], Re[zmax]}, {y, Im[zmin], Im[zmax]}, p]] Clear[ParametricComplex] ParametricComplex[f_, t_, p___] := ParametricPlot[Evaluate[MapList[{Re[#], Im[#]}&, f]], t, AspectRatio->Automatic, p] Clear[TrimComplex] TrimComplex[f_, {t_, tmin_, tmax_}, tr_, p0___] := Let[{Fix = Fn[pt, Let[{pf = Switch[pt, Infinity, 1000, -Infinity, -1000, _, pt], tt = Sqrt[2] * tr}, If[N[Abs[pf] <= tt], pf, t /. FindRoot[Abs[f] == tt, {t, pf, pf+Random[]}]] ]]}, ParametricComplex[f, {t, Fix[tmin], Fix[tmax]}, p0, PlotRange->{{-tr, tr}, {-tr, tr}}]] End[] EndPackage[]