Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7053

Re: Complex diagram

From Chris Young <cy56@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Complex diagram
Date 2011-12-09 11:01 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jbspqs$3sl$1@smc.vnet.net> (permalink)
References <jbni9o$48v$1@smc.vnet.net>

Show all headers | View raw


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
 ]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Complex diagram 道 厚 <shlwell1988@gmail.com> - 2011-12-07 11:22 +0000
  Re: Complex diagram "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-12-08 10:23 +0000
  Re: Complex diagram Chris Young <cy56@comcast.net> - 2011-12-08 10:30 +0000
  Re: Complex diagram Simon <simonjtyler@gmail.com> - 2011-12-08 10:33 +0000
  Re: Complex diagram Chris Young <cy56@comcast.net> - 2011-12-09 11:01 +0000
  Re: Complex diagram DrMajorBob <btreat1@austin.rr.com> - 2011-12-10 12:31 +0000

csiph-web