Return to computing page for the second course APMA0340
Return to computing page for the fourth course APMA0360
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to Mathematica tutorial for the fourth course APMA0360
Return to the main page for the course APMA0330
Return to the main page for the course APMA0340
Return to the main page for the course APMA0360
Glossary
Preface
Complex numbers were introduced by the Italian famous gambler and mathematician Gerolamo Cardano (15011576) in 1545 while he found the explicit formula for all three roots of a cube equation. Many mathematicians contributed to the full development of complex numbers. The rules for addition, subtraction, multiplication, and division of complex numbers were developed by the Italian mathematician Rafael Bombelli (baptized on 20 January 1526; died 1572). The notations 1 and i for unit vectors in horizontal positive direction and vertical positive direction, respectively, were introduced by Leonhard Euler (17071783) who visualized complex numbers as points with rectangular coordinates, but did not give a satisfactory foundation for complex numbers theory. He also suggested to drop the unit vector 1 in presenting vectors on the plane. It was Carl Friedrich Gauss (17771855) who introduced the term complex number. Cauchy, a French contemporary of Gauss, extended the concept of complex numbers to the notion of complex functions. Professor Orlando Merino (born in 1954) from the University of Rhode Island has written an essay on the history of the discovery of complex numbers.
Complex numbers
Complex numbers can be identified with three sets: the set of points on the plane (denoted by ℝ²), set of all (free) vectors on the plane, and the set of all ordered pairs of real numbers z = (x,y). In the latter set, the first coordinate of z = (x,y) is denoted by ℜz = x (or Rez) and is called, for historical reasons, the real part of complex number z, while the second coordinate is denoted by ℑ ℜz = y (or Imzz. A geometric plot of complex numbers as points z = x + jy using the xaxis as the real axis and yaxis as the imaginary axis is referred to as an Argand diagram. This geometric plot is named after JeanRobert Argand (1768–1822), who introduced it in 1806, although it was first described by Norwegian–Danish land surveyor and mathematician Caspar Wessel (1745–1818).
The set of complex numbers is one of the three sets above equipped with arithmetic operations (addition, subtraction, multiplication, and division) that satisfy the usual axioms of real numbers. While addition and subtraction are inherited from vector algebra, multiplication and division satisfy specific rules based on the identity j² = 1.
For a long time it was thought that complex numbers were just toys invented and played with only by mathematicians. After all, no single quantity in the real world can be measured by an imaginary number, a number that lives only in the imagination of mathematicians. However, in 1926, Erwin Schrödinger (18871961) discovered that in the language of the world of the subatomic particles, complex numbers were the indispensable alphabet. Although no single measurable physical quantity corresponds to a complex number, a pair of physical quantities can be represented very naturally by a complex number. For instance, a wave, which always consists of an amplitude and a phase, begs a representation by a complex number.
vector = Graphics[{Black, Arrowheads[0.1], Thickness[0.01],
Arrow[{{0, 0}, {2, 1}}]}];
conjugate = Graphics[{Red, Arrowheads[0.1], Thickness[0.01], Arrow[{{0, 0}, {2, 1}}]}]; ax = Graphics[{Black, Arrowheads[0.05], Thick, Arrow[{{0, 0}, {2.2, 0}}]}]; ay = Graphics[{Black, Arrowheads[0.05], Thick, Arrow[{{0, 1}, {0, 1.2}}]}]; txtj = Graphics[ Text[Style["j", Bold, FontSize > 18, Blue], {1.91, 1.06}]]; txtC = Graphics[ Text[Style["z = a+b", FontSize > 18, Blue], {1.7, 1.06}]]; txtjc = Graphics[ Text[Style["j", Bold, FontSize > 18, Purple], {1.82, 1.06}]]; txtCC = Graphics[ Text[Style["ab", FontSize > 18, Purple], {1.7, 1.06}]]; tx = Graphics[ Text[Style["Re z", Bold, FontSize > 18, Blue], {2.02, 0.1}]]; ty = Graphics[ Text[Style["Im z", Bold, FontSize > 18, Blue], {0.2, 1.1}]]; Show[vector, conjugate, ax, ay, txtj, txtC, txtCC, txtjc, tx, ty] 

Complex number z and its conjugate.  Mathematica code 
It is a customary to visualize a complex number as a vector, denoting its horizontal component by Re (real part) and its vertical component by Im (imaginary part). In Cartesian coordinates, a complex number is denoted by the ordered pair:
Now we are ready to define the field of complex numbers, denoted by ℂ.
 Addition: z₁ + z₂ = (x₁ + y₁ j) + (x₂ + y₂ j) = x₁ + x₂ + j (y₁ + y₂).
 Substraction: z₁ − z₂ = (x₁ + y₁ j) − (x₂ + y₂ j) = x₁ − x₂ + j (y₁ − y₂).
 Multiplication: z₁ ⋅ z₂ = (x₁ + y₁ j) ⋅ (x₂ + y₂ j) = (x₁x₂ − y₁y₂) + j (x₁y₂ + x₂y₁).

Division: division of two complex numbers z₁ ⁄ z₂ = (x₁ + y₁ j) ÷ (x₂ + y₂ j) is
\[ \frac{x_1 + {\bf j}\,y_1}{x_2 + {\bf j}\,y_2} = \frac{x_1 x_2 + y_1 y_2}{x_2^2 + y_2^2} + {\bf j}\,\frac{x_2 y_1  x_1 y_2}{x_2^2 + y_2^2}. \]
Multiplication and division have extremely simple form when polar form is employed. Suppose we need to multiply two complex numbers
vector = Graphics[{Black, Arrowheads[0.1], Thickness[0.01],
Arrow[{{0, 0}, {2, 1}}]}];
vec2 = Graphics[{Black, Arrowheads[0.1], Thickness[0.01], Arrow[{{0, 0}, {0.7, 1}}]}]; vec = Graphics[{Black, Arrowheads[0.1], Thickness[0.01], Arrow[{{0, 0}, {0.6, 1.7}}]}]; ax = Graphics[{Black, Arrowheads[0.05], Thick, Arrow[{{0, 0}, {2.2, 0}}]}]; aarr = Show[ ParametricPlot[#[[1]]*{Cos[\[Theta]], Sin[\[Theta]]}, {\[Theta], #[[2]], #[[3]]}, Axes > False, PlotStyle > #[[4]]] /. Line[x_] :> Sequence[Arrowheads[{0.05, 0.05}], Arrow[x]] & /@ {{0.9, 0 Degree, 54 Degree, Red}, {1.25, 0 Degree, 27 Degree, Blue}, {1.5, 0 Degree, 109 Degree, Green}}, PlotRange > All] txz = Graphics[ Text[Style["\[Theta]", FontSize > 18, Blue], {1.6, 0.4}]]; txw = Graphics[ Text[Style["\[Alpha]", FontSize > 18, Blue], {0.8, 0.7}]]; txzw = Graphics[ Text[Style["\[Theta] + \[Alpha]", FontSize > 18, Blue], {0.8, 1.26}]]; Show[vector, vec2, vec, ax, aarr, txz, txw, txzw] 

Multiplication of two complex numbers.  Mathematica code 
This also allows us to easily find all roots of any complex number. Suppose that we want to calculate the n roots of a complex number \( z = r\,e^{{\bf j}\,\theta} = r \left( \cos\theta + {\bf j}\,\sin\theta \right) . \) Then all n roots are determined from the formula:
Example 1: Let us consider the complex number 4 + 3 j that we represent in polar form
Mathematica for Complex numbers
Since there is no universal notation for a unit vector in vertical direction on the complex plane, Mathematica uses two of them: i and j. Euler suggested to use i (\( {\bf i}^2 =1 \) ) , so mathematicians follow him; however, in engineering and computer science it is common to use j (\( {\bf j}^2 =1 \) ) .
i  a unit imaginary vector in Mathematics, denoted by \[ImaginaryI] in Wolfram language
j  a unit imaginary vector in Engineering and Computer Science, denoted by \[ImaginaryJ] in Wolfram language
Complex  convert a pair of reals to a complex number
Re  real part of a complex number
Im  imaginary part of a complex number
Abs  absolute value
Arg  argument (phase angle in radians)
Conjugate  complex conjugate
ComplexExpand  expand symbolic expressions into real and imaginary parts
ExpToTrig, TrigToExp  convert between complex exponentials and trigonometric functions
Convert to polar form:
We can find all roots of a number using the following code:
Function[x, Function[y, ( Abs[y] ^ (1/x) *
( Cos[((Arg[y] + 360° * Range[0, x  1]) / x)] +
I*Sin[((Arg[y] + 360° * Range[0, x  1]) / x)]))
] ]
For instance, suppose we want to find all four roots of (4)^(1/4) :
The following animation, developed by Wolfram Research, shows all nth roots of unity \( \left( 1 \right)^{1/n} = \sqrt[n]{1} \) for different positive integer values of n: \( n=1,2,\ldots , 14 . \) We present the following code to find and plot all roots on the complex plane:
Module[{nSol, list}, nSol = NSolve[equation, variable];
list = {Re[x], Im[x]} /. nSol;
Return[ListPlot[list, PlotStyle > PointSize[0.03], opts]];]
CPlot[Table[\[Omega]^k , { k, 0, n1}]]];
ShowNRoots[9]
ParametricPlot3D[{r*Cos[theta], r*Sin[theta], r^(1/n) * Cos[theta/n]},
{r, 0, 2}, {theta, 0, 2*n*Pi},
PlotPoints > {resolution, resolution*n},
Boxed > False, Axes >False, AspectRatio > 1, ViewPoint > {3, 3, 0}]
ParametricPlot3D[{r*Cos[theta], r*Sin[theta], theta},
{r, 0, 2}, {theta, 0, 2*n*Pi},
PlotPoints > {resolution, resolution*n},
Boxed > False, Axes >False, AspectRatio > 1/2, ViewPoint > {3, 2, 3}]
Module[{r}, r = Map[{Re[#], Im[#]} &, z];
ListPlot[r, PlotStyle > PointSize[0.1], AspectRatio >1,
PlotRange > {{1.1, 1.1}, {1.1, 1.1}},
PlotRegion > {{0.05, 0.95}, {0.05, 0.95}}]]
CPlot[{1, omega, omega^2}]
Return to Mathematica page
Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)
Return to the Part 7 (Boundary Value Problems)