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

Section 8.5	Improper Integrals Involving Trigonometric Functions

Section 8.6	Indented Contour Integrals

Section 8.7  Integrands with Branch Points

We now show how to evaluate certain improper real integrals involving the integrand  (((x^α) P (x))/(Q (x))).  Since the complex function  (z^α)   is multivalued, we must first specify the branch that we will be using.  

	Let  α  be a real number with  0 < α < 1.  Then in this section we will use the branch of  (z^α)   defined as follows

	\(z\^α = \(e\^\(α \((ln\ r\  + \ iθ)\)\) = \(r\^α\) \((cos \((αθ)\) + i\ sin \((αθ)\))\)\)\),  where  0 ≤ θ < 2  π.  
	
When using this definition, we see that  (z^α)  is analytic in the domain  r > 0, 0 < θ < 2  π,  i.e. the complex plane slit along the negative x-axis.

Theorem 8.7,  Page 339.  Let P and Q be polynomials of degree m and n, respectively, where n ≥ m + 2. Let Q (x)≠0  for  x>0, and Q has a zero of order at most 1 at the origin, and f (z) = (((z^α) P (z))/(Q (z))),where 0 < α< 1, then the Cauchy Principal Value (P.V.) of the integral is

	  	\(P . 
          V . \(∫\_0\%∞\(\( x\^α\ P \((x)\)\)\/\(Q \((x)\)\)\) dx\)\  = \ \(2  π\ i\)\/\(1\  - \ e\^\(i\ α\ 2  π\)\)\ \(∑\+\(j = 1\)\%k Res[f, z\_j]\)\),  

 where (Subscript[z, 1]), (Subscript[z, 2]),   ... , (Subscript[z, k]) are the non-zero poles of ((P (z))/(Q (z))).

Proof of Theorem 8.7, see text Page 339.

Example 8.23,  Page 341.  Show that  \(P . 
          V . \ \(∫\_0\%∞\( x\^α\/\(x \((x\  + \ 
                        1)\)\)\) dx\)\  = \ π\/\(sin \((α\ π)\)\)\),  where  0 < α < 1.

Solution 8.23.

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

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

Which pole(s) are non-zero ?

dots = 
        Graphics[{{Red, PointSize[0.03], Point[{Re[(Subscript[Z, 1])], Im[(Subscript[Z, 1])]}]}, {Blue, 
              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  ", 
        Z\_1, " ≠ 0 ? ", Z\_1 ≠ 0];\)\ \)
\(\(Print[\*""\!\(z\_2\) = "", Z\_2, ",  Is   ", 
        Z\_2, " ≠ 0 ? ", 
        Z\_2 ≠ 0];\)\ \)

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

Res1  =  
        Residue[f[z], {z, (Subscript[Z, 1])}]; 
Print["Res[f,", (Subscript[Z, 1]), "] = ", 
        Res1]; 
Res1 = 
        ComplexExpand[Res1, 
          TargetFunctions -> {Im, Re}]; 
Print["Res[f,", (Subscript[Z, 1]), "] = ", 
        Res1]; 
Res1 = TrigToExp[Res1]; 
Print["Res[f,", (Subscript[Z, 1]), "] = ", 
        Res1]; 
val  =  ((2  π I)/(1 - (E^(I α 2  π))))  Res1; 
dot = 
        Graphics[{{Red, PointSize[0.03], 
              Point[{Re[(Subscript[Z, 1])], Im[(Subscript[Z, 1])]}]}}]; 
\(\(center = 
        Graphics[{Text[\*""\!\(z\_1\)"", {Re[Z\_1], 
                Im[Z\_1] + 0.2}, {\(-1\), 
                0}]}];\)\ \)
contour  =  
        Graphics[{{VioletRed, 
              Circle[{0, 0}, 
                2, {0, 2  π}]}}]; 
segment = 
        Graphics[{Thickness[0.02], Magenta, 
            Line[{{0, 0}, {2, 0}}]}]; 
Show[center, contour, segment, dot, 
        PlotRange -> {{-2.1, 2.1}, {-2.1, 2.1}}, 
        Ticks -> {Range[-1, 1, 1], Range[0, 2, 1]}, 
        AspectRatio -> 1, 
AspectRatio -> 1, 
        Axes -> True, 
        AxesLabel -> {"x", "y"}]; 
\(\(Print[\*""(∮_C) ("", 
        f[z], \*"") \[DifferentialD]z = \!\(\(2  π\\ I\)\/\(1\\  - \\ E\^\(I\\ α\\ 2  π\)\)\)("", \ Res1\ , ")"];\)\ \)
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = ", 
        val];\)\ \)
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = ", 
        FullSimplify[val]];\)\ \)
\(\(Print[\*""The contour is the circle (Subscript[C, R]) and two segments near [0,R],""];\)\ \)
Print["and a little semicircle around the origin in quadrants II & \
III,"]; 
Print["taken with the positive orientation."]; 
Print["Let R->∞ to obtain the Cauchy Principal Value \
of the integral."]; 
Print[""]; 
\(\(Print[\*""P.V.\!\(∫\_0\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        val];\)\ \)
\(\(Print[\*""P.V.\!\(∫\_0\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        FullSimplify[val]];\)\ \)

Aside. We can use Mathematica's built in "PrincipalValue" option to evaluate this definite integral .

val  =  
        Integrate[f[x], {x, 0, ∞}, 
          Assumptions -> {0 < Re[α] < 1}, 
          PrincipalValue -> True]; 
\(\(Print[\*""P.V.\!\(∫\_0\%∞\)"", 
        f[x], " \[DifferentialD]x = ", 
        val];\)\ \)

Which is also the correct answer.

Example 8.24,  Page 341.  Show that  \(P . 
          V . \ \(∫\_0\%∞\( Log[z]\/\(x\^2\  + \ 
                    a\^2\)\) dx\)\  = \ \(π\ Log[a]\)\/\(2\ a\)\),  where  a > 0.

Solution 8.24.

Enter the function and  f[z] = Log[z]/((a^2)  +  (x^2))  and locate the isolated singularities.

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

Which poles lie in the upper half plane ?

a = 2; 
dots = 
        Graphics[{{Blue, 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["For example, if  a = 2."]; 
\(\(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]) = 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]; 
dot = 
        Graphics[{{Red, PointSize[0.03], 
              Point[{Re[(Subscript[Z, 2])], Im[(Subscript[Z, 2])]}]}}]; 
\(\(center = 
        Graphics[{Text[\*""\!\(z\_2\)"", {Re[Z\_2], 
                Im[Z\_2]}, {\(-1.2\), 0}]}];\)\ \)
contour  =  
        Graphics[{{VioletRed, Circle[{0, 0}, 3, {0, π}]}, {VioletRed, 
              Circle[{0, 0}, 
                0.2, {0, π}]}}]; 
segment = 
        Graphics[{Thickness[0.02], Magenta, 
            Line[{{-3, 0}, {3, 0}}]}]; 
Show[center, contour, segment, dot, 
        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\ , ")"];\)\ \)
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = ", 
        val];\)\ \)
\(\(Print[\*""\!\(∮\+C\) ("", 
        f[z], ") \[DifferentialD]z = ", 
        ComplexExpand[val]];\)\ \)
\(\(Print[\*""The indented contour is the semicircle (Subscript[C, R]) portions of [-R,R],""];\)\ \)
Print["and a little indent semicircle around the origin on the \
x-axis,"]; 
Print["taken with the positive orientation."]; 
Print["Let R->∞ to obtain the Cauchy Principal Value \
of the integral."];

Further analysis must be done.  As shown in the text, the limit of the integrals taken over the semicircles are both zero.
Use the fact that when x is negative  Log[x]  =  Log[|x|]  +  i π.  Then use this parameterize the line segment on the negative x-axis and obtain  

\(P . 
          V . \((\ ∫\_\(-∞\)\%0\(\( 
                          Log[\(|\)\(x\)\(|\)] + \ i\ π\)\/\(x\^2\  + \ 
                        2\^2\)\) dx\  + \ ∫\_0\%∞\( Log[x]\/\(x\^2\  + \ 
                        2\^2\)\) dx\ )\) = \ \(π\ Log[2]\)\/2 + \(i\ π\^2\)\/4\).  

Equating the real parts in the above equation we obtain  

\(P . 
          V . \ \(∫\_0\%∞\( Log[x]\/\(x\^2\  + \ 
                    2\^2\)\) dx\)\  = \ \(π\ Log[2]\)\/4\).  

which is the correct value when  a = 2.  Similar computations will establish the general result.

Aside. We can use Mathematica's built in "PrincipalValue" option to evaluate this definite integral with specific values of  a.

\(\(\(For[a = 2, 
        a ≤ 5, \(a++\), 
val\  = \ 
          Integrate[f[x], {x, 0, ∞}, 
            Assumptions -> {0 < Re[α] < 1}, 
            PrincipalValue -> 
              True]; \ 
Print["a = ", 
          a]; \ 
Print[\*""P.V.(∫_0^∞)"", f[x], " \[DifferentialD]x = ", 
          val]; \ 
Print[\*""\!\(\(π\\ \\ Log[a]\)\/\(2  a\)\) = "", \(π\ Log[a]\)\/\(2  a\)]; \ 
Print[""];\ \ ];\)\(\ \)\(
\)
    \)\)

Which leads us to conjecture the general result  \(P . 
          V . \ \(∫\_0\%∞\( Log[z]\/\(x\^2\  + \ 
                    a\^2\)\) dx\)\  = \ \(π\ Log[a]\)\/\(2\ a\)\),  where  a > 0.

Section 8.7 Exercises for  Integrands with Branch Points
See textbook page 342.

Section 8.8	The Argument Principle and Rouche's Theorem

GO TO  THE  Table of Contents