COMPLEX ANALYSIS: Maple Worksheets, 2001
(c) John H. Mathews Russell W. Howell
mathews@fullerton.edu howell@westmont.edu

Complimentary software to accompany the textbook:

COMPLEX ANALYSIS: for Mathematics & Engineering, 4th Ed, 2001, ISBN: 0-7637-1425-9
Jones and Bartlett Publishers, Inc., 40 Tall Pine Drive, Sudbury, MA 01776
Tele. (800) 832-0034; FAX: (508) 443-8000, E-mail: mkt@jbpub.com, http://www.jbpub.com/


CHAPTER 8 RESIDUE THEORY

Section 8.5 Improper Integrals Involving Trigonometric Functions

Let P and Q be polynomials of degree m and n , respectively, where m+1 <= n . We can show (but omit the proof) that if Q(x) <> 0 for all real x , then

 

`P.V. `*Int(P(x)/Q(x)*cos(x),x = -infinity .. infin... and `P.V. `*Int(P(x)/Q(x)*sin(x),x = -infinity .. infin...

 

are convergent improper integrals. Integrals of this type are sometimes encountered in the study of Fourier transforms and Fourier integrals. We now show how to evaluate them.

Particularly important is our use of the identities

 

cos(alpha*x) = Re(exp(i*alpha*x)) and sin(alpha*x) = Im(exp(i*alpha*x)) , where alpha is a positive real number.

 

The crucial step in the proof of our next theorem will not hold if cos(alpha*z) and sin(alpha*z) are used instead of exp(i*alpha*z) , as you will see when we get to Jordan's Lemma.

 

 

Theorem 8.4 Let P and Q be polynomials, of degree m and n , where m+1 <= n and Q(x) <> 0 for all real x .

If 0 < alpha and f(z) = exp(i*alpha*z)*P(z)/Q(z) , then
P. V.
Int(P(x)*cos(alpha*x)/Q(x),x = -infinity .. infinit... , and
P. V.
Int(P(x)*sin(alpha*x)/Q(x),x = -infinity .. infinit... ,
where
z[1] , z[2] , ..., z[k] are the poles of f that lie in the upper half plane.

 

Load Maple's "residue" procedure.
Make sure this is done only ONCE during a Maple session.

> readlib(residue):


Example 8.17, Page 329. Use the residue calculus to evaluate the integral:
int(x*sin(x)/(x^2+4),x = -infinity .. infinity) = p... .

> f:='f': F:='F': z:='z':
F0 := z -> z*sin(z)/(z^2 + 4):
f := z -> z*exp(I*z)/(z^2 + 4):
`F(z) ` = F0(z);
`f(z) ` = f(z);

`F(z) ` = z*sin(z)/(z^2+4)

`f(z) ` = z*exp(I*z)/(z^2+4)

 

Find the singularities of f(z) = z*exp(i*z)/(z^2+4) .

> Zn := sort([solve(denom(f(z))=0, z)]):
`For f(z) ` = f(z);
`The singularities are:`;
z1 := subs(z=Zn[1],z): z[1] = z1;
z2 := subs(z=Zn[2],z): z[2] = z2;

`For  f(z) ` = z*exp(I*z)/(z^2+4)

`The singularities are:`

z[1] = 2*I

z[2] = -2*I

 

Which poles lie in the upper half plane?

> print(`0 <`,Im(z[1]),` `, Im(z1)>0, evalb(evalf(Im(z1))>0));
print(`0 <`,Im(z[2]),` `, Im(z2)>0, evalb(evalf(Im(z2))>0));

`0 <`, Im(z[1]), `  `, 0 < 2, true

`0 <`, Im(z[2]), `  `, 0 < -2, false

Remark. Sometimes Maple will form the list of values in a different order.

It is always necessary to visually inspect the above results before proceeding.


Compute the residue at
z[2] .

> r1 := residue(f(z), z=z1): `Res[f`,z1,`] ` = r1;

`Res[f`, 2*I, `] ` = 1/2*exp(-2)

 

The value of the integral is computed by the residue calculus:

> `F(x)` = F0(x);
val := 2*Pi*Re(r1):
print(int(F(x),x=-infinity..infinity) = val);

`F(x)` = x*sin(x)/(x^2+4)

int(F(x),x = -infinity .. infinity) = Pi*exp(-2)

 

Remark. The integral for this problem is g(x).
It involves a complex component which does NOT seem to cancel out.
Taking the real part gives the correct real answer.

> g := z -> subs(Z=z,int(Z*sin(Z)/(Z^2 + 4),Z)):
`F(x) ` = F0(x);
`G(x) = `, int(F(x),x) = g(x);
`G(oo) - G(-oo)` = g(infinity) - g(-infinity);
`G(oo) - G(-oo)` = simplify(g(infinity) - g(-infinity));
v := int(x*sin(x)/(x^2 + 4),x=-infinity..infinity):
print(int(F(x),x=-infinity..infinity) = v);
print(Re(int(F(x),x=-infinity..infinity)) = v);
print(Re(int(F(x),x=-infinity..infinity)) = evalf(v));
print(`Unfortunately this answer is wrong !`);

`F(x) ` = x*sin(x)/(x^2+4)

`G(x) = `, int(F(x),x) = 1/2*Si(x-2*I)*cosh(2)+1/2*...

`G(oo) - G(-oo)` = 1/2*Si(infinity-2*I)*cosh(2)+1/2...
`G(oo) - G(-oo)` = 1/2*Si(infinity-2*I)*cosh(2)+1/2...

`G(oo) - G(-oo)` = Pi*cosh(2)-Pi*sinh(2)

int(F(x),x = -infinity .. infinity) = Pi*cosh(2)-Pi...

Re(int(F(x),x = -infinity .. infinity)) = Pi*cosh(2...

Re(int(F(x),x = -infinity .. infinity)) = .42516834...

`Unfortunately this answer is wrong !`

The latter method does NOT agree with the answer obtained via residues.

> `F(x)` = F0(x);
val := 2*Pi*Re(r1):
print(int(F(x),x=-infinity..infinity) = val);
print(int(F(x),x=-infinity..infinity) = evalf(val));
print(`This answer obtained with residues is correct !`);

`F(x)` = x*sin(x)/(x^2+4)

int(F(x),x = -infinity .. infinity) = Pi*exp(-2)

int(F(x),x = -infinity .. infinity) = .4251683315

`This answer obtained with residues is correct !`

 


Example 8.18, Page 329. Use the residue calculus to evaluate the integral:
int(cos(x)/(x^4+4),x = -infinity .. infinity) .

> f:='f': F:='F': z:='z':
F0 := z -> cos(z)/(z^4 + 4):
f := z -> exp(I*z)/(z^4 + 4):
`F(z) ` = F0(z);
`f(z) ` = f(z);

`F(z) ` = cos(z)/(z^4+4)

`f(z) ` = exp(I*z)/(z^4+4)

Find the singularities of f(z) = exp(i*z)/(z^4+4) .

> Zn := sort([solve(denom(f(z))=0, z)]):
`For f(z) ` = f(z);
`The singularities are:`;
z1 := subs(z=Zn[1],z): z[1] = z1;
z2 := subs(z=Zn[2],z): z[2] = z2;
z3 := subs(z=Zn[3],z): z[3] = z3;
z4 := subs(z=Zn[4],z): z[4] = z4;

`For  f(z) ` = exp(I*z)/(z^4+4)

`The singularities are:`

z[1] = 1-I

z[2] = 1+I

z[3] = -1-I

z[4] = -1+I

 

Which poles lie in the upper half plane?

> print(`0 <`,Im(z[1]),` `, Im(z1)>0, evalb(evalf(Im(z1))>0));
print(`0 <`,Im(z[2]),` `, Im(z2)>0, evalb(evalf(Im(z2))>0));
print(`0 <`,Im(z[3]),` `, Im(z3)>0, evalb(evalf(Im(z3))>0));
print(`0 <`,Im(z[4]),` `, Im(z4)>0, evalb(evalf(Im(z4))>0));

`0 <`, Im(z[1]), `  `, 0 < -1, false

`0 <`, Im(z[2]), `  `, 0 < 1, true

`0 <`, Im(z[3]), `  `, 0 < -1, false

`0 <`, Im(z[4]), `  `, 0 < 1, true

Remark. Sometimes Maple will form the list of values in a different order.

It is always necessary to visually inspect the above results before proceeding.


Compute the residues at
z[1] and z[3] .

> r2 := residue(f(z), z=z2): `Res[f`,z2,`] ` = r2;
r3 := residue(f(z), z=z3): `Res[f`,z3,`] ` = r3;

`Res[f`, 1+I, `] ` = (-1/16-1/16*I)*exp(-1)*exp(I)

`Res[f`, -1-I, `] ` = -exp(1)/(-8*exp(I)+8*I*exp(I)...

The value of the integral is computed by the residue calculus:

> `F(x)` = F0(x);
val := -2*Pi*(Im(r2)+Im(r3)):
print(int(F(x),x=-infinity..infinity) = val);
val := factor(-2*Pi*(Im(r2)+Im(r3))):
print(int(F(x),x=-infinity..infinity) = val);

`F(x)` = cos(x)/(x^4+4)

int(F(x),x = -infinity .. infinity) = -2*Pi*(exp(-1...

int(F(x),x = -infinity .. infinity) = 1/8*Pi*(exp(-...
int(F(x),x = -infinity .. infinity) = 1/8*Pi*(exp(-...

Remark. The integral for this problem is g(x), but it CANNOT be used in any meaningful way
to solve the problem at hand.

> g := z -> subs(Z=z,int(cos(Z)/(Z^4 + 4),Z)):
`G(x) ` = cos(x)/(x^4 + 4);
`G(x) = `, int(F(x),x) = g(x);
`G(oo) - G(-oo)` = g(infinity) - g(-infinity);
`G(oo) - G(-oo)` = simplify(g(infinity) - g(-infinity));
v := int(cos(x)/(x^4 + 4),x=-infinity..infinity):
print(int(F(x),x=-infinity..infinity) = v);
print(Re(int(F(x),x=-infinity..infinity)) = evalf(evalc(Re(v))));
print(`Unfortunately this answer is wrong !`);

`G(x) ` = cos(x)/(x^4+4)

`G(x) = `, int(F(x),x) = (-1/16-1/16*I)*(-Si(x-1-I)...
`G(x) = `, int(F(x),x) = (-1/16-1/16*I)*(-Si(x-1-I)...
`G(x) = `, int(F(x),x) = (-1/16-1/16*I)*(-Si(x-1-I)...
`G(x) = `, int(F(x),x) = (-1/16-1/16*I)*(-Si(x-1-I)...

`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...
`G(oo) - G(-oo)` = (-1/16-1/16*I)*(-Si(infinity-I)*...

`G(oo) - G(-oo)` = -1/4*Pi*(-sin(1)*cosh(1)-cos(1)*...

int(F(x),x = -infinity .. infinity) = 1/8*Pi*sin(1+...
int(F(x),x = -infinity .. infinity) = 1/8*Pi*sin(1+...

Re(int(F(x),x = -infinity .. infinity)) = .39923829...

`Unfortunately this answer is wrong !`

 

Which does NOT agree with the answer obtained via residues.

> `F(x)` = F0(x);
val := -2*Pi*(Im(r2)+Im(r3)):
print(int(F(x),x=-infinity..infinity) = val);
val := factor(-2*Pi*(Im(r2)+Im(r3))):
print(int(F(x),x=-infinity..infinity) = val);
val := evalf(-2*Pi*(Im(r2)+Im(r3))):
print(int(F(x),x=-infinity..infinity) = val);
print(`This answer obtained with residues is correct !`);

`F(x)` = cos(x)/(x^4+4)

int(F(x),x = -infinity .. infinity) = -2*Pi*(exp(-1...

int(F(x),x = -infinity .. infinity) = 1/8*Pi*(exp(-...
int(F(x),x = -infinity .. infinity) = 1/8*Pi*(exp(-...

int(F(x),x = -infinity .. infinity) = .5211067072

`This answer obtained with residues is correct !`

 

 

Lemma 8.1 (Jordan's lemma) Suppose P and Q are polynomials of degreee m and n , respectively, where m+1 <= n .

If C[R] is the upper semicircle z = R*exp(i*theta) , for -pi <= theta `` <= `` pi , then

 

Limit(int(P(z)/Q(z)*exp(i*z),z = C[R] .. ``),R = in... .

 

End of Section 8.5.