Complex Numbers in Mathematica

Author :  Thomas Shores
University of Nebraska
Send comments to :  
        tshores@math . unl . edu

Arithmetic

Mathematica will automatically do complex arithmetic for you.   The important point to remember is that the number  "i"  is denoted by  "I"  in Mathematica.  For example, try the following cell:

(2 + 3 I) - (7 - 6 I)

Now  consider the following problem:  Solve for the unknown  z  in the equation:

	(3 - 2 i) z = (2 + 4 i).
	
Clearly, the answer is z = (3 - 2 i) / (2 + 4 i).  But  this isn't satisfactory.  (Why?)  Mathematica knows the answer.  Activate the following cell:

z = (2 + 4 I ) / (3 - 2 I)

How could you get this answer by hand ??

Mathematica will even do some exotic stuff like the following:

Sin[z]

N[Sin[z]]

z^3-2 z^2 + 2 + 3 I

More handles on complex numbers

Here are two good tools  to apply to the complex number 

	z = x + y i ,  where x, y are reals.

The  absolute value  or  modulus  of  z  is the non-negative real number

	| z |   =   Sqrt [x2 + y2].
	
Mathematica is aware of this  idea,  as well as the idea of real and imaginary parts of z ...

z = 3 + 4 I

Abs[z]

Re[z]

Im[z]

Here is another important concept::  the  (complex)  conjugate of a complex number  z  is given by
	_
	z  =  x - y i.

Again, Mathematica knows about this...

Conjugate[z]

There  are a few useful laws of arithmetic that these operations satisfy.  Let  z,  z1  and z2  be any three complex numbers.  Then:

	| z1 z2 |  =  | z1 | | z2 |
	| z1 + z2 |   ≤  | z1 |  +  | z2 |
	         2           _
	 |  z  |       = z  z  
	_______        __      __
	 z1 + z2         z1  +  z2
	
	_____       __   __
	z1  z2   =  z1   z2
	
We can check these laws with Mathematica in specific examples.  Here is one law.   Try the others  yourself.

z1 = 4 - 7 I

z2 = 3 + 2 I

Conjugate[z1 z2]

Conjugate[z1] Conjugate[z2]

About the Fundamental Theorem of Algebra (FTOA) ...

Remember what it says:
FTOA:  Any non-constant polynomial in the variable  z  with complex coefficients has a root 
               in the (field of)  complex numbers.

Try solving this polynomial equation:
		
		z2 + z + 1 + i = 0.

Mathematica knows how ... but actually, you can do better by hand.

Clear[z]

Solve[z^2 + z + 1 + I == 0, z]

Let's consider the problem of solving a fairly simple high degree polynomial equation of the form
			zn = a, 
where  a  is a given complex number.  Mathematica already knows how.  For example:

Clear[z]

n=3

solns = Solve[z^n == 1, z]

rules = N[solns]

Just to see what these points look like, let's graph them and then do a dot-to-dot::

roots = Table[{Re[z /. rules[[ii]]], Im[z /. rules[[ii]]]},
{ii,1,n}]

roots=Append[roots,First[roots]]

ListPlot[roots,PlotJoined->True,AspectRatio->1]

Now go back and experiment with this sequence of cells a bit..  Change the degree.

Actually, we can get a little more satisfying answer by hand if we use a tool known as the polar form of a complex number.  Write, for a real number t, 
	
			e it = cos t  + i sin t

so that every complex number z = x + i y can be written in the form
			z = r e it,
where  r = | z |  and  t  is really the polar angle for the point  z  in the plane.  We'll continue discussion of this in class, where I will give serveral assignments to be done on the computer (most easily done by recycling some cells in this notebook).

Exercises

1. (fill in later)