5

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.

User3910
  • 2,390
  • 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. – User3910 Jul 20 '13 at 23:49
  • You might want to try another free CAS like Maxima (has online version too) or others at: http://en.wikipedia.org/wiki/List_of_computer_algebra_systems – 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
  • @Amzoti I don't know if you know this, but every part of Sage actually comes on its own with Sage. What I suggested was to use Maxima either directly inside Sage (as a engine) or on its own by typing "sage -maxima". – Pece Aug 10 '13 at 12:31
  • @Pece: Yes, I am aware that it is collection of other specialized CASes. This makes it a very powerful tool, but I find it rather cumbersome and think it has a horrible user interface. That is just my opinion, but I am perhaps spoiled by commercial products. Regards – Amzoti Aug 10 '13 at 12:34

5 Answers5

5

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

Mikasa
  • 67,374
3

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

f:=1/(1-(x+I*y)^2):  
plot3d(abs(f), x=-3..3, y=-3..3, color=argument(f), grid=[50,50]);
40 votes
  • 9,736
3

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.

$$\text{Re}\left(\frac{1}{1+z^2}\right)=\frac{1+x^2-y^2}{(1+x^2-y^2)^2+4x^2y^2}$$

$$\text{Im}\left(\frac{1}{1+z^2}\right)=\frac{-2xy}{(1+x^2-y^2)^2+4x^2y^2}$$

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

pshmath0
  • 10,565
2

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:

g=divide(1,add(1,pow(f,2)))

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

0

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

User3910
  • 2,390