MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Complex diagram

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123504] Re: Complex diagram
  • From: Chris Young <cy56 at comcast.net>
  • Date: Fri, 9 Dec 2011 05:56:35 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jbni9o$48v$1@smc.vnet.net>

On 2011-12-07 11:22:32 +0000, é?? å?? said:

> Can we draw complex funtions's diagram in Mathematica?
> 
> For example, draw the picture of z=2*x+I*3*y

Finally got something fast and sharp for complex functions, using 
Plot3D and a stepped color function. The trick is to remember that the 
number of mesh lines is one less than the number of contours. Only then 
will the colors be correspond to the mesh, and, for some reason, 
they're more sharply discretized.

http://home.comcast.net/~cy56/Sharp3DComplexPlots.nb
http://home.comcast.net/~cy56/Sharp3DComplexPlots.png

f[1][z_] := z;
f[2][z_] := 3 Re[z] + 2 Im[z] I;
f[3][z_] := Cos[z];
f[4][z_] := Sin[z];

f[5][z_] := z^2;
f[6][z_] := (3 Re[z] + 2 Im[z] I)^2;
f[7][z_] := Cosh[z];
f[8][z_] := Sinh[z];

GraphicsGrid[
 Partition[
  Table[
   Plot3D[
    Abs[f[k][x + y I]],

    {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]},

    AxesLabel -> {"x", "y", "z"},
    PlotRange -> {{-\[Pi], \[Pi]}, {-\[Pi], \[Pi]}, {0, 2 \[Pi]}},
    PlotPoints -> 80,
    MaxRecursion -> 2,
    BoxRatios -> 1,
    Mesh -> 11,
    MeshFunctions -> {
      ( {x, y} \[Function] Abs[f[k][x + y I]]),
      ( {x, y} \[Function] Arg[f[k][x + y I]])
      },
    ColorFunctionScaling -> False,
    ColorFunction -> ({x, y} \[Function]
       Hue[\[LeftFloor]12 (Arg[f[k][x + y I]] + \[Pi])/(
          2 \[Pi])\[RightFloor]/12, 0.5, 1])
    ],
   {k, 1, 8}
   ],
  4
  ],
 ImageSize -> 72*16
 ]


For 2D, ContourPlot works best, with the modulus contours drawn in via 
a mesh function. Only one problem, the Sinh function is coming in at 
lower resolution than the others for some reason.

http://home.comcast.net/~cy56/Sharp2DComplexPlots.nb
http://home.comcast.net/~cy56/Sharp2DComplexPlots.png

f[1][z_] := z;
f[2][z_] := 3 Re[z] + 2 Im[z] I;
f[3][z_] := Cos[z];
f[4][z_] := Sin[z];

f[5][z_] := z^2;
f[6][z_] := (3 Re[z] + 2 Im[z] I)^2;
f[7][z_] := Cosh[z];
f[8][z_] := Sinh[z];

GraphicsGrid[
 Partition[
  Table[
   ContourPlot[
    Arg[f[k][x + y I]],  {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]},

    Contours -> 11,

    ColorFunctionScaling -> False,
    ColorFunction -> (arg \[Function]
       Hue[0.9 (arg + \[Pi])/(2 \[Pi]), 0.5, 1]),

    Mesh -> 11,
    MeshFunctions -> ( {x, y} \[Function] Abs[f[k][x + y I]]),

    PlotRange -> {{-\[Pi], \[Pi]}, {-\[Pi], \[Pi]}},
    PlotPoints -> 40,
    MaxRecursion -> 2,
    BoxRatios -> 1
    ],
   {k, 1, 8}
   ],
  4
  ],
 ImageSize -> 72*16
 ]




  • Prev by Date: Findminimum too slow for iterative reweighted least squares
  • Next by Date: Dynamics activity "drainage"
  • Previous by thread: Re: Complex diagram
  • Next by thread: Re: Complex diagram