5
$\begingroup$

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.

$\endgroup$
7
  • $\begingroup$ Does it have to be done in Sage? $\endgroup$
    – Amzoti
    Jul 20, 2013 at 23:36
  • $\begingroup$ @Amzoti It would be much preferred if it were to use a free software program such as octave or SAGE. $\endgroup$
    – User3910
    Jul 20, 2013 at 23:49
  • $\begingroup$ You might want to try another free CAS like Maxima (has online version too) or others at: en.wikipedia.org/wiki/List_of_computer_algebra_systems $\endgroup$
    – Amzoti
    Jul 20, 2013 at 23:51
  • $\begingroup$ @Amzoti Maxima is a part of Sage. Actually, I think it even internally calls Maxima for formal computation. $\endgroup$
    – Pece
    Aug 10, 2013 at 11:22
  • $\begingroup$ @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 $\endgroup$
    – Amzoti
    Aug 10, 2013 at 12:01

5 Answers 5

5
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ 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... $\endgroup$
    – User3910
    Jul 20, 2013 at 23:40
  • $\begingroup$ I agree, awesome graphs: and the colors of a rainbow! $\endgroup$
    – amWhy
    Jul 21, 2013 at 0:11
  • $\begingroup$ @amWhy: Thanks Amy. $\endgroup$
    – Mikasa
    Jul 21, 2013 at 6:55
  • 1
    $\begingroup$ @BabakS.: Ditto, nice graphics! +1 $\endgroup$
    – Amzoti
    Jul 21, 2013 at 12:44
3
$\begingroup$

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

$\endgroup$
0
3
$\begingroup$

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]);
$\endgroup$
2
  • $\begingroup$ Thanks for the "ask Sage" link. $\endgroup$
    – User3910
    Jul 20, 2013 at 23:44
  • $\begingroup$ Asked on the "ask Sage" site: $\endgroup$
    – User3910
    Jul 20, 2013 at 23:50
2
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .