Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6990 > unrolled thread
| Started by | 道 厚 <shlwell1988@gmail.com> |
|---|---|
| First post | 2011-12-07 11:22 +0000 |
| Last post | 2011-12-10 12:31 +0000 |
| Articles | 6 — 5 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
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
| From | 道 厚 <shlwell1988@gmail.com> |
|---|---|
| Date | 2011-12-07 11:22 +0000 |
| Subject | Complex diagram |
| Message-ID | <jbni9o$48v$1@smc.vnet.net> |
Can we draw complex funtions's diagram in Mathematica? For example, draw the picture of z=2*x+I*3*y
[toc] | [next] | [standalone]
| From | "Dr. Wolfgang Hintze" <weh@snafu.de> |
|---|---|
| Date | 2011-12-08 10:23 +0000 |
| Message-ID | <jbq379$if2$1@smc.vnet.net> |
| In reply to | #6990 |
You can easily plot real quantities which are function of complex
variables as for instance Abs[], Re[], Im[] like this
f[x_, y_] := 2*x + 3*I*y
Plot3D[Abs[f[x, y]], {x, -2, 2}, {y, -2, 2}];
Plot3D[Re[f[x, y]], {x, -2, 2}, {y, -2, 2}];
Plot3D[Im[f[x, y]], {x, -2, 2}, {y, -2, 2}];
Regards,
Wolfgang
"? ?" <shlwell1988@gmail.com> schrieb im Newsbeitrag
news:jbni9o$48v$1@smc.vnet.net...
> Can we draw complex funtions's diagram in Mathematica?
>
> For example, draw the picture of z=2*x+I*3*y
>
[toc] | [prev] | [next] | [standalone]
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Date | 2011-12-08 10:30 +0000 |
| Message-ID | <jbq3l0$inr$1@smc.vnet.net> |
| In reply to | #6990 |
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
This isn't an analytic function, which boils down to the fact that it's
not a mapping that preserves angles. So the two sets of contour lines
below won't be perpendicular. Note that if we just use z as the
variable, we'll be guaranteed an analytic function.
http://mathworld.wolfram.com/AnalyticFunction.html
Calculus and Analysis > Complex Analysis > General Complex Analysis >
Analytic Function
A complex function is said to be analytic on a region if it is complex
differentiable at every point in . The terms holomorphic function,
differentiable function, and complex differentiable function are
sometimes used interchangeably with "analytic function" (Krantz 1999,
p. 16). Many mathematicians prefer the term "holomorphic function" (or
"holomorphic map") to "analytic function" (Krantz 1999, p. 16), while
"analytic" appears to be in widespread use among physicists, engineers,
and in some older texts (e.g., Morse and Feshbach 1953, pp. 356-374;
Knopp 1996, pp. 83-111; Whittaker and Watson 1990, p. 83).
If a complex function is analytic on a region , it is infinitely
differentiable in . A complex function may fail to be analytic at one
or more points through the presence of singularities, or along lines or
line segments through the presence of branch cuts.
A complex function that is analytic at all finite points of the complex
plane is said to be entire. A single-valued function that is analytic
in all but possibly a discrete subset of its domain, and at those
singularities goes to infinity like a polynomial (i.e., these
exceptional points must be poles and not essential singularities), is
called a meromorphic function.
f[x_, y_] := 2 x + 3 y I
g[z_] := ((2 + 3)/2) z
Column[{
Row[{
ContourPlot[
Arg[f[x, y]],
{x, -2, 2}, {y, -2, 2},
ColorFunction -> (f \[Function] Hue[f, 0.5, 1]),
Contours -> 11],
ContourPlot[
Abs[f[x, y]],
{x, -2, 2}, {y, -2, 2},
Contours -> 10
]
}],
Row[{
ContourPlot[
Arg[g[x + y I]],
{x, -2, 2}, {y, -2, 2},
ColorFunction -> (f \[Function] Hue[f, 0.5, 1]),
Contours -> 11],
ContourPlot[
Abs[g[x + y I]],
{x, -2, 2}, {y, -2, 2},
Contours -> 10
]
}]
}]
For a 3D plot of the modulus:
ContourPlot3D[
z - Abs[f[x, y]] == 0,
{x, -2, 2}, {y, -2, 2}, {z, 0, 4},
MeshFunctions -> {({x, y, z} \[Function]
z), ( {x, y, z, f} \[Function] f)}
]
[toc] | [prev] | [next] | [standalone]
| From | Simon <simonjtyler@gmail.com> |
|---|---|
| Date | 2011-12-08 10:33 +0000 |
| Message-ID | <jbq3p0$ip3$1@smc.vnet.net> |
| In reply to | #6990 |
There was some discussion of this at http://stackoverflow.com/questions/5385103/plot-a-complex-function-in-mathematica
[toc] | [prev] | [next] | [standalone]
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Date | 2011-12-09 11:01 +0000 |
| Message-ID | <jbspqs$3sl$1@smc.vnet.net> |
| In reply to | #6990 |
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
]
[toc] | [prev] | [next] | [standalone]
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-12-10 12:31 +0000 |
| Message-ID | <jbvjfi$iuv$1@smc.vnet.net> |
| In reply to | #6990 |
I would use Set, not SetDelayed, and pre-compute Arg and Abs where
possible:
Clear[f, abs, arg, simple]
simple[expr_] :=
ComplexExpand@FullSimplify[expr, {-Pi < x < Pi, -Pi > y < Pi}];
f[1][x_, y_] = x + I y;
f[2][x_, y_] = 3 x + 2 y I;
f[3][x_, y_] = Cos[x + I y] // simple;
f[4][x_, y_] = Sin[x + I y] // simple;
f[5][x_, y_] = (x + I y)^2 // simple;
f[6][x_, y_] = (3 x + 2 y I)^2 // simple;
f[7][x_, y_] = Cosh[x + I y] // simple;
f[8][x_, y_] = Sinh[x + I y] // simple;
Do[abs[k][x_, y_] = f[k][x, y] // Abs // simple;
arg[k][x_, y_] = f[k][x, y] // Arg // simple, {k, 1, 8}]
GraphicsGrid[
Partition[
Table[Plot3D[abs[k][x, y], {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[k][x, y]), ({x, y} \[Function] arg[k][x, y])},
ColorFunctionScaling -> False,
ColorFunction -> ({x, y} \[Function]
Hue[\[LeftFloor]12 (arg[k][x,
y] + \[Pi])/(2 \[Pi])\[RightFloor]/12, 0.5, 1])], {k,
1, 8}], 2], ImageSize -> 72*16]
I can't say the speed improvement is tremendous, however!
Bobby
On Fri, 09 Dec 2011 04:56:35 -0600, Chris Young <cy56@comcast.net> wrote:
> 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
> ]
>
>
--
DrMajorBob@yahoo.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web