MathGroup Archive 2006

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

Search the Archive

General--Plotting complex functions and branch cuts

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63853] General--Plotting complex functions and branch cuts
  • From: h.g.d.goyder at cranfield.ac.uk
  • Date: Thu, 19 Jan 2006 00:02:52 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Given that complex variables are used throughout physics and engineering, for example, for fluid flow, electrostatics, stress and in linear systems theory it seems to me that it is a pity there are so few methods for improving visualization. Below I give two examples where I plot on the complex plane using the natural nonrectangular, but orthogonal,  grid provided by complex numbers.  I  use modulus and argument (phase) as my two sets of grid lines. (Strictly it should be log modulus and argument but I think this makes little difference.) The plotting is spoilt by the branch cut introduced by plotting the argument. This is inevitable but I need a way to tidy this up. I wish to get rid of the bunch of contours located on the "cliff face" of the branch cut. Any ideas? The first function, f1, has two branch cuts introduced by the method I am using to get the argument contours. The second function, f2, has a natural branch cut that should be there and my method of plotting adds !
 tw!
o unwanted additional cuts. I also show that I can move my additional branch cuts, but leave the natural branch cut alone. I am not clear if this always works but it might be a way to identify branch cuts that are artifacts of the graphing method. I also raise the plots to give 3D representations using a method given by David Park in a previous MathGroup question. The nasty bunch of additional lines remain a problem.

Hugh Goyder


f1[z_] := 1/(1 + 0.1*I*z - z^2); 
f2[z_] := 1/(1 + 5*(I*z)^(3/2) - z^2); 

p1 = ContourPlot[Abs[f1[x + I*y]], {x, -2, 2}, 
{y, -1, 1}, AspectRatio -> 1/2, ContourShading -> False, 
    PlotPoints -> {100, 50}, Contours -> Table[h, {h, 0, 5, 0.5}]]; 

p2 = ContourPlot[Arg[f1[x + I*y]], {x, -2, 2}, {y, -1, 1},
 AspectRatio -> 1/2, ContourShading -> False, 
PlotPoints -> {100, 50}, Contours -> Table[h, {h, -Pi, Pi, Pi/10}]]; 

Show[p1, p2]; 

p3 = ContourPlot[Abs[f2[x + I*y]], {x, -1, 1}, {y, -1, 1}, 
AspectRatio -> 1, ContourShading -> False, 
PlotPoints -> {100, 100}, Contours -> Table[h, {h, 0, 5, 0.5}]]; 

p4 = ContourPlot[Arg[f2[x + I*y]], {x, -1, 1}, {y, -1, 1},
 AspectRatio -> 1, ContourShading -> False, 
 PlotPoints -> {100, 100}, Contours -> Table[h, {h, -Pi, Pi, Pi/10}]]; 

Show[p3, p4]; 

ClearAll[GetContourLines]; 
GetContourLines::usage = "GetContourLines[graphics]"; 
GetContourLines[gg_] := Module[{clines, clines2},
 clines = Cases[First[Graphics[gg]], Line[_], Infinity]; 
 clines2 = clines /. Line[{begin___List, a_List, b_List, end___List}]
  /;  Sqrt[(a - b) . (a - b)] < 1.*^-9 -> Line[{begin, end}] 
 /. Line[{}] -> Sequence[] /. Line[{a_}] -> Sequence[]; clines2]

c1 = GetContourLines[p1]; 
c2 = GetContourLines[p2]; 
c3 = GetContourLines[p3]; 
c4 = GetContourLines[p4]; 

Show[Graphics3D[{
c1 /. Line[b_] :> Line[b /. {x_, y_} :> {x, y, Abs[f1[x + I*y]]}], 
c2 /. Line[b_] :> Line[b /. {x_, y_} :> {x, y, Abs[f1[x + I*y]]}]}],
 BoxRatios -> {2, 1, 0.5}, Axes -> True, 
 PlotRange -> {All, All, {0, 5}},
 ViewPoint -> {-1.734, -2.386, 1.659}]; 

Show[Graphics3D[{
c3 /. Line[b_] :> Line[b /. {x_, y_} :> {x, y, Abs[f2[x + I*y]]}],
c4 /. Line[b_] :> Line[b /. {x_, y_} :> {x, y, Abs[f2[x + I*y]]}]}],
 BoxRatios -> {1, 1, 0.5}, Axes -> True, 
PlotRange -> {All, All, {0, 5}}, 
ViewPoint -> {-1.734, -2.386, 1.659}]; 

(* move the branch cuts by introducing a phase angle and then taking it away *)
p5 = ContourPlot[Arg[f2[x + I*y]*E^(I*(Pi/4))] - Pi/4,
{x, -1, 1}, {y, -1, 1},
 AspectRatio -> 1, ContourShading -> False, 
PlotPoints -> {100, 100},
Contours -> Table[h, {h, -Pi - 2*(Pi/10), Pi, Pi/10}]]; 

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=7724#p7724
Posted through http://www.mathematica-users.org [[postId=7724]]



  • Prev by Date: Re: question about matrix
  • Next by Date: Re: Re: JLink / VTK problem
  • Previous by thread: Re: NIntegrate and Plot
  • Next by thread: Re: General--Plotting complex functions and branch cuts