1
$\begingroup$

This question already has an answer here:

I would like to visualize the complex function $f(z)=\dfrac{i-z}{i+z}$ by plotting the images of different horizontal lines in the upper half plane under this map.

With the following code

f[z_] := (I - z)/(I + z);
ParametricPlot[{Re[f[x + I*2]], Im[f[x + I*2]]}, {x, -100, 100}, 
 PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}]

I am able to plot the image of one horizontal line. How can I do it for multiple ones in one graph?


The following code makes the plot rather ugly:

ParametricPlot[{Re[f[x + I*y]], Im[f[x + I*y]]}, {x, -100, 100}, {y,0,4}
     PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}]

I'm wondering how I can plot it for "discrete" range: e.g. {y,{0,1,2,3,3.5}}.

I have also read a related question Image of first quadrant under $f(z)=(z+i)/(z-i)$, the answers of which seem not to be very helpful here.

$\endgroup$

marked as duplicate by Artes, m_goldberg plotting Sep 16 '17 at 23:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ The related question mentioned in the OP doesn't seem to be very helpful here however another post mentioned in the link certainly does answer your question Plotting complex numbers as an Argand Diagram $\endgroup$ – Artes Sep 16 '17 at 15:03
  • $\begingroup$ @Artes: That's for discrete points. Do you have a comment for how to generalize it for several lines? $\endgroup$ – Jack Sep 16 '17 at 15:11
  • $\begingroup$ Read carefully this answer, there I draw images of lines under an analogous mapping, just substitute your mapping and that'll be done. $\endgroup$ – Artes Sep 16 '17 at 15:21
  • $\begingroup$ @Artes: Thanks for pointing that out. It is much more advanced than I expected. I thought there could be a quick fix of my code to get what I want. Anyway, I'm still slowly reading your answer. I shall come back later when I figure out what's really going on: the animation there is impressed!! $\endgroup$ – Jack Sep 16 '17 at 15:39
2
$\begingroup$

You can use your code to plot multiple versions using Show. Here it is over the range 1 to 8.

f[z_] := (I - z)/(I + z);
Show[ParametricPlot[{Re[f[x + I*#]], Im[f[x + I*#]]}, {x, -100, 100}, 
    PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}] & /@ Range[1, 8]]

enter image description here

If you are finding the Map/Slot confusing, you can accomplish the same thing using Table:

Show[Table[ParametricPlot[{Re[f[x + I*i]], Im[f[x + I*i]]}, {x, -100, 100}, 
   PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}}], {i, 1, 8}]]
$\endgroup$
  • $\begingroup$ Thanks a lot. This is very helpful! I'm trying to fully understand your code. Would you elaborate what & /@ Range[1, 8] does? (I can see that Range[1,8] gives an array from 1 to 8.) $\endgroup$ – Jack Sep 16 '17 at 16:23
  • 1
    $\begingroup$ Look up Map (for which /@ is the shortcut) and Slot. Basically, the Slot # is filled with each element of the Range (i..e, the slotted variable is mapped over the range). The symbol & is needed to indicate the completion of the Slot. $\endgroup$ – bill s Sep 16 '17 at 16:26

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