COMPLEX ANALYSIS: Mathematica 4.1 Notebooks
(c) John H. Mathews, and
Russell W. Howell, 2002
Complimentary software to accompany our textbook:

COMPLEX ANALYSIS: for Mathematics and Engineering, 
4th Edition,  2001,  ISBN: 0-7637-1425-9
Jones & Bartlett Publishers, Inc.  
40 Tall Pine Drive, Sudbury, MA 01776  
Tele.  (800) 832-0034, FAX:  (508)  443-8000  
E-mail:  mkt@jbpub.com  
Internet:  http://www.jbpub.com/  
This free software is compliments of the authors.
John H. Mathews,   mathews@fullerton.edu 
Russell W. Howell,  howell@westmont.edu

CHAPTER 8   RESIDUE THEORY

a = t = x = y = z = Z = 
                  0; 
Clear[A, center, centers, dot, dots, f, f0, F, g, G, i, p, R, Res, 
        Res1, Res2, Res3, Res4, Res5, Res6, solset, sub, S, t, θ, val, 
        x, y, z, z1, z2, z3, z4, z5, z6, Z]; 
Needs["Graphics`Colors`"]; 
Needs["Graphics`FilledPlot`"];

Section 8.1	The Residue Theorem

Section 8.2	Calculation of Residues

Section 8.3	Trigonometric Integrals

Section 8.4  Improper Integrals of Rational Functions

An important application of the theory of residues is the evaluation of certain types of improper integrals.  Let  f(x)  be a continuous function of the real variable  x  on the interval  0 ≤ x < ∞.  Recall from calculus that the improper integral of  f  over  [0, ∞)  is defined by 

	(∫_0^∞) f (x) dx  =  
        (lim_(b  ->  ∞)) (∫_0^b) 
            f (x) dx,  
	
provided that the limit exists.  If  f  is defined for all real  x,  then the improper integral of  f  over  (-∞, ∞) is defined by 

	(∫_(-∞)^∞) 
          f (x) dx  =  
        (lim_(a  ->  -∞)) (∫_a^0) 
              f (x) dx  +  
          (lim_(b  ->  ∞)) (∫_0^b) 
              f (x) dx,  

provided that both limits exists.  If the latter integral exists, then its value can be obtained by taking a single limit as follows  \(∫\_\(-∞\)\%∞\ 
          f \((x)\) dx\ \  = \ \ lim\+\(R\  -> \ ∞\)\ ∫\_\(-R\)\%R\ f \((x)\) dx\).  However, for some functions the limit on the right side of this equation exists when the definition of the improper integral does not exist.

Example 8.13,  Page 323.  Show that "\!\(lim\+\(R \[Rule] \[Infinity]\)\) \!\(\[Integral]\_\(-R\)\%R\) x \
\[DifferentialD]x"  =  0, although (∫_(-∞)^∞) 
        f (x) dx doesn't exist.

Solution 8.13.

Enter the function  f[x] = x  and investigate the  Cauchy Principal Value .

Remove[x]; 
Clear[f, F, lim1, lim2, R, x]; 
f[x_]  =  x; 
F[x_]  = ∫x \[DifferentialD]x; 
lim  =  
        Limit[ F[R]  -  F[-R],  R -> ∞]; 
Print["f[x] = ", f[x]]; 
Print["F[x] = ∫ x \[DifferentialD]x = ", 
        F[x]]; 
g1 = 
        FilledPlot[f[x], {x, -1, 0}, Fills -> Cyan, 
          DisplayFunction -> Identity]; 
g2 = 
        FilledPlot[f[x], {x, 0, 1}, Fills -> Pink, 
          DisplayFunction -> Identity]; 
ends = 
        Graphics[{{Text["-R", {-1, 
                  0}, {0, -1}]}, {Text["R", {1, 0}, {0, 
                  1}]}}]; 
Show[g1, g2, ends, PlotRange -> {{-1.5, 1.5}, {-1, 1}}, 
        AspectRatio -> 
          (1/2), 
AxesLabel -> {"x", "s = f[x] = \
x"}, Ticks -> None, 
        DisplayFunction -> $DisplayFunction]; 
\(\(Print[\*"" (lim_(R -> ∞)) (∫_(-R)^R) x \[DifferentialD]x = (lim_(R -> ∞)) ("", F[R], " - (", F[\(-R\)], ")) = ", 
        lim];\)\ \)
Print[""]; 
\(\(Print[\*""P.V. (∫_(-∞)^∞) x \[DifferentialD]x = "", lim];\)\ \)

Definition 8.2 (Cauchy Principal Value - P.V.), Page 323. Let f(x) be a continuous real valued function for all x. The Cauchy principal value (P.V.) of the integral (∫_(-∞)^∞) 
        f (x) dx is defined by 

	\(P . 
          V . \(∫\_\(-∞\)\%∞\ 
            f \((x)\) dx\)\ \  = \ \ lim\+\(R\  -> \ ∞\)\ ∫\_\(-R\)\%R\ f \((x)\) dx\).

Example 8.13 shows that \(P . 
          V . \(∫\_\(-∞\)\%∞\ \ x dx\) = 0\).

Example 8.14,  Page 323.  Use the residue calculus to evaluate the integral  "\!\(\[Integral]\_\(-\[Infinity]\)\%\[Infinity]\)\!\(1\/\(x\^2\\  + \
\\ 1\)\)\[DifferentialD]x".

Solution 8.14.

Enter the function  f[z] = (1/((z^2)  +  1))  and locate the singularities.

Remove[x, z, Z]; 
Clear[f, g, Res1, Res2, solset, val]; 
f[z_]  =  (1/((z^2)  +  1)); 
Print["f[z] = ", f[z]]; 
Print[""]; 
Print[Denominator[f[z]] == 0]; 
solset  =  
        Sort[Solve[Denominator[f[z]] == 0, 
            z]]; 
 Print[solset]; 
Print[""]; 
Print["The singularities are"]; 
(Subscript[Z, 1])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[1]]])];  
\(\(Print[\*""\!\(z\_1\) = "", Z\_1];\)\ \)
(Subscript[Z, 2])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[2]]])];  
\(\(Print[\*""\!\(z\_2\) = "", Z\_2];\)\ \)

Determine which poles lie in the upper half plane ?

dots = 
        Graphics[{{Red, PointSize[0.03], Point[{Re[(Subscript[Z, 1])], Im[(Subscript[Z, 1])]}]}, {Red, 
              PointSize[0.03], 
              Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_1\)"", {Re[Z\_1], 
                Im[Z\_1] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_2\)"", {Re[Z\_2], Im[Z\_2] - 0.1}, {\(-1\), 
                0}]}];\)\ \)
Show[dots, centers, 
        PlotRange -> {{-2.2, 2.2}, {-2.2, 2.2}}, 
        Ticks -> {Range[-2, 2, 1], 
            Range[-2, 2, 1]}, 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(z\_1\) = "", Z\_1, ", Is  Im(", 
        Z\_1, ") > 0 ?  ", N[Im[Z\_1]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_2\) = "", Z\_2, ",  Is  Im(", 
        Z\_2, ") > 0 ?   ", 
        N[Im[Z\_2]] > 0];\)\ \)

Compute the residues at  (Subscript[z, 2]) = i, and use the residue calculus to compute the value of the integral.

Res2  =  
        Residue[f[z], {z, (Subscript[Z, 2])}]; 
val  = 2  π I  Res2; 
Print["Res[f,", (Subscript[Z, 2]), "] = ", 
        Res2]; 
dots = 
        Graphics[{Red, PointSize[0.03], 
            Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_2\)"", {Re[Z\_2], 
                Im[Z\_2]}, {\(-1.2\), 0}]}];\)\ \)
contour  =  
        Graphics[{VioletRed, 
            Circle[{0, 0}, 2, {0, π}]}]; 
segment = 
        Graphics[{Thickness[0.02], Magenta, 
            Line[{{-2, 0}, {2, 0}}]}]; 
Show[dots, centers, contour, segment, 
        PlotRange -> {{-2.1, 2.1}, {-0.05, 2.05}}, 
        Ticks -> {Range[-1, 1, 1], Range[0, 1, 1]}, 
        AspectRatio -> (1/2), 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = 2πI(", 
        Res2\ , ") = ", val];\)\ \)
\(\(Print[\*""The contour is the semicircle (Subscript[C, R]) and interval [-R,R],""];\)\ \)
Print["taken with the positive orientation."]; 
Print["Let R->∞ to obtain the Cauchy Principal Value \
of the integral."]; 
Print[""]; 
\(\(Print[\*""P.V.(∫_(-∞)^∞)"", f[x], " \[DifferentialD]x = 2πI(", Res2, ") = ", 
        val];\)\ \)

Or, we can use Mathematica's integral table and evaluate the integral.

\(
\(int = 
        Integrate[f[x], {x, \(-∞\), ∞}, 
          PrincipalValue -> True];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        int];\)\ \)

However, for this simple integral Mathematica's can find the correct answer without resorting to the PrincipalValue option.

g[
          x_]  = ∫f[x] \[DifferentialD]x; 
val  = (∫_(-∞)^∞) f[
              x] \[DifferentialD]x; 
Print["f[x] = ", f[x]]; 
Print["g[x] = ∫", f[x], " \[DifferentialD]x = ", 
        g[x]]; 
Print[""]; 
Print["g[∞] = ", 
        g[∞], ",    g[-∞] = ",  
        g[-∞]]; 
Print[""]; 
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = g[∞]-g[-∞] = (", 
        g[∞]\ , ") - (", \ 
        g[\(-∞\)], ")"];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        g[∞]\  - \ 
          g[\(-∞\)]];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        val];\)\ \)

The above answer is correct too.

If  f (x) = ((P (x))/(Q (x))),  where  P  and  Q  are polynomials, then  f  is called a rational function.  Techniques in calculus were developed to integrate rational functions.  We now show how the Residue Theorem can be used to obtain the Cauchy principal value of the integral of  f  over  (-∞, ∞).

Theorem 8.3 (Contour Integration for Rational Functions),  Page 323.  Let f (z) = ((P (z))/(Q (z)))where P and Q are polynomials, of degree m and n , respectively. If Q (x) ≠ 0 for all real x and n ≥ m + 2, then the Cauchy Principal Value (P.V.) of the integral is

			P . 
          V . (∫_(-∞)^∞)(( 
                    P (x))/(Q (x))) dx  =  
        2  π i (∑_(j = 1)^k) Res[(P/Q), 
              (Subscript[z, j])].  

where (Subscript[z, 1]), (Subscript[z, 2]),   ... , (Subscript[z, k]) are the poles of ((P (z))/(Q (z))) that lie in the upper half plane.

Proof of Theorem 8.3, see text Page 323.

Some of these problems can be solved using Mathematica's table of integrals.

Example 8.15,  Page 325.  Use the residue calculus to evaluate the integral  (∫_(-∞)^∞) 
                (1/(((x^2)  +  1) ((x^2)  +  
                      4))) dx  =  (π/6).

Solution 8.15.

Enter the function  f[z] = (1/(((z^2)  +  1) ((z^2)  +  4)))  and locate the singularities.

Remove[x, z, Z]; 
Clear[f, g, Res1, Res2, Res3, Res4, solset, val]; 
f[z_]  =  
        (1/(((z^2)  +  1) ((z^2)  +  4))); 
Print["f[z] = ", f[z]]; 
Print[""]; 
Print[Denominator[f[z]] == 0]; 
solset  =  
        Sort[Solve[Denominator[f[z]] == 0, 
            z]];  
Print[solset]; 
Print[""]; 
Print["The singularities are"]; 
(Subscript[Z, 1])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[1]]])];  
\(\(Print[\*""\!\(z\_1\) = "", Z\_1];\)\ \)
(Subscript[Z, 2])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[2]]])];  
\(\(Print[\*""\!\(z\_2\) = "", Z\_2];\)\ \)
(Subscript[Z, 3])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[3]]])];  
\(\(Print[\*""\!\(z\_3\) = "", Z\_3];\)\ \)
(Subscript[Z, 4])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[4]]])];  
\(\(Print[\*""\!\(z\_4\) = "", 
        Z\_4];\)\ \)

Determine which poles lie in the upper half plane ?

dots = 
        Graphics[{{Red, PointSize[0.03], Point[{Re[(Subscript[Z, 1])], Im[(Subscript[Z, 1])]}]}, {Red, 
              PointSize[0.03], Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}, {Red, 
              PointSize[0.03], Point[{Re[(Subscript[Z, 3])], Im[(Subscript[Z, 3])]}]}, {Red, 
              PointSize[0.03], 
              Point[{Re[(Subscript[Z, 4])], Im[(Subscript[Z, 4])]}]}}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_1\)"", {Re[Z\_1], 
                Im[Z\_1] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_2\)"", {Re[Z\_2], Im[Z\_2] - 0.1}, {\(-1\), 
                0}], Text[\*""\!\(z\_3\)"", {Re[Z\_3], 
                Im[Z\_3] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_4\)"", {Re[Z\_4], Im[Z\_4] - 0.1}, {\(-1\), 
                0}]}];\)\ \)
Show[dots, centers, 
        PlotRange -> {{-2.2, 2.2}, {-2.2, 2.2}}, 
        Ticks -> {Range[-2, 2, 1], 
            Range[-2, 2, 1]}, 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(z\_1\) = "", Z\_1, ",  Is  Im(", 
        Z\_1, ") > 0 ?   ", N[Im[Z\_1]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_2\) = "", Z\_2, ",   Is  Im(", 
        Z\_2, ") > 0 ?    ", 
        N[Im[Z\_2]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_3\) = "", Z\_3, ", Is  Im(", 
        Z\_3, ") > 0 ?  ", N[Im[Z\_3]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_4\) = "", Z\_4, ",  Is  Im(", 
        Z\_4, ") > 0 ?   ", 
        N[Im[Z\_4]] > 0];\)\ \)

Compute the residues at  (Subscript[z, 2]) = i  and  (Subscript[z, 4]) = 2  i, and use the residue calculus to compute the value of the integral.

Res2  =  Residue[f[z], {z, (Subscript[Z, 2])}]; 
Res4  =  Residue[f[z], {z, (Subscript[Z, 4])}]; 
val  =  
        2 π I (Res2  +  
              Res4); 
Print["Res[f,", (Subscript[Z, 2]), "] = ", Res2]; 
Print["Res[f,", (Subscript[Z, 4]), "] = ", 
        Res4]; 
dots = 
        Graphics[{{Red, PointSize[0.03], Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}, {Red, 
              PointSize[0.03], 
              Point[{Re[(Subscript[Z, 4])], Im[(Subscript[Z, 4])]}]}}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_2\)"", {Re[Z\_2], 
                Im[Z\_2]}, {\(-1.2\), 0}], 
            Text[\*""\!\(z\_4\)"", {Re[Z\_4], Im[Z\_4]}, {\(-1.2\), 
                0}]}];\)\ \)
contour  =  
        Graphics[{VioletRed, 
            Circle[{0, 0}, 3, {0, π}]}]; 
segment = 
        Graphics[{Thickness[0.02], Magenta, 
            Line[{{-3, 0}, {3, 0}}]}]; 
Show[dots, centers, contour, segment, 
        PlotRange -> {{-3.1, 3.1}, {-0.05, 3.05}}, 
        Ticks -> {Range[-1, 1, 1], Range[0, 2, 1]}, 
        AspectRatio -> (1/2), 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = 2πI((", 
        Res2\ , ") + (", \ 
        Res4\ , "))"];\)\ \)
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = 2πI(", 
        Res2\  + \ Res4\ , ") = ", val];\)\ \)
\(\(Print[\*""The contour is the semicircle (Subscript[C, R]) and interval [-R,R],""];\)\ \)
Print["taken with the positive orientation."]; 
Print["Let R->∞ to obtain the Cauchy Principal Value \
of the integral."]; 
Print[""]; 
\(\(Print[\*""P.V.(∫_(-∞)^∞)"", f[x], " \[DifferentialD]x "];\)\ \)
Print["= 2π\[ImaginaryI](", Res2, " + (",  
        Res4, ")) = ", val];

Or, we can use Mathematica's integral table and evaluate the integral.

\(
\(int = 
        Integrate[f[x], {x, \(-∞\), ∞}, 
          PrincipalValue -> True];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        int];\)\ \)

However, for this simple integral Mathematica's can find the correct answer without resorting to the PrincipalValue option.

g[
          x_]  = ∫f[x] \[DifferentialD]x; 
val  = (∫_(-∞)^∞) f[
              x] \[DifferentialD]x; 
Print["f[x] = ", f[x]]; 
Print["g[x] = ∫", f[x], " \[DifferentialD]x = ", 
        g[x]]; 
Print[""]; 
Print["g[∞] = ", 
        g[∞], ",    g[-∞] = ",  
        g[-∞]]; 
Print[""]; 
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = g[∞]-g[-∞] = (", 
        g[∞]\ , ") - (", \ 
        g[\(-∞\)], ")"];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        g[∞]\  - \ 
          g[\(-∞\)]];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        val];\)\ \)

The above answer is correct too.

Example 8.16,  Page 325.  Use the residue calculus to evaluate the integral  "\!\(\[Integral]\_\(-\[Infinity]\)\%\[Infinity]\)\!\(1\/\((z\^2 + \
4)\)\^3\)\[DifferentialD]x = \!\(\(3  \[Pi]\)\/256\)".

Solution 8.16.

Enter the function  f[z] = (1/((((z^2)  +  4))^3))  and locate the singularities.

Remove[x, z, Z]; 
Clear[f, g, Res1, Res2, Res3, Res4, solset, val]; 
f[z_]  =  (1/((((z^2)  +  4))^3)); 
Print["f[z] = ", f[z]]; 
Print[""]; 
Print[Denominator[f[z]] == 0]; 
solset  =  
        Sort[Solve[Denominator[f[z]] == 0, 
            z]];  
Print[solset]; 
Print[""]; 
Print["The singularities are"]; 
(Subscript[Z, 1])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[1]]])];  
\(\(Print[\*""\!\(z\_1\) = "", Z\_1];\)\ \)
(Subscript[Z, 2])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[2]]])];  
\(\(Print[\*""\!\(z\_2\) = "", Z\_2];\)\ \)
(Subscript[Z, 3])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[3]]])];  
\(\(Print[\*""\!\(z\_3\) = "", Z\_3];\)\ \)
(Subscript[Z, 4])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[4]]])];  
\(\(Print[\*""\!\(z\_4\) = "", 
        Z\_4];\)\ \)
(Subscript[Z, 5])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[5]]])];  
\(\(Print[\*""\!\(z\_5\) = "", Z\_5];\)\ \)
(Subscript[Z, 6])  =  
        ReplaceAll[z, 
          (Subscript[solset, [[6]]])];  
\(\(Print[\*""\!\(z\_6\) = "", 
        Z\_6];\)\ \)

Which poles lie in the upper half plane ?

dots = 
        Graphics[{{Red, PointSize[0.03], Point[{Re[(Subscript[Z, 1])], Im[(Subscript[Z, 1])]}]}, {Red, 
              PointSize[0.03], Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}, {Red, 
              PointSize[0.03], Point[{Re[(Subscript[Z, 3])], Im[(Subscript[Z, 3])]}]}, {Red, 
              PointSize[0.03], Point[{Re[(Subscript[Z, 4])], Im[(Subscript[Z, 4])]}], 
              Point[{Re[(Subscript[Z, 5])], Im[(Subscript[Z, 5])]}]}, {Red, PointSize[0.03], 
              Point[{Re[(Subscript[Z, 6])], Im[(Subscript[Z, 6])]}]}}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_1\)"", {Re[Z\_1], 
                Im[Z\_1] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_2\)"", {Re[Z\_2] + 0.3, 
                Im[Z\_2] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_3\)"", {Re[Z\_3] + 0.6, 
                Im[Z\_3] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_4\)"", {Re[Z\_4], Im[Z\_4] - 0.1}, {\(-1\), 
                0}], Text[\*""\!\(z\_5\)"", {Re[Z\_5] + 0.3, 
                Im[Z\_5] - 0.1}, {\(-1\), 0}], 
            Text[\*""\!\(z\_6\)"", {Re[Z\_6] + 0.6, 
                Im[Z\_6] - 0.1}, {\(-1\), 0}]}];\)\ \)
Show[dots, centers, 
        PlotRange -> {{-2.2, 2.2}, {-2.2, 2.2}}, 
        Ticks -> {Range[-2, 2, 1], 
            Range[-2, 2, 1]}, 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(z\_1\) = "", Z\_1, ",  Is  Im(", 
        Z\_1, ") > 0 ?  ", N[Im[Z\_1]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_2\) = "", Z\_2, ",  Is  Im(", 
        Z\_2, ") > 0 ?  ", 
        N[Im[Z\_2]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_3\) = "", Z\_3, ",  Is  Im(", 
        Z\_3, ") > 0 ?  ", N[Im[Z\_3]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_4\) = "", Z\_4, ",   Is  Im(", 
        Z\_4, ") > 0 ?   ", 
        N[Im[Z\_4]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_5\) = "", Z\_5, ",   Is  Im(", 
        Z\_5, ") > 0 ?   ", N[Im[Z\_5]] > 0];\)\ \)
\(\(Print[\*""\!\(z\_6\) = "", Z\_6, ",   Is  Im(", 
        Z\_6, ") > 0 ?   ", 
        N[Im[Z\_6]] > 0];\)\ \)

Compute the residues at  (Subscript[z, 4]) = 2  i, and use the residue calculus to compute the value of the integral.

Res4  =  Residue[f[z], {z, (Subscript[Z, 4])}]; 
val  =  2 π I Res4; 
Print["Res[f,", (Subscript[Z, 4]), "] = ", 
        Res4]; 
dots = 
        Graphics[{Red, PointSize[0.03], 
            Point[{Re[(Subscript[Z, 4])], Im[(Subscript[Z, 4])]}]}]; 
\(\(centers = 
        Graphics[{Text[\*""\!\(z\_4\)"", {Re[Z\_4], 
                Im[Z\_4]}, {\(-1.2\), 0}]}];\)\ \)
contour  =  
        Graphics[{VioletRed, 
            Circle[{0, 0}, 3, {0, π}]}]; 
segment = 
        Graphics[{Thickness[0.02], Magenta, 
            Line[{{-3, 0}, {3, 0}}]}]; 
Show[dots, centers, contour, segment, 
        PlotRange -> {{-3.1, 3.1}, {-0.05, 3.05}}, 
        Ticks -> {Range[-1, 1, 1], Range[0, 2, 1]}, 
        AspectRatio -> (1/2), 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = 2πI(", 
        Res4\ , ") = ", val];\)\ \)
\(\(Print[\*""The contour is the semicircle (Subscript[C, R]) and interval [-R,R],""];\)\ \)
Print["taken with the positive orientation."]; 
Print["Let R->∞ to obtain the Cauchy Principal Value \
of the integral."]; 
Print[""]; 
\(\(Print[\*""P.V.(∫_(-∞)^∞)"", f[x], " \[DifferentialD]x = 2πI(", Res4, ") = ", 
        val];\)\ \)

Or, we can use Mathematica's integral table and evaluate the integral.

\(
\(int = 
        Integrate[f[x], {x, \(-∞\), ∞}, 
          PrincipalValue -> True];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        int];\)\ \)

However, for this simple integral Mathematica's can find the correct answer without resorting to the PrincipalValue option.

g[
          x_]  = ∫f[x] \[DifferentialD]x; 
val  = (∫_(-∞)^∞) f[
              x] \[DifferentialD]x; 
lim1 = 
        Limit[g[x], x -> ∞]; 
lim2 = Limit[g[x], x -> -∞]; 
Print["f[x] = ", f[x]]; 
Print["g[x] = ∫", f[x], " \[DifferentialD]x = ", 
        g[x]]; 
Print[""]; 
\(\(Print[\*"" g[∞] =  (lim_(x -> ∞)) ("", g[x], ") = ", lim1];\)\ \)
\(\(Print[\*""g[-∞] =  (lim_(x -> -∞)) ("", g[x], ") = ", lim2];\)\ \)
Print[""]; 
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = g[∞]-g[-∞] = (", 
        lim1\ , ") - (", \ lim2, ")"];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        lim1\  - lim2];\)\ \)
\(\(Print[\*""\!\(∫\_\(-∞\)\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        val];\)\ \)

The above answer is correct too.

Library Research Experience for Undergraduates

Project I. Write a report on evaluation of contour integrals.

1. Bleick, W. E., ''Fourier Analysis of Engine Unbalance by Contour Integration,'' Am. Math. M., Vol. 63, No. 7. (Aug. - Sep., 1956), pp. 466-472., Jstor.   

2. Boas, R. P., ''Indefinite Integration by Residues (in Classroom Notes),'' Am. Math. M., Vol. 71, No. 3. (Mar., 1964), pp. 298-300, Jstor.   

3. Boas, R. P. and Lowell Schoenfeld, (1966), ''Indefinite Integration by Residues'' SIAM Review, Vol. 8, No. 2. (Apr., 1966), pp. 173-183, Jstor.   

4. Boas, R. P. and Lowell Schoenfeld''Indefinite Integration by Residues II (in Classroom Notes),'' Am. Math. M., Vol. 73, No. 8. (Oct., 1966), p. 881, Jstor.   

5. Boas, Harold P. and Eduardo Friedman, ''A Simplification in Certain Contour Integrals (in Classroom Notes),'' Am. Math. M., Vol. 84, No. 6. (Jun. - Jul., 1977), pp. 467-468, Jstor.   

6. Flanders, Harley, ''On the Fresnel Integrals (in Notes),'' Am. Math. M., Vol. 89, No. 4. (Apr., 1982), pp. 264-266, Jstor.   

7. Farrell, Orin J. ''Note on Evaluating Certain Real Integrals by Cauchy's Residue Theorem (in Classroom Notes),'' Am. Math. M., Vol. 68, No. 2. (Feb., 1961), pp. 151-152, Jstor.   

8. Fettis, Henry E., ''On Some Trigonometric Integrals,'' Math. of Computation, Vol. 35, No. 152. (Oct., 1980), pp. 1325-1329, Jstor.   

9. Just, Erwin and Norman Schaumberger ''Contour Integration for Rational Functions (in Classroom Notes),'' Am. Math. M., Vol. 71, No. 5. (May, 1964), pp. 546-547., Jstor.   

10. Lutzky, M., ''Evaluation of some Integrals by Contour Integration (in Math. Notes),'' Am. Math. M., Vol. 77, No. 10. (Dec., 1970), pp. 1080-1082, Jstor.   

11. Melamed, S. and H. Kaufman ''Evaluation of Certain Improper Integrals by Residues (in Classroom Notes),'' Am. Math. M., Vol. 72, No. 10. (Dec., 1965), pp. 1111-1112, Jstor.   

12. Olds, C. D., ''The Fresnel Integrals (in Classroom Notes),'' Am. Math. M., Vol. 75, No. 3. (Mar., 1968), pp. 285-286, Jstor.   

13. Sachdeva, Baldev K. and Bertram Ross, (1981), ''A Simplification in Contour Integration,'' Int. J. of Math. Ed. in Sci. and Tech., V. 12, No. 1, pp. 57-61.

14. Sackfield, A. and D. A. Hills, (1988), ''Contour Integration: an Integral Evaluated,'' Int. J. of Math. Ed. in Sci. and Tech., V. 19, No. 1, pp. 73-77.

Section 8.4  Exercises for Improper Integrals of Rational Functions
See textbook page 326.

Section 8.5	Improper Integrals Involving Trigonometric Functions

Section 8.6	Indented Contour Integrals

Section 8.7	Integrands with Branch Points

Section 8.8	The Argument Principle and Rouche's Theorem

GO TO  THE  Table of Contents