Following this guide to Sage: and using Sage Online produced the following graphs:

Graphing $\frac{1}{1-z}$ that way yeilds:

enter image description here

Graphing $\frac{1}{1-z^2}$ that way yields:

enter image description here

It would be nice to see it in 3D instead of merely color coded. The y-axis is coming out of the picture toward us and instead of seeing the 3D surface (in x,y,i coordinates) we see a color-graph on the x-i plane.

  • Does it have to be done in Sage? – Amzoti Jul 20 '13 at 23:36
  • @Amzoti It would be much preferred if it were to use a free software program such as octave or SAGE. – Dale Jul 20 '13 at 23:49
  • You might want to try another free CAS like Maxima (has online version too) or others at: – Amzoti Jul 20 '13 at 23:51
  • @Amzoti Maxima is a part of Sage. Actually, I think it even internally calls Maxima for formal computation. – Pece Aug 10 '13 at 11:22
  • @Pece: Many pieces make up SAGE, but Maxima is just one of the engines, there are many others. You call the one you want for the specific function you want. Maxima is a standalone program and does not need SAGE. Regards – Amzoti Aug 10 '13 at 12:01
up vote 3 down vote accepted

You can understand complex functions better by expanding in terms of real variables. For example, let's take a look at the function $$\frac{1}{1+z^2}$$ by letting $z=x+iy$, where $x$ and $y$ are real. Then $$\frac{1}{1+(x+iy)^2}=\frac{1}{1+x^2-y^2+2xyi}=\frac{1+x^2-y^2-2xyi}{(1+x^2-y^2)^2+4x^2y^2},$$ where we have multiplied numerator and denominator of the middle expression by the complex conjugate of the denominator to make the denominator purely real. You can then separate to obtain $$\frac{1}{1+z^2}=\frac{1+x^2-y^2}{(1+x^2-y^2)^2+4x^2y^2}-i\frac{2xy}{(1+x^2-y^2)^2+4x^2y^2}.$$

Notice how the complex function is broken into real and imaginary components.



ADDED BY OTHER USER: AntonioVargas shared the following plot from Mathematica of $\text{Re}(1/(1+z^2))$ colored according to $\text{Im}(1/(1+z^2))$:

enter image description here

However it is just as easy to graph it in Wolfram Alpha

The graph the Re(1/(1+z^2) on Wolfram Alpha!

enter image description here

Also the 3D plot of the imaginary component.

enter image description here

This is the codes in which you can visualize the complex functions in Maple's environment:

  [> with(plots):
  [> f := z-> 1/(1-z):
     g:=z-> 1/(1-z^2):
  [> complexplot3d(f, -2-2*I .. 2+2*I);
     complexplot3d(g, -2-2*I .. 2+2*I);

enter image description here

enter image description here

  • Very nice graphs! I'm convinced the NSF or something should fund an open-source version like Sage... ok I just don't want to pay for Maple... – Dale Jul 20 '13 at 23:40
  • I agree, awesome graphs: and the colors of a rainbow! – amWhy Jul 21 '13 at 0:11
  • @amWhy: Thanks Amy. – mrs Jul 21 '13 at 6:55
  • 1
    @BabakS.: Ditto, nice graphics! +1 – Amzoti Jul 21 '13 at 12:44

To the best of my knowledge, Sage at present does not offer 3d plots with color determined by a function. (But I'm not a Sage expert like those who inhabit ask Sage Q&A site.) As Babak S. pointed out, Maple does the job, for those who have access to it. However, I think the following picture (made with a different Maple command) looks nicer:

enter image description here

plot3d(abs(f), x=-3..3, y=-3..3, color=argument(f), grid=[50,50]);
  • Thanks for the "ask Sage" link. – Dale Jul 20 '13 at 23:44
  • Asked on the "ask Sage" site: – Dale Jul 20 '13 at 23:50

I wrote a little something in three.js/webgl to do this.

enter image description here

It allows you to choose how to map your 4 available complex axes to X,Y,Z and color gradient.

It is using math.js, so to express formulas you need to call the appropriate math.js functions which isn't so elegant, but it works. E.g. for

$$ \frac{1}{1+z^2} $$

you write:


Free, no install of anything required. Sharable. Just a hobby project, but might be useful. Some other examples here.

The simplest way is to merely replace z with "x+iy" and hit enter in wolfram alpha:

$$ 1/(1+(x+iy)^2)$$

or for 1/(1-(x+iy)^2)

1/(1-x^2+y^2-2xyi) times

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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