Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm able to plot the region where Im[z] > 0 and Re[z] > 0:

RegionPlot[Re[x + I y] > 0 && Im[x + I y] > 0, {x, -2, 2}, {y, -2, 2}]

But now I'd like to apply the function $f(z)=(z+i)/(z-i)$ to this region and view the result. Can you give me suggestions?

share|improve this question
This is closely related to another question, see this answer mathematica.stackexchange.com/questions/15637/… –  Artes Mar 5 '13 at 9:03
Although this extra link is amazing, I don't think it is a duplicate, because I am asking for a technique on how to "shade" the image of the region under the mapping $f(z)$. –  David Mar 5 '13 at 19:31
I agree; this is the transformation of a region, and not the plotting of a curve in the complex plane. –  J. M. May 3 '13 at 14:26
add comment

6 Answers

You can use reciprocal to avoid $\infty$ points:

      Through[{Re, Im}[(x + y I + I)/(x + y I - I) /. {x -> x^#1, y -> y^#2}]]] & @@@ 
    Flatten[Outer[List, {1, -1}, {1, -1}], 1]
   ], {x, 0, 1}, {y, 0, 1}, PlotRange -> {{-3, 3}, {-.5, 4}}] // Quiet

domain map

share|improve this answer
+1: correct, informative, detailed, and rather pretty, too! –  whuber May 5 '13 at 17:37
@whuber Thanks! I like your InverseFunction method! –  Silvia May 5 '13 at 17:44
add comment

Since a complex function is involved, it seems natural to use plotting functions that treat complex objects directly, without having to overtly separate them into real and imaginary parts. David Park's Presentations add-on (http://home.comcast.net/~djmpark/DrawGraphicsPage.html) allows this:

<< Presentations`

With[{f = Function[z, (z + I)/(z - I)],
      zmin = -(1 + I), zmax = (1 + I)},
      grid = DrawCartesianMap[z, {z, 0, 2 zmax}, Mesh -> {12, 12}, 
             PlotPoints -> 60, MaxRecursion -> 5, 
             BoundaryStyle -> Directive[Thick, Black, Dashed], 
             MeshStyle -> {{Thickness[0.0065], HTML@DarkGreen}, 
                           {Thickness[0.0065], Darker@Brown}}];
      domainObjects = {Opacity[0.5, HTML@Wheat], grid};
      imageObjects = ComplexMap[f][domainObjects];
                  PlotRange -> ComplexPlotRange[0.5 zmin, 2 zmax], Frame -> True, 
                  PlotLabel -> z, ImageSize -> Scaled[0.3], BaseStyle -> 12],
           Draw2D[{Arrowheads[.3], NeedhamMappingSymbol[0, 1]},
                   PlotRange -> All, ImageSize -> Scaled[0.05]],
                   PlotRange -> ComplexPlotRange[-5 - I, 5 zmax], Frame -> True, 
                   PlotLabel -> f[z], ImageSize -> Scaled[0.3], BaseStyle -> 12]
          Spacer[5], ImageSize -> 720]

enter image description here

share|improve this answer
The SE uploader isn't fixed yet, but you can always upload images "old school" style — save as png and use the upload image button in the post editor –  rm -rf May 4 '13 at 15:46
@rm -rf: As you can see, I did manage to upload a png now. I had completely forgotten about the image uploader built into the editor window. –  murray May 4 '13 at 21:47
I fully understand how that must be... I too have gotten quite used to the uploader and grumble when I have to take the long route :) –  rm -rf May 4 '13 at 22:41
add comment

I like all the existing answers because they reveal the nature of this map--but they are all deceiving. The problem is that they miss obvious and important parts of the region that cannot easily be drawn parametrically because they are associated with extremely large values of $x$ and $y$.

Here is a simple solution that is natural in the sense that it directly expresses the original question in a standard mathematical way.

region[z_] := Re[z] > 0 && Im[z] > 0; (* The original region *)
f[z_] := (z + I) / (z - I);           (* The map *)
g = InverseFunction[f];               (* Its inverse *)
RegionPlot[region[g[x + I y]], {x, -2, 2}, {y, -2, 2}]

enter image description here

share|improve this answer
add comment

When your region is that simple, than you could sample it manually creating complex points inside it. Following the approach here simple Line's created from the complex points to the job too.

Please note the Listable attribute to make an application of functions on lists and matrices possible. With this you can then write complexToPoint@f@pts although both functions work on the complex points inside the matrix pts only.

pts = Table[i + I j, {j, 0.5, 2, .05}, {i, 0.5, 2, .05}];

SetAttributes[complexToPoint, {Listable}];
complexToPoint[z_?NumericQ] := {Re[z], Im[z]};

SetAttributes[f, {Listable}];
f[z_?NumericQ] := (z + I)/(z - I)

Graphics[{RGBColor[38/255, 139/255, 14/17], 
  Line[complexToPoint@f@pts], RGBColor[133/255, 3/5, 0], 

Mathematica graphics

share|improve this answer
I like the colors :), +1 –  einbandi Mar 5 '13 at 16:32
This is how CartesianMap[] in the old Graphics`ComplexMap` package was done. –  J. M. May 3 '13 at 14:28
add comment
plots=ContourPlot[#@((x + I y + I)/(x + I y - I)), {x, 0, 2}, {y, 0, 2}, 
   PlotLabel -> #] & /@ {Re, Im, Abs}

enter image description here

Or showing the plots inside the RegionPlot you provided:

    Re[x + I y] > 0 && Im[x + I y] > 0, {x, -2, 2}, {y, -2, 
     2}], #] & /@ plots

enter image description here

share|improve this answer
add comment

I like ParametricPlot for visualizing domain mappings:

f[z_] := (z + I)/(z - I);
 {Re@#, Im@#} &@f[x + I y]
 , {x, 0, 5}, {y, 0, 5}]


You can use this interactive example to get more clarity what is mapped where:

 {Graphics[Point[pt], PlotRange -> {{0, 5}, {0, 5}}, Axes -> True, 
   GridLines -> Automatic],
  Show[pp, Epilog -> Point[{Re@#, Im@#} &@f[Complex @@ pt]]]}
 , {{pt, {1, 1}}, Locator}]

It's a bit sluggish, not sure if anything can be done about that without rasterizing and adding a bunch of ugly code.

Here is some code you might enjoy

share|improve this answer
I believe the answer should be that everything in the upper half plane outside of the upper half of the unit circle should be shaded. I was able to more close approximate the answer with PlotRange->2. –  David Mar 5 '13 at 19:23
When one draw these types of plots, they can be very confusing at first glance. If you have some knowledge of what to expect beforehand, then you can sort of figure out what you are looking at. However, that's not really the case if you don't have advanced knowledge. One thing that would be helpful is if you could do a side-by-side plot, the first of z, the second of f[z]. If you could color the four borders of z in four different colors, then match the borders in f[z] with the same corresponding colors, that would be really helpful. –  David Mar 5 '13 at 19:26
The difficulty in this drawing is the fact that you will have to take the domain out to infinity in order to get the right shading of the image region under f[z]. I wonder if anyone has any thoughts or strategies on that. I try the following, but that fixes up the end a bit but messes up the beginning: f[z_] := (z + I)/(z - I); pp = ParametricPlot[{Re@#, Im@#} &@f[x + I y], {x, 0, 50}, {y, 0, 50}, PlotRange -> 2] –  David Mar 5 '13 at 19:29
The Manipulate example is outstanding. This really helps one explore properly the region. Is there a way to make the result a little larger? It's a little to small for my old eyes. –  David Mar 5 '13 at 19:32
@David You can plot how some lines are mapped ParametricPlot[ {Re@#, Im@#} & /@ {f[I t], f[t], f[5 + I t], f[t + I 5]} , {t, 0, 50}, PlotRange -> 2, Evaluated -> True] (and corresponding lines in domain) I think you need to supply ImageSize->400 to both Graphics and Show to make it bigger –  ssch Mar 5 '13 at 19:43
show 1 more comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.