Contour Integration

1 downloads 0 Views 1MB Size Report
Mar 9, 2016 - (2.1) The built-in Mathematica procedure NIntegrate admits the input of a (simple) contour of .... 'solK' assumes the value T|F. With the parameter 'selectPoles'={ i, j, … ...... z a change of the integration variable z 1ζ is made; note that the differential ...... is an analytic function and the rectangular contour.
MmaDay_WIAS2016_ContourIntegration.nb

Contour Integration a procedure still missing in Mathematica Prof. Dr. Robert Kragler Weingarten University of Applied Sciences [email protected] Download : http://portal.hs-weingarten.de/web/kragler/mathematica/ > Contour_Integration MmaTag_WIAS2016_ContourIntegration.nb MmaDay_WIAS2016_ContourIntegration.nb MmaDay_WIAS2016_ContourIntegration.pdf ContourIntegration.m

3/9/16

1

MmaDay_WIAS2016_ContourIntegration.nb

Initialization In order to execute the subsequent Mathematica code with examples given first the Mathematica package ContourIntegration.m has to be loaded which contains all definitions, procedures and substitution rules etc. The package should be located in the same subdirectory from where the current notebook MmaDay_WIAS2016_ContourIntegration.nb was revoked. Clear["Global`*"] SetDirectory[NotebookDirectory[]]; Get["ContourIntegration`"]

The Mathematica package comprises all definitions, procedures and replacement rules etc. which are required to run the main procedure ContourIntegration etc. After successful execution of the package the Mathematica version, date and time are shown. VersionDateTime Mathematica V10..04.0 for Microsoft Windows (64-bit) (February 26, date= March 7, 2016; time= 14:41h

Special Notation : For sake of better readability some special notations will be introduced and used throughout the notebook which are given here : 2

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Numerical contour integral ∮γ f (z) z und Notation  f_z_ ⟹ γ_

Notation



θ_b_

θ_a_

b ∮ a f (z) z

NIntegrate[f_, Evaluate[Join[{z_},γ_]]] ,WorkingForm  tF

f_z_z_

g_

⟹ NIntegrateEvaluateSimplify

f_ Dt[z_]/.z_g_ Dt[θ_]

,{θ_,a_,b_} ,WorkingForm  tF

Line integral ∫ℒ (t) f (R (t)) · t[R] Notation 

ℒ_,p_

f_ . t[r_]



LineIntegral[f_ . Dt[r_],ℒ_,p_,r_] 

Symbolic contour integral ∮ selPol, polRange, onoff f (z) z Notation 

f_z_ selectPoles_,polesRange_,onoff_



ContourIntegral[f_,z_,selectPoles_,polesRange_,onoff_] 

Historic remarks w.r.t. ContourIntegration : (1) (1) The author’s interest in contour integrals goes back to a lecture on Quantum Theory delivered by Ludwig Waldmann more than 50 years ago at the university of Erlangen. For the quasi-classical treat-

3/9/16

3

MmaDay_WIAS2016_ContourIntegration.nb

ment of the H-atom in the framework of the Bohr-Sommerfeld theory Arnold Sommerfeld (1919) [1-2] used the method of contour integration to evaluate action integrals of the form r = ∮ pr r = 

2 me (E - V) - ℒr2 r 2

.

The following contour integral r =  r1 =

-B-

B2 -A C

= rmin and r2 =

-B+

B2 -A C

A+

2B r

+

C r2

r can be transformed into ∮ γ

1 r

(r2 - r) (r - r1 ) r (r ∈ ) where

= rmax . A complete cycle over r runs around the branch cut which originates

from the square root extending between r1 and r2 . Above the branch cut, i.e. on the path r1  r2 there is pr > 0 thus the positive sign ( + ) must be chosen; below the branch cut, i.e. on the path r2  r1 there is pr < 0 thus the negative sign ( - ) must be selected. Hence, integration involves both branches of a bi-valued function with branch points r1 and r2 . Hence, the complex r-plane can be considered as a Riemann surface with two sheets which is cutted along the real axis between r1 and r2 . A

A

Due to a sophisticated mapping of the complex r-plane onto the Riemann sphere the contour path around the branch cut can be deformed such that the points r0 = 0 and r∞ = ∞ are encircled.

Orientation of the contour path is anti - clockwise.

Contour path around the branch cut between r1 and r2 .

As regards to the simple pole r0 = 0 the residue is res0 = 

r1 r2 , the pole r∞ = ∞ yields res∞ =

the sum of both residues gives the value of the contour integral :  = 2 π  (res0 + res∞ ) = -π r1 + r2 + 2 r1 · r2  .

4

3/9/16

 2

(r1 + r2 ). Hence,

=

π(

+

) = -π  +

+

·



MmaDay_WIAS2016_ContourIntegration.nb



(2.1) The built-in Mathematica procedure NIntegrate admits the input of a (simple) contour of points in the complex plane , e.g. γ = {1, ,-1,-,1} (see Paul Abbott [3,4], Thomas Bahder (1995) [5] ). Numerical calculation fo the following contour integral yields : 2π  1

NIntegrate

z

,{z,1,,-1,-,1}//ratChop

z

1

(2.2) Moreover, contour integrals can also be evaluated numerically over a parametrically defined contour, e.g. a spiral-like curve such as p (θ) =  θ  θ + 1 with : ∮ θ_ a_ f_ z_z_ g_ θ_ b_

θ_ b_ , {θ_, a_, b_} ∮ θ_ a_ f_  z_z_ g_ ⟹ NIntegrateEvaluateSimplify f_ Dt[z_]/.z_g_ Dt[θ_]

Parametric plot and integral 8 6 4 2 -5

-2

5

∮ θ0

θ3 π 1  zzθ  θ+1 = 2.13118 + 9.42478  z

-4

3/9/16

5

MmaDay_WIAS2016_ContourIntegration.nb

(2.3) Finally, line integrals ∫ℒ ℱ(R) · R (for scalar or vector fields ℱ(R) ) can be calculated with ∫ℒ_,p_ ℱ_ .  t[R_] ⟺ LineIntegral[ℱ_ . Dt[r_], ℒ_, p_, R_]

Thus : ℒ1 ={cos(3 t), sin(t), sin(2 t)} y

∫ℒ[t], T ℱ[R] . t[R] =

z

π 2

x

Historic remarks w.r.t. ContourIntegration : (2) (3) On The Wolfram Functions Site [6] with URL http://functions.wolfram.com/ there are many special functions defined (besides others) by representations through contour integrals. For example the Gamma 1 function Γ(z) = 2 π  z ∫ℒ -t t z-1 t which is given in terms of the following contour integral : 

-1

Γ(z_) :=

1 ContourIntegrate-t tz-1 , {t, ℒ} 2 π  z -1

The integration path ℒ (in  ) starts at ∞ +  0 above the real axis, goes to ρ +  0, encircles the origin 0 counter-clockwise with radius ρ till ρ -  0 below the real axis and returns to ∞ -  0. 6

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

The procedure ContourIntegrate[f[z,t],{t,ℒ}] which frequently occurs in this comprehensive collection of elementary and special functions suggests that a corresponding routine for the symbolic evaluation of contour integrals exists in Mathematica. However, this essential procedure is neither implemented up to now nor is available elsewhere which is astonishing. According to private discussion with Michael Trott /WRI (2010) who together with Oleg Marichev essentially contributed to Function Site there are various reasons why the implementation of ContourIntegrate has not been done yet. Thus, this was apart from other reasons motivation for the author implementing such a procedure by himself which covers many non-trivial contour integrals but does not claim to treat all possible cases.

Residue Theorem (1) In complex analysis Calculus of Residue is a powerful tool for the calculation of integrals ∮ γ f (z) z of

complex functions f (z) where z ∈  . In many cases it will also be used for the calculation of real integrals (with real variable x ∈  ) [7-12].

γ denotes a positive-oriented closed curve (or contour) in . The integrand f (z) is an analytic function except for a finite number of isolated singular points {z1, z2, … zn} inside the closed contour γ. Thus ∮ f (ζ) ζ = 2 π ∑ Res f (z) m

γ

z=zk

k=1

3/9/16

7

MmaDay_WIAS2016_ContourIntegration.nb

If f (z) has a pole of order m in z0 then g (z) = (z - z0)m f (z) is again an analytic function in z0; for a simple closed contur γ which contains no further singular points of f (z) apart from z0 then there is g (ζ) g(m - 1) (z0 ) 1 m-1 m ∮ f (ζ) ζ = ∮ (ζ-z0 )m ζ = 2 π (m-1)! = 2 π (m-1)! lim zm-1 ((z - z0) f (z)) = 2 π Res f (z) z=z0 z z 0 γ γ

Irrespective of the built-in procedure Residue it is, however, more convenient to have a user-defined procedure calculateResidues at hand ? calculateResidues calculateResidues[f, z, selectPoles_All, polesRange_{ }, onoff_"Off"] evaluates the residues symbolically. 'f' denotes the function f(z) with 'z' as complex variable z∈ . The poles of the denominator of f(z) are calculated using the procedure polesOfComplexFunction[f,z,selectPoles,polesRange,onoff] which returns the list of lists {poles,μ,solK}. 'poles' contains the list of poles (which are determined either by Reduce or Solve), 'μ' is a list containing the multiplicity of every

pole. 'solK' assumes the value T|F. With the parameter 'selectPoles'={ i, j, … } a subset of poles can be selected for the final calculation of residues.

Default value for 'selectPoles' is All. With an additional global variable $κ the number of poles can be controlled. For denominators e.g. ( z -1) == 0 a

sequence of poles results such as zk =2π·k with an additional index k∈ . Hence, for $κ=2 the index k assumes the values {0,1,2} whereas for $κ=-2

the values k={-2,-1,0,1,2}. The sum of residues for the poles selected is calculated and returned. With onoff= "No" printout is completely suppressed.

which considers for a given function f (z) all or a subset of poles zi . The poles zi and their multiplicities μi are deter-mined first from the procedures polesOfComplexFunction and multiplicityOfPoles. Then the correspon-ding residues of these poles are calculated according to the values of the parameter selectPoles which assumes the value All or the list {n, … , m} of selected poles.

8

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Examples for Evaluation of Residues (2) Subsequently, a selection of examples (taken from a much larger list where the original numbering is maintained) for the calculation of residues is discussed. They comprise the following classes :

 Residues for rational polynomials f (z) = Example 2 : Residue of f(z) =

f(z) =

z2 -2 z+7 z-2

Residue.

=

7 z-2

z2 -2 z+7 z-2

:

p (z) q(z)

Res f(z)

z=2

=7

+ 2 (z - 2)0 + 1 (z - 2) has in z0 = 2 the residue Res f (z)

calculateResidues

z2 - 2 z + 7 z-2

Sorted poles of f(z)=

= 7 which can easily be shown with

, z, All, {}, "On"

z2 - 2 z + 7

z1 = 2 is a 1-fold pole

z=2

z-2

For rational functions f(z)=

: {2}

z2 - 2 z + 7 z-2

; {poles,μ}: {{2}, {1}}; solK= F

3/9/16

9

MmaDay_WIAS2016_ContourIntegration.nb

z2 - 2 z + 7

has poles with multiplicity z-2 {{zi ,μi },…}= {{2, 1}} ⟺

f(z)=

residues= {7}

Residues Σ Res(f(z))|z= zi = 7 for pole(s) i= All i

7 Example 8 : Residue of f(z) =

f(z) =

2 z2 +z+1

z2 +1 (z-2 )2

2 z2 +z+1

z2 +1 (z-2 )2

: Res f(z)

=

1- 18

has two double poles in z1,2 = ∓  and one double pole in z3 = 2. The residue for

these poles { -, , 2 } is given by

calculateResidues

f(z)=

z={, 2 }

2 z2 + z + 1

z2 + 1 (z - 2 )2

2 z2 + z + 1

(z - 2 )2 z2 + 1

, z, {2, 3}, {}, "Off";

has poles with multiplicity

{{zi ,μi },…}= {{-, 1}, {, 1}, {2 , 2}} ⟺ 1  1  5 4 residues= + , - +- , +  18 18 2 2 9 9 Residues Σ Res(f(z))|z= zi = i

10

1 18

-



18

for pole(s) i= {2, 3}

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Das gleiche Ergebnis erhält man natürlich auch mit der eingebauten Prozedur Residue Example 9 : Residue of f(z) =

f(z) =

2 z2 +17

(z-1)3 (z+1)3

2 z2 +17

(z-1)3 (z+1)3

: Res f(z)

z=+1

=

49 16

has in z1,2 = ∓1 single poles of order 3. (The corresponding Laurent series expansion of

f (z) can be calculated in a straightforward manner; the residue is the coefficient of (z - 1)-1 from this series) : f[z_] :=

2 z2 + 17

(z - 1)3 (z + 1)3

(ser = (Series[f[z], {z, 1, 1}] // Normal) /. {(z - 1)  ζ} /. {ζ  HoldForm[(z - 1)]}) //

a1 = Coefficient[ser // ReleaseHold, 1 / (z - 1)] polyForm

253 (z - 1) 128

49

-

83 32

+

49

16 (z - 1)

-

49

16 (z - 1)2

+

19

8 (z - 1)3

16

The same result will be obtained by means of calculateResidues for the triple pole z2 = +1. calculateResidues

2 z2 + 17

(z - 1)3 (z + 1)3

, z, {2}, {}, "Off";

3/9/16

11

MmaDay_WIAS2016_ContourIntegration.nb

f(z)=

2 z2 + 17

(z - 1)3 (z + 1)3

has poles with multiplicity

{{zi ,μi },…}= {{-1, 3}, {1, 3}} 49 49 residues= ,  16 16

Residues Σ Res(f(z))|z= zi = i

Example 11 : Residue of f(z) =

1

 1 + z2 

n

49 16

:



for pole(s) i= {2}

Res

1 n 1 + z2 

z=

=

1

1

 22 n-1

2n-2 n-1

As is easily demonstrated with Mathematica the residue for z0 =  is equal to 1 n  1 + z2 

Res

z=

=

1 1 2 n-2    22 n-1 n - 1 n=10

 -  , -  , - 3  , - 5  , - 35  , - 63  , - 231  , - 429  , - 6435  , - 12 155   2

4

16

32

256

512

2048

4096

65 536

131 072

$Assumptions = (n ∈ Integers); 1 t1 = TableResidue , {z, }, {n, 1, 10} 1 + z2n

t2 = Table

t1 === t2 -

 2

,-

 4

 1

,-

1

22 n-1 3 16

,-



2n-2 , {n, 1, 10}; n-1

5 32

,-

35  256

,-

63  512

,-

231  2048

,-

429  4096

True

With calculateResidues the same result is obtained

12

3/9/16

,-

6435  65 536

,-

12 155  131 072



MmaDay_WIAS2016_ContourIntegration.nb

TablecalculateResidues -

 2

,-

 4

,-

3 16

,-

5 32

,-

1 + z2n 1

35  256

Example 13 : Residue of f(z) = 1/z :

, z, {2}, {}, "No" , {n, 1, 10}

63 

,-

512

,-

Res f(z)

231  2048

z= 0

429 

,-

=1

4096

,-

6435  65 536

,-

12 155  131 072



Because f(z) = 1/z has an essential singularity in z0 = 0 the built-in procedure Residue (and also calculateResidues ) cannot be applied immediately. However, the Laurent series expansion of 1/z ∞

for z0 = 0 leads to the series f(z) = ∑

1

k=0 k!

  = ∑ z 1 k

0

k=-∞ (-k)! 1

zk which is calculated to terms of order n :

truncSer[n_] := Series1/z /. {1 / z  ζ}, {ζ, 0, n} // Normal /. {ζ  1 / z}

(ser = truncSer[8]) // polyForm 1+

1 z

+

1 2

z2

+

1 6

z3

+

1 24

z4

+

1 120

z5

+

1 720

z6

+

1 5040

z7

+

1 40 320 z8

Obviously Residue obtains for the truncated series the correct value Res 1/z Residue[truncSer[100], {z, 0}]

z=0

1

 Residues for products of rational polynomials and trigonometric functions f (z) = Example 14 : Residue of f(z) =

z

1+z4

:

Res f(z)

z= (±1+)

2

3/9/16

=-

-



1 2

p (z) q(z)

Cos1 2 +Sin1 2  2

= a-1 = 1 :

(α z) ·  cos sin (α z)

2

13

MmaDay_WIAS2016_ContourIntegration.nb

The poles of f (z) =

are located in the upper complex half-plane + and sind z3,4 =

1 1+z4

sol = Solve1 + z4  0, z /. {Rule[a_, b_]  b} // Flatten // ce;

±1+ 2

solS = SortBy[sol, 0 < Im[#] &] (* Pole in + *)

solS〚{3, 4}〛 -

1+

1-

,

2

1-

,-

2

1+

,

2

1-

,

2

1+ 2



2



Hence, the sum of residues for z3,4 = calculateResidues  z

 z

1 + z4

∓1+

turns out to be evaluated with calculateResidues as :

2

, z, {3, 4} // ce // sf ;

has poles with multiplicity z4 + 1 {{zi ,μi },…}= -(-1)1/4 , 1, -(-1)3/4 , 1, (-1)1/4 , 1, (-1)3/4 , 1 ⟺ residues=

f(z)=



 14 +

-

14

  4

 14 +



  4

1

2



-

Cos

1

2

 -  Sin

2

1 2

Cos

1 2

1

2

 +  Sin

 1 2

,-



,

 14 -

  4

 14 -

2



  4



1

2

-

Cos

1

2

2

1 2

Cos 2

3/9/16

 +  Sin

1 2

1

2

 -  Sin



1 2

,





MmaDay_WIAS2016_ContourIntegration.nb

Residues Σ Res(f(z))|z= zi = i

Example 16 : Residue of f(z) =

1 sin(z)n

:

1

+

3

+

1 Sin[z]n

47

+

1 2

sin

1 2

2 Res f(z)

The power series expansion of f (z) = ser9 = Series

-



1

sin(z)n

z= 0

= =

 + cos

1 2



2

for i= {3, 4} poles

Pochhammer [1/2,-1+n] Pochhammer[ 1,-1+n]

in z = z0 up to order n = 9 is

, {z, z0 = 0, n = 9} // Normal

3229

+

35

+

1 295 803 z

+

1 313 487 619 z3

128 z 13 305 600 43 589 145 600 z9 2 z7 40 z5 5040 z3 5 7 172 819 963 z 248 460 536 251 z 1 245 940 242 556 237 z9 + + 20 756 736 000 118 562 476 032 000 2 554 547 108 585 472 000

+

Obviously, the residue for z0 = 0 is given as the coefficient of z-1 of the series (with n=9) Coefficientser9, z-1  35

128

Subsequently calculateResidues is applied to the series expansion of sin(z)-n for n = {1, ... 21} and the coefficient a-1 (n, z) is determined from the resulting truncated power series.

3/9/16

15

MmaDay_WIAS2016_ContourIntegration.nb

$Assumptions = (n ∈ Integers);

a-1 [n_, z_] := CoefficientSeries

1 Sin[z]n

, {z, 0, n} // Normal, z-1

residues = TablecalculateResiduesa-1 [n, z] * 1,

1

,

2

3

,

8

5

,

16

35

,

128

63

231

,

256

,

1024

429

6435

,

2048

,

32 768

1 z

, z, {1}, {}, "No", {n, 1, 21, 2}

12 155

,

65 536

46 189 262 144



The resulting sequence of residues of sin(z)-n in z0 = 0 can be expressed as quotient of Pochhammer symbols (1/2)m-1 with the help of FindSequenceFunction ; thus the sequence above can easily be verified. (1)m-1

resSin2n = FindSequenceFunction[residues][m] Table[resSin2n, {m, 1, 11}] Pochhammer 12 , m - 1 Pochhammer[1, m - 1]

1,

1 2

,

3 8

,

5

16

,

35

128

,

63

231

,

256

1024

,

429 2048

6435

,

32 768

 Residues for special functions with ζ(z) and Γ(z) Example 17 : Residue of fn (z) =

For f (z) =

ζ(z)

(z-1)n

ζ(z)

(z-1)n

:

Res fn (z)

z= 1

12 155 65 536

= (-1)(n-1)

γn-1

(n-1)!

,

46 189 262 144

(n = 2, 3, ...)



where ζ denotes the Zeta function the residue for z0=1 is given as (-1)n

the Stieltjes constant StieltjesGamma[n].

16

,

3/9/16

γn n!

; here γn is

MmaDay_WIAS2016_ContourIntegration.nb

TablecalculateResidues -γ1 ,

γ2 2

,-

ζ(z)

(z - 1)n

, z, {1}, {}, "No" , {n, 2, 10} // tF

γ3 γ4 γ5 γ6 γ7 γ8 γ9 , ,, ,, , 6 24 120 720 5040 40 320 362 880

The residue can be calculated for an arbitrary power of (z - 1)n by means of calculateResidues, for example for n = 51. calculateResidues

f(z)=

ζ(z)

(z - 1)51

ζ(z)

(z - 1)51

, z, {1} // N

has poles with multiplicity

{{zi ,μi },…}= {{1, 51}}



residues= {StieltjesGamma[50] /

30 414 093 201 713 378 043 612 608 166 064 768 844 377 641 568 960 512 000 000 000 000}

Residues Σ Res(f(z))|z= zi =

γ50 / 30 414 093 201 713 378 043 612 608 166 064 768 844 377 641 568 960 512 000 000 000 000 i

for pole(s) i= {1}

4.1699 × 10-63

Example 19 : Residue of fm n p q z, s = Γ3 + s Γs - 3 Γ1 - 12 - s z-s : Res f(z, s)

s= 3

=-

64 z3

π

The integrand of the Meijer G -function G22 11(z |...) (which will be investigated in detail later [13-15]) is defined as product of Γ-functions f2211(z, s) = Γ(3 + s) Γ(-3 + s) Γ1 - 12 - s z-s. As to these 3/9/16

17

Γ

(

) = Γ( + ) Γ(- + ) Γ -

MmaDay_WIAS2016_ContourIntegration.nb

- 

-

functions the residues are evaluated for the sequence of singularities in s0 = {3, 2, 1, 0, -1, … , - 3, …}. 2

For special functions (such as fm n p q(z, s) which essentially consist of Γ-functions) a modified search strategy must be applied in order to find the singularities. They are determined with the help of the proce-dure findSingularities; the subsequent calculation of the corresponding residues is achieved with the modified procedure calculateResidues4SpecFct.

? calculateResidues4SpecFct calculateResidues4SpecFct[f, s, selectPoles_:None, polesRange_:{ }, onoff_:"Off"] evaluates the residues symbolically. 'f' denotes the special function (e.g. MeijerG-function) f(s) with 's' as complex variable s∈ . The singularities of f(s) are determined by calling findSingularities within the

range given by 'polesRange'={a,b}; the list of lists {poles,μ,solK} is returned where 'poles' contains the list of singularities, 'μ' is a list containing

the multiplicity of every pole and solK = 0 is set. For special functions the parameter 'selectPoles'= None must be chosen. With an additional global variable $κ the number of poles can be controlled. Hence, for $κ=2 the index k assumes the values {0,1,2} whereas for $κ=-2 there is k={-2,-1,0,1,2}. The sum of residues for the singularities selected is calculated and returned. With onoff= "No" printout is suppressed.

Here, the residues are determined for the singularities in the integer values of s0 .

Table[{s0 , calculateResidues4SpecFct[f2211[z, s], s, None, {s0 , s0 } // 3, -

64

- 3, -

π

, 2, -

32

π

Evaluate, "Off"] // tF }, {s0 , 3, -4, -1}] // sf

, 1, -

6

π

, 0, -

π z3 20 log(z) + 40  - 49 + 20 ψ(0)  72 

z3

z2

7680

z

π

3

, - 1,

, - 4, -

π z

, - 2, -

1

π z2 ,

π z4 140 log(z) + 280  - 503 + 140 ψ(0)  92  48

160

107 520

The constants which occur are  = EulerGamma and ψ(0)   = PolyGamma0,  .

18

3/9/16

k

k

2

2



MmaDay_WIAS2016_ContourIntegration.nb

ContourIntegration (1) Contour integration is a method for the calculation of certain integrals along a path γ in ; this method is closely related to the calculus of residues as shown before. Besides others the use of contour integrals is the evaluation of integrals along the real axis which are not easily obtained by using only methods with real variables. The main applications of contour integration are :  integration of a complex-valued function f (z) along a curve γ in ,  application of Cauchy’s integral theorem,  application of the residue theorem,  definition of special functions in terms of contour integral representation. The following approach is an attempt of implementing the procedure ContourIntegration in order to close a gap in Mathematica. ? ContourIntegral "ContourIntegral[f, z, selectPoles_All, polesRange_{ }, onoff_\"On\"] evaluates contour integrals symbolically in the complex plane  by means of the residues for the poles selected. 'f' denotes the integrand f(z) of the contour integral where 'z' is the integration variable z∈ . If the parameter 'selectPoles' is given as { i, j, … } then a subset of poles zi ,zj ,… is considered only for residues; default value for 'selectPoles' is 'All' considering all poles for the calculation of residue.

The sum of residues is evaluated with the procedure calculateResidues[…]. However, if the parameter 'selectPoles' is 'SpecFct' then f(z) is assumed being

a special function, for example the integrand fm n p q (z,s) of the Meijer G-function. The parameter 'polesRange'= {smin , smax } confines the search range in

which findSingularities[…] determines the singularities. Procedure calculateResidues4SpecFct[…] evaluates the corresponding residues. Finally, the sum of

residues will be multiplied by 2π and returned in the variable  as value for the contour integral. With \"No\" intermediate printout is complete suppressed."

3/9/16

19

MmaDay_WIAS2016_ContourIntegration.nb

ContourIntegration (2) In this context introduction of a special notation for contour integrals is suitable : ∮selectPoles_,polesRange_,onoff_ f_ z_ ⟺ ContourIntegral[f_, z_, selectPoles_, polesRange_, onoff_]

As an example the complex function f (z) = z2,3 =

1∓

3

2

is considered. f (z) has three double poles in z1 = -1 and

z3 +12 1

. Taking into account only the poles z2,3 the contour integral yields

 = ContourIntegral (z

3

1

Sorted poles of f(z)=

z3 + 1

2

: -1, -1,

1 2

-



3

1 ,

2

2

-



3

1 ,

2

2

+



3

z3 =

20

1 2

1 2

-

+





1 ,

2

z1 = -1 is a 2-fold pole

z2 =

+ 1)2 1

3 is a 2-fold pole 2

3 is a 2-fold pole 2

3/9/16

2

+



, z, {2, 3}, {}, "On"; 3 2



MmaDay_WIAS2016_ContourIntegration.nb

1

For rational functions f(z)=

z3 + 1

2

f(z)=

z3

; {poles,μ}: -1, -(-1)2/3 , (-1)1/3 , {2, 2, 2}; solK= F

1

+ 1

has poles with multiplicity 2

{{zi ,μi },…}= {-1, 2}, -(-1)2/3 , 2, (-1)1/3 , 2 2 1 1 residues=  ,   + 3 , -  - + 3  9 9 9

Residues Σ Res(f(z))|z= zi = i

2 9



for pole(s) i= {2, 3}

2 all residues: Σ resΣ= - ; selectPoles= {2, 3} i 9

Contour integral = ∮

1

1 +

2 z3 

z = -

4π 9

The same result is obtained using the special notation with ∮ ...

=

{2,3},{},"No"

(z3

+ 1)2 1

z ;

2 all residues: Σ resΣ= - ; selectPoles= {2, 3} i 9

3/9/16

21

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮

1

1 +

2 z3 

z = -

4π 9

ContourIntegration (3) The examples given for contour integrals are classified according to the following groups :  (1) Rational polynomials f (z) =

p(z)

 (2) Products of rational polynomials and trigonometric functions f (z) = q(z)

 (3) Products of rational polynomials and hyperbolic functions

f (z) =

p(z) q(z) p(z)

(α z)  cos sin (α z)

 cosh (α z sinh (α z

 (4) Rational functions of trigono./hyperbol. functions F( sin(θ), cos(θ) ) , F( sinh(θ), cosh(θ) ) q(z)

 (5) Transformation of indefinite integrals into contour integrals by means of change of integration variables  (6) Contour integrals with branch cuts

ContourIntegration (3.1)  Rational polynomials f (z) =

p(z) q(z)

In order to calculate indefinite integrals ∫-∞

+∞ p(x) q(x)

x the integrand of which are rational functions (consisting of poly-

nomials p(x), q(x) where q(x) ≠ 0 for each real x ∈ ) it is assumed that the interval (-∞, +∞) is extended to contour path γ which is closed in + . It is supposed that the contribution of the integral over the semi-circle R with R  ∞ will vanish (which has to be proved in each case). 22

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

 = ∫-∞

+∞ p(x) q(x)

x = ∮

p(z)

γ

q(z)

z = ±2 π  ∑ Res k

p(z)

j=1

q(z)

z=zj

If q(z) has at least one zero (generally { z1, z2, … , zk} denotes the zeros of q(z) in + or -) then the contour path γ is closed in the upper half-plane. The sign depends on the orientation of the contour γ : if the path orientation is in the mathematical positive sense (i.e. anti-clockwise) then the positive sign holds; if the path orientation is in the mathematical negative sense (i.e. clockwise) then the negative sign is obtained for the integral. Example 2 : ∮  + z+1 γ

1

1 z-1

+

1 z+

-

1 z-

  z = 8π 

The integrand consists of a sum of polynomials qi (z) with simple poles {1, -1, , -}. Because a single function is expected the terms must be combined with Together . ζ = {1, -1, , -};

f[z_, ζ] =  4

(z + ζ〚k〛) 1

// Together // tF

ContourIntegral[f[z, ζ], z, All, {}, "No"]; k=1

(z - 1) (z - ) (z + ) (z + 1) 4 z3

all residues: Σ resΣ= 4; selectPoles= All i

Contour integral = ∮

Example 6 : ∮ γ

z

z(z+2)

(-1 + z) (- + z) ( + z) (1 + z) 4 z3

 z =  π(1 - -2 

The function f(z)=

z

z (z+2)

z = 8  π

has two simple poles in z1 = -2 and z2 = 0.

3/9/16

23

MmaDay_WIAS2016_ContourIntegration.nb

z

z (z + 2)

ContourIntegral

f(z)=

z

z (z + 2)

, z, All, {}, "Off";

has poles with multiplicity

{{zi ,μi },…}= {{-2, 1}, {0, 1}} 1 1 residues= ,  2 2 2

Residues Σ Res(f(z))|z= zi = i

all residues: Σ resΣ= i

Contour integral = ∮

Example 11 : ∮ γ

f(z) =

2 z2 +z +1

z2 +1 (z-2 )2

2 z2 +z +1

z2 +1 (z-2 )2

z =

1 2

-

z

2

2 2 1

z (2 + z)

π 9

(1 + )

-

1



2 2 1

for pole(s) i= All

; selectPoles= All

z =  π ( for z2,3 ∈ + )

pole z1 = + with

g(z) = (z - ) f (z) =



g(z) = (z + ) f (z) =

2 z2 +z +1

(z+) (z-2 ) 2 z2 +z +1

2

(z-) (z-2 )

double pole z3 = 2  with g(z) = (z - 2 ) f (z) =

24

2

has two single poles in z1,2 = ∓  and a double pole in z3 = 2  .

If all poles are considered for the calculation : pole z2 = - with

π

2 z2 +z +1 z2 +1

2

gives Res f (z)

gives Res f (z)

gives

3/9/16

Res f (z)

z=+

z=- z=2 

= g() = -

1+ 2

= g(-) = -

;

1- 18

= g' (2 ) = -

;

5+4  9

MmaDay_WIAS2016_ContourIntegration.nb

application of the residue theorem yields: ∮ f (z) z = 2 π  ∑ Res f (z) 3



j=1

= 2 π   - 1+ 2

If, however, only the poles z2,3 ∈ + are considered then the contour integral is ≠ 0 :

ContourIntegral

f(z)=

2 z2 + z + 1

z2 + 1 (z - 2 )2

2 z2 + z + 1

(z - 2 )2 z2 + 1

z=zj

1- 18

-

5+4  9

 =0.

, z, {2, 3}, {}, "Off";

has poles with multiplicity

{{zi ,μi },…}= {{-, 1}, {, 1}, {2 , 2}} ⟺ 1  1  5 4 residues= + , - +- , +  18 18 2 2 9 9

Residues Σ Res(f(z))|z= zi =

1

i

all residues: Σ resΣ= i

Contour integral = ∮

Example 17 : ∮ 1 10

π 4  h[] +  -1 +

γ

5

hz)

z5 - +

z =

2 5+

5

1 18

18

-



18

-



for pole(s) i= {2, 3}

18

; selectPoles= {2, 3}

1 + z + 2 z2

(-2  + z)2 1 + z2 

h(-1)1/10  -  h-(-1)3/10  - 

The poles of the function f (z) =

5 h-(-1)3/10  -

z5 - h(z)

are

5

z =

10 - 2

 .

5

1 9

+

 9

π

h-(-1)3/10  -  h-(-1)7/10  - 

3/9/16

5 h-(-1)7/10  +

10 - 2

5

h-(-1)7/10  -  h(-1)9/10  + 

5 h(-1)9/10  -

2 5+

5

h(-1)9/10 

25

MmaDay_WIAS2016_ContourIntegration.nb

z =. ;

poles = Solvez5  , z // ce // Flatten /. {Rule  Set}

poles // fs ,

5 8

+

5 8

+ -

1 4

+

5 4

, -

-

1 4

-

5 4

5 8

-

, -

5 8

, (-1)1/10, -(-1)3/10 , -(-1)7/10 , (-1)9/10  Remove[h]; z =. ;

ContourIntegral

z5 -  h[z]

all residues: Σ resΣ=

-

1 4

5 4

+

5 8

-

5 8

,-

+

5 8

5 8

+ -

1 4

+

5 4



, z, All, {}, "No";

i

1 20

4 h[] + - 1 +

5 -

5 h- (- 1)7/10  -  Contour integral = ∮ 1 10

π 4  h() + 10 - 2

5 +∞

Example 21 : ∫

-∞

2 5 + 10 - 2

-  + z5 h[z]

2 5 +

(n-1)!

5

h(- 1)1/10  - h- (- 1)3/10  -

h- (- 1)7/10  - h(- 1)9/10  +

z =

5  +   5 - 1 h - 1  -

h- (- 1)7/10  - 

ζ(ζ-z)n

5

10 - 2

10

5 h(- 1)9/10  + 

5

5 h- (- 1)7/10  -  h- (- 1)7/10  -

 ζ = 2 π  - z  (1)n-1 1 n

This sequence of functions  f1 =

,

ζ (ζ-z) 1!

,

ζ (ζ-z) 2!

2 5 +

, … , fn =

by application of successive derivatives ∂{z,n} f1 (ζ , z) :

26

h- (- 1)3/10  - 

10 - 2

2 5 +

5

h- (- 1)3/10  - h- (- 1)7/10  -

5  h(- 1)9/10  ; selectPoles= All

5 h- (- 1)3/10  -  h- (- 1)3/10  +

5  h(- 1)9/10  + 

5 h(- 1)9/10  -  h(- 1)9/10 

(n = 1, 2, ...)

ζ (ζ-z) 1

5 h- (- 1)3/10  + 

2

3

3/9/16

(n-1)!

ζ (ζ-z)n

 (n =1,2,… ) is generated from f1(ζ , z)

MmaDay_WIAS2016_ContourIntegration.nb

z =. ; ζ =. ; f[1] =

ζ (ζ - z) 1

; f[n_] := ∂{z,n-1} f[1];

Remove[g]; Table[g[n][z], {n, 1, 10}]; Table[f[n], {n, 1, 5}]

Table[g[n][z] = ContourIntegral[f[n], ζ, {1}, {}, "No"], {n, 1, 5}] 

ζ (- z + ζ) 1

,

ζ (- z + ζ)2 1

Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

-

2π

,

2π

,-

,

1

ζ (- z + ζ)3 2

ζ (-z + ζ) 1

ζ (-z + 2

ζ (-z + 6

ζ (-z +

ζ = -

ζ)2 ζ)3 ζ)4

24

ζ (-z + ζ)5

4π

,

ζ =

2π

,

ζ (- z + ζ)5 24



2π z2

4π z3

12  π z4

ζ = -

12  π

ζ (- z + ζ)4 6

z

ζ = ζ =

,

,-

48  π z5

48  π



The resulting sequence can be transformed into a function which involves the Pochhammer symbol (1)m-1≡ Pochhammer[1,-1+m] involviert. z

z2

z3

z4

z5

Table[ ContourIntegral[∂{z,m} f[1] // Evaluate, ζ, {1}, {}, "No"], {m, 0, 10}] // FindSequenceFunction[#][m] &

Contour integral = ∮

1

ζ (-z + ζ)

ζ = -

2π z

3/9/16

27

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

2π -

28

1 z

m

1

ζ (-z + 2

ζ (-z + 6

ζ)2 ζ)3

ζ (-z +

ζ)4

24

ζ (-z +

ζ)5

120

ζ)6

ζ (-z +

720

ζ (-z + ζ)7 5040

ζ (-z + ζ)8 40 320

ζ (-z + ζ)9

ζ =

ζ =

ζ =

ζ)11

48  π z5

240  π z6

1440  π z7

10 080  π

ζ = ζ =

z3

z4

ζ = ζ =

4π

12  π

ζ = -

362 880

ζ (-z +

z2

ζ = -

ζ (-z + ζ)10 3 628 800

2π

z8

80 640  π z9

725 760  π

ζ = -

z10

7 257 600  π z11

Pochhammer[1, -1 + m]

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Conclusion : according to Cauchy’s integral theorem g(z) =

2π 1



γ

ζ-z

f(ζ)

ζ and ∂{z,m} g(z) = ∮ ∂{z,m}  γ

ζ-z

f(ζ)

 ζ it is

shown that the m-th derivative of the antiderivative g(z) is equal to the corresponding m-th derivative of the integrand f (z) of the contour integral.

Table[∂{z,m} g[1][z] === ContourIntegral[∂{z,m} f[1], ζ, {1}, {}, "No"], {m, 0, 15}] Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

1

ζ (-z + ζ)

ζ = -

1

ζ (-z + ζ)2 2

ζ (-z + ζ)3 6

ζ (-z + ζ)4 24

ζ (-z + ζ)5 120

ζ (-z +

ζ)6

720

ζ)7

ζ (-z +

5040

ζ (-z +

ζ)8

40 320

ζ (-z +

ζ)9

ζ =

2π z

2π z2

ζ = ζ =

z4

48  π z5

240  π z6

ζ = ζ =

z3

12  π

ζ = ζ =

4π

1440  π z7

10 080  π

ζ = -

z8

80 640  π z9

3/9/16

29

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

362 880

ζ (-z +

ζ)10

3 628 800

ζ (-z +

ζ)11

39 916 800

ζ (-z +

ζ)12

479 001 600

ζ (-z +

ζ)13

z10

ζ = -

ζ =

87 178 291 200 ζ (-z + ζ)15

958 003 200  π z13

12 454 041 600  π z14

174 356 582 400  π

ζ = -

1 307 674 368 000 ζ (-z + ζ)16

z11

z12

ζ = -

ζ)14

7 257 600  π

79 833 600  π

ζ =

6 227 020 800 ζ (-z +

725 760  π

ζ =

ζ =

z15

2 615 348 736 000  π z16

{True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True}

ContourIntegration (3.2)

 Products of rational polynomials and trigonometric functions f (z) =

p(z) q(z)

(α z)  cos sin (α z)

Products of rational polynomials and trigonometric functions can also be calculated by contour integration.

Example 23 : ∮ γ

30

 =∫-∞

+∞ p(x) q(x)

cos(α z) 1+z2

z = π cosh(α)

(α x) x ·  cos sin(α x)

(α > 0)

3/9/16

or

+∞ p(x)  α x  =∫ -∞  x q(x)

∮ γ

 =π

+

(α)

α

MmaDay_WIAS2016_ContourIntegration.nb

The contour integral can either be calculated directly with f0(z) = Clear[z, f, α]; f0 :=

z2 + 1

Cos[α z]

cos(α z) 1+z2

;

0 = ContourIntegral[f0 , z, {2}, {}, "Off"] ;

has poles with multiplicity z2 + 1 {{zi,μi },…}= {{-, 1}, {, 1}} ⟺ 1 1 residues=   Cosh[α], -  Cosh[α] 2 2

f(z)=

cos(α z)

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

1 2

Cos[z α] 1 + z2

 cosh(α) for pole(s) i= {2}

z = π cosh(α)

or by decomposition of f0(z) into two parts f1(z), f2(x) with the exponential functions ± α z . Adding both partial results 1,2 yields the same result 0 . f1 :=

 α z

2 z2 + 1

; f2 :=

- α z

2 z2 + 1

;

1 = ContourIntegral[f1 , z, {2}, {}, "No"] ;

Off[Solve::ifun]

2 = ContourIntegral[f2 , z, {2}, {}, "No"] ;

fs @ (1 + 2 ) === 0

3/9/16

31

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ Contour integral = ∮ True

Example 25 : ∮

f (z) =

γ

z2 +14

sin(z)

4 z2 +1

(z+3 )

(z+3 )3

sin(z)

3

 z α

2 1 + z2  - z α

2 1 + z2 

z =

z = z =

π -α 2

π α 2

3 π 23+283 2 +13 4 -7 6  32 768 3

will be integrated over an anti-clockwise oriented contour γ which comprises the triple pole

z2 = -3  and the fourfold pole z1,3 = ∓  . Since sin(z) is holomorphic in  then f (z) holomorphic too apart from the zeros of the polynomial in the denominator.  = ContourIntegral

z2 + 14 (z + 3 )3 Sin[z]

, z, All, {}, "Off" // TrigToExp // sf

has poles with multiplicity (z + 3 )3 (z2 + 1)4 {{zi ,μi },…}= {{- , 4}, {- 3 , 3}, {, 4}} ⟺  (14 Cosh[1] + -9 Sinh[1]) 3  (8 Cosh[3] + - 15 Sinh[3])  (436 Cosh[1] + - 639 Sinh[1]) residues= , ,  1536 32 768 98 304 sin(z)

f(z)=

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

(3

 + z)3

32

for pole(s) i= All

32 768

(1 + z2 )4

Sin[z]

3 23 + 283 2 + 13 4 - 7 6 π 32 768 3

3  (-15 (9 sinh(1) + sinh(3)) + 148 cosh(1) + 8 cosh(3)) z =

3 π (- 15 (9 sinh(1) + sinh(3)) + 148 cosh(1) + 8 cosh(3)) 16 384

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Example 28 : ∮ γ

 z

z -1

z = 

sinh (π)4 12 π3

( $κ = -2)

Note : with the additional global variable $κ the number of poles can be controlled. Numerators such as (z - 1)  0 give rise to a sequence of single poles of the form zk = 2 π  · k with an additional index k ∈ . Thus, e.g. $κ = 2 leads to the index k = {0,1,2}, whereas with $κ =-2 the sequence k = {-2,-1,0,1,2} is obtained. The default value is $κ=0. $κ = 0;

ContourIntegral  z

 z

z - 1

, z, All, {}, "Off" ; (* k=0,1,2 *)

has poles with multiplicity z - 1 {{zi,μi },…}= {{0, 1}, {2  π, 1}} ⟺   -2 π residues=  , 2π 2π

f(z)=

 -  -2 π

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

 z

-1 + z

Table ContourIntegral $κ = 0;

 z

z - 1



for pole(s) i= All

z = -2 π - 1

, z, All, {}, "No", {$κ, -1, -5, -1} // fs

(* reset to default value *)

Contour integral = ∮

 z

-1 + z

z = -

 -2 π 2 π - 12 4π

3/9/16

33

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

-

 Sinh[π]2 π

Example 30 : ∮ γ

,

 z

-1 + z  z

-1 + z  z

-1 + z -1 + z

 Sinh[π]4

z α z

z4 +4

12 π3

 z

,-

z =

 -4 π 2 π - 14

z = z =

192 π3

 -6 π 2 π - 16 23 040 π5

 -8 π 2 π - 18

z = -

5 160 960 π7

 -10 π 2 π - 110

 Sinh[π]6 360 π5

 z = - π sin(α) sinh(α)

For α ≠ 0 the indefinite integral ∫-∞

+∞ x sin(α x) x + 4 4

1 857 945 600 π9 ,

 Sinh[π]8 20 160 π7

,-

 Sinh[π]10 1 814 400 π9



z is equal to the imaginary part of the contour integral Im(∮ z z). 4 +4

Considering all four poles of the denominator the contour integral assumes the value : Clear[z, α]; $Assumptions = α ∈ Reals;  = ContourIntegral

Im @  // fs

34

z  α z

z4 + 4

, z, All, {}, "Off";

3/9/16

γ

α z

MmaDay_WIAS2016_ContourIntegration.nb

z  α z

has poles with multiplicity z4 + 4 {{zi ,μi },…}= - (- 1)1/4 2 , 1, -(- 1)3/4

f(z)=

2 , 1, (-1)1/4

2 , 1, (-1)3/4

2 , 1



residues= 1 1 1 -α 1 -α -  α (Cos[α] -  Sin[α]),  α (Cos[α] +  Sin[α]),  (Sin[α] -  Cos[α]),  ( Cos[α] + Sin[α]) 8 8 8 8

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

-π Sin[α] Sinh[α]

 z α z 4 + z4

1 4

-α 2 α - 1 sin(α) for pole(s) i= All

z = -

1 2

 π -α 2 α - 1 sin(α)

Example 37 : ∮ z cos  z  z =  π γ

1

For the integrand f (z) = z cos  a change of the integration variable z  1

z must be transformed according to Dt  ζ1 , ζ ζ . z

Clear[f, ζ];

ζ

1

is made; note that the differential



1 1 1 f[z_] := z Cos ; changeVar[z_, ζ_] := z  , z  Dt , ζ ζ ; z ζ ζ

f[z] z //. changeVar[z, ζ] -

Cos[ζ] ζ ζ3

As result of this substitution there is an pole of 3rd order w.r.t. ζ.

ContourIntegral-

ζ3

Cos[ζ]

, ζ, All, {}, "Off";

(* z 1/ζ *)

3/9/16

35

MmaDay_WIAS2016_ContourIntegration.nb

f(ζ)= -

ζ3

cos(ζ)

has poles with multiplicity

{{ζi,μi },…}= {{0, 3}} 1 residues=   2



Residues Σ Res(f(ζ))|ζ= ζi = i

Contour integral = ∮ -

1

for pole(s) i= All

2

ζ3

Cos[ζ]

ζ =  π

ContourIntegration (3.3)

 Products of rational polynomials and hyperbolic functions f (z) =

p(z) q(z)

 cosh (α z sinh (α z

Moreover, contour integration can also be applied to products of rational polynomials and hyperbolic functions.

Example 39 : ∮

γ

sinh (z) z4

z =

π 3



 =∫-∞

+∞ p(x) q(x)

x) x ·  cosh(α sinh(α x)

There exists a pole of 4th order in z1 = 0 ContourIntegral

36

Sinh[z] z4

, z, All, {}, "Off";

3/9/16

or

 =∫-∞

+∞ p(x) q(x)

 α x x

MmaDay_WIAS2016_ContourIntegration.nb

f(z)=

sinh(z)

has poles with multiplicity z4 {{zi,μi },…}= {{0, 4}} ⟺ 1 residues=   6

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

Example 41 : ∮

γ

cosh (z)2 n-1 z2 n-1

1

Sinh[z] z4

for pole(s) i= All

6 π

z =

z = 2 π  · 1,

3

3 65 3787 , , 720 , 2 24

... 

(n ∈ )

For odd powers of cosh(z)m (m =1,3,...,11) there results : TableContourIntegral Contour integral = ∮ Contour integral = ∮ Contour integral = ∮ Contour integral = ∮

Cosh[z]2 n-1 z2 n-1 Cosh[z] z

z = 2  π

Cosh[z]3 z3 Cosh[z]5 z5 Cosh[z]7 z7

, z, All, {}, "No" , {n, 1, 6}

z = 3  π z = z =

65  π 12

3787  π 360

3/9/16

37

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ Contour integral = ∮

2  π, 3  π,

65  π

,

12

Cosh[z]9 z9

Cosh[z]11 z11

3787  π

,

360

9509  π

z =

448

z =

9509  π 448

79 549 811  π 1 814 400

,

79 549 811  π 1 814 400



ContourIntegration (3.4)

 Rational functions of trigonometric/hyperbolic functions F( sin(θ), cos(θ) ) , F( sinh(θ), cosh(θ) )

Another type of integrand are rational functions F which comprise combinations of trigonometric or hyperbolic functions. ∫ 0 F(sin(θ), cos(θ)) θ 2π

2π ∫0

=



γ

F(sinh(θ), cosh(θ)) θ = ∮

γ

z 1

1 z

F F

(z-1/z) 2

(z-1/z) 2

, ,

(z+1/z) 2

(z+1/z) 2

 z

 z

(z =  θ)

(z =  θ )

The function arguments are trigonometric respectively hyperbolic functions with θ ∈ {0, 2π}. For trigonometric functions substitution with z =  θ, { cos (θ) =

(z+1/z)

, sin (θ) =

(z-1/z) 2

, θ =

z z

1 z

};

= - θ yields

correspondingly, for hyperbolic functions substitution with z = θ , {cosh (θ) =

38

2

(z+1/z) 2

, sinh (θ) =

(z-1/z) 2

, θ =

z z

}.

1 z

= -θ gives rise to

Subsequent substitution rules are used for all integrands of type F( sin(θ), cos(θ) ) respectively θ θ 3/9/16

θ θ F( sinh(θ), cosh(θ) ); they are already contained in the package ContourIntegration. MmaDay_WIAS2016_ContourIntegration.nb

trigRule =  Sin[θ] 

Csc[θ]  Tan[θ] 

hypRule =  Sinh[θ] 

-1 ) (z-z-1 ) , , Cos[θ]  (z+z 2 2 2 2 , Sec[θ]  (z+z-1 ) , (z-z-1 ) -1 ) (z+z-1 ) - (z-z , Cot[θ]   , (z+z-1 ) (z-z-1 )

Csch[θ] 

Tanh[θ] 

(z-z-1 ) , Cosh[θ]  2 2 , Sech[θ]  (z-z-1 ) -1 (z-z ) , Coth[θ]  (z+z-1 )

θ 

(z+z-1 ) , 2 2 , (z+z-1 ) -1 (z+z ) , θ (z-z-1 )

1 z

z ;

 1 z ; z

(* z = θ *)

(* z = θ *)

Subsequently, applying these substitution rules to the original integrand which consists of trigonometric or hyperbolic functions the integrand will be transformed into a rational polynomial in z whose residues are calculated. Example 45 : ∫ 0

Consider ∫0

π

π

(a + cos(θ) )2

1

(a + cos(θ) )2 1

θ =

2 

∮ (z2 +2 a z +1)2  z = a2 -13/2 γ



1

(a > 1)

θ for a > 1. Since cos(θ) is an even function there is

sponding contour integral will be

z ∮ 2  (z +2 a z +1)2 γ

2

z

Clear[F4, f4, a]; $Assumptions = a > 1 ; 1 F4[θ] F4[θ_] := ; f4[z_] := /. trigRule z (a + Cos[θ])2 f4[z] // tF // sF -

1 2

∫0



(a + cos(θ) )2 1

θ . The corre-

// sf

4z

2 a z + z2 + 12

The denominator has two double roots :

ζ = Solve[Denominator[f4[z]]  0, z] //. {Rule[a_, b_]  List[b]} // Union // Flatten 3/9/16

39

MmaDay_WIAS2016_ContourIntegration.nb

-a -

-1 + a2 , -a +

-1 + a2 

The (double) root z1 = -a -

z2 = a -

a2 - 1 are located outside the unit circle because a > 1. Thus, only the (double) root

a2 - 1 contributes to the contour integral.

ContourIntegral[f4[z], z, {2}, {}, "No"]; Contour integral = ∮ -

4z

1 + 2 a z +

z2 2

z =

2πa

a2 - 13/2

Direct evaluation of the integral (by means of Integrate) ∫0

integral. π

 F4[θ] θ // tF 0

πa

a2 - 1

π

(a + cos(θ) )2

3/2

Example 48 : ∫ 0



a+b cos (θ)2  1

2

θ = ∮

 4 a

-16  z3

2 2 z2 +b z2 +1 

z =

(2 a+b) π (a (a+b))3/2

Clear[F7, f7, a, b]; $Assumptions = {a > 0, b > 0} ; 1 F7[θ] F7[θ_] := ; f7[z_] := /. trigRule z a + b Cos[θ]2 2 f7[z] // ExpandAll // fs // tF // sF -

16  z3

4 a z2 + b z2 + 12 

2

ContourIntegral[f7[z], z, {3, 4}, {}, "No"];

40

1

3/9/16

// sf

θ confirms the value of the contour

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮ -

z a +

Direct calculation of the integral ∫ 0 





F7[θ] θ

(2 a + b) π

0

1 4

(a (a + b))3/2

Example 51 : ∫ 0



cos (3 θ)2 1-2 a cos (θ)+a2

θ = ∮

γ



b  1z + z 

2 2

a+b cos (θ)2 2 1

-  z6 +1 4 (a-z) (a z-1) 2

z6

z =

π (2 a + b)

z =

(a (a + b))3/2

θ gives the same value as the contour integral.

( a ≠ ±1 )

π a6 +1

a6 a2 -1

Clear[F10, f10, a]; $Assumptions = (a ≠ 1 && a ≠ -1 && a ≠ 0 && a ∈ Reals);

F10[θ_] :=

Cos[3 θ]2

1 - 2 a Cos[θ] + a2

; f10[z_] :=

z

F10[θ]

f10[z] // ExpandAll // fs // tF // sF -

 z6 + 12

// TrigExpand /. trigRule

// fs

4 z6 (a - z) (a z - 1)

ContourIntegral[f10[z], z, {1, 2}, {}, "No"]; Contour integral = ∮ -

 1 + z6 2

4 (a - z) z6 (-1 + a z)

Direct evaluation of the integral ∫ 0



cos (3 θ)2

1-2 a cos (θ)+a2

z =

π a6 + 1

a6 a2 - 1

θ confirms the value obtained from contour integration.

Die beiden Regeln rule1 und rule2 vereinfachen die Umformungen.

3/9/16

41

MmaDay_WIAS2016_ContourIntegration.nb

rule1 = 

(1 + A_)2 1



Abs[1 + A]2 1

1

,

rule2 = Abs-1 + A_2   -1 + A2 ; 



1 Abs[A B]

a6 a2 - 1

Example 54 : ∫ 0 tan (θ +  a) θ = ∮ 2π

γ

2 a -z2 2 a z+z3

z = - 2 π 

(a∈)

Clear[F13, f13, a]; $Assumptions = (a ∈ Reals); F13[θ_] := Tan[θ +  a]; F13[θ] f13[z_] := // TrigExpand /. trigRule z f13[z]

// fs // ExpandAll // Together // sf

2 a - z2

2 a z + z3

ContourIntegral[f13[z], z, All, {}, "Off"]; 2 a - z2

has poles with multiplicity 2 a z + z3 {{zi ,μi },…}= {{0, 1}, {- a , 1}, { a , 1}} ⟺

f(z)=

residues= {1, -1, -1}

Residues Σ Res(f(z))|z= zi = -1 for pole(s) i= All i

42

;

F10[θ] θ //. rule1 // fs //. rule2 // sf // tF

π a6 + 1 0

Abs[A_] Abs[B_]



3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Contour integral = ∮

2 a - z2

2 a z + z3

z = -2  π

Direct calculation of the integral ∫ 0 tan (θ +  a) θ confirms the value of the contour integral. 



F13[θ]  θ

-2  π 0



Example 56 : ∮ γ

1 sinh (2 θ)

θ = ∮

γ

2z z4 -1

z =  π

( z >1 )

Note : TrigExpand can be applied to trigonometric and hyperbolic functions likewise. In addition the substitution rule hypRule is used which transforms hyperbolic functions in f (z) by means of z = θ.

Clear[F15, f15]; 1 ; F15[θ_] := Sinh[2 θ]

f15[z] // sf // tF // sF

f15[z_] :=

F15[θ] z

// TrigExpand /. hypRule

-1

2z

All four poles are located inside the contour γ with radius R > 1. If the contour γ is confined to + then the contour integral is non-zero. z4

ContourIntegral[f15[z], z, {1, 3, 4}, {}, "Off"] f(z)=

z z -

1  z

2

z +

1  z

has poles with multiplicity

{{zi ,μi },…}= {{-1, 1}, {-, 1}, {1, 1}, {, 1}} 1 1 1 1 residues=  , - , , -  2 2 2 2

3/9/16



43

MmaDay_WIAS2016_ContourIntegration.nb

Residues Σ Res(f(z))|z= zi = i

Contour integral = ∮

π

for pole(s) i= {1, 3, 4}

1 2

z - 1z + z  1z + z 2

z =  π

In contrast to the definite integral which does not converge the indefinite integral is evaluated with Integrate

int = (Integrate[F15[θ] // TrigExpand, θ] // fs) //. Log Tanh[θ] 

{Log[A_] - Log[B_]  Log[A / B], A_ Log[B_]  Log[BA ] }

Example 57 : ∮ tanh (3 θ) θ = ∮

z6 -1

7 γ z +z

z = 2 π 

( z ≤ 3 )

Clear[F16, f16];

F16[θ_] := Tanh[3 θ]; f16[z_] :=

f16[z] // tF

F16[θ] z

// TrigExpand /. hypRule // sf

z6 - 1 z7 + z

The denominator gives rise to a single pole z1 = 0 in addition to three complex-conjugated poles z2,3 = ∓, z4,5 = ∓

3





and z6,7 = ±

3





. All poles are located with the circular contour γ with radius R >3.

ContourIntegral[f16[z], z, All, {}, "Off"] ;

44

2

2

2

2

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

z6 - 1

has poles with multiplicity z7 + z {{zi ,μi},…}= {0, 1}, {- , 1}, - (- 1)1/6 , 1, - (- 1)5/6 , 1, {, 1}, (- 1)1/6 , 1, (- 1)5/6 , 1 1 1 1 1 1 1 residues= - 1, , , , , ,  3 3 3 3 3 3

f(z)=



Residues Σ Res(f(z))|z= zi = 1 for pole(s) i= All i

Contour integral = ∮

- 1 + z6 z + z7

z = 2  π

By means of Integrate the indefinite integral turns out to be : Integrate[F16[θ], θ] 1 3

Log[Cosh[3 θ]]

ContourIntegration (3.5)

 Transformation of indefinite integrals into contour integrals by change of (integration) variable.

There exist further types of contour integrals which do not fit into the classification scheme of definite integrals discussed above. Nevertheless, using a tricky contour γ as demonstrated in the examples below the integral can be evaluated in terms of a contour integral. Example 58 : ∫ 0

+∞ 1

x3 +1

x =

3



3

This example was treated by S. Hassani [16] as problem 10.3.9, pp. 284-285. Consider the following integral ℐ1

=

∫0

3/9/16



1 x3 +1

x .

45

MmaDay_WIAS2016_ContourIntegration.nb

Since the integrand f (x) =

x3 +1 1

is an odd function the lower integration boundary cannot simply be extended to -∞

. However with a trick the contour can be closed in + nevertheless. Investigation of the singularities of the integrand f (z) which are the roots of z3 + 1 = 0 respectively z(k) = (2 k-1)  π/3 (k = 1,2,3) indicates how the contour must be closed. print"Off", " roots {z(1),z(2),z(3)}= ", roots = Table(2 k-1)  π/3, {k, 1, 3} // ce ;

print["On", " sorted roots {z1 ,z2 ,z3 }= ", SortBy[roots, 0 < Im[#] &] ]; sorted roots {z1 ,z2 ,z3 }= -1,

1 2

-



3

,

2

1 2

+



3 2



Ordering the roots w.r.t. their imaginary parts the root which is situated in the first quadrant is given by z3 = 

π 3

=

1+

3

All three roots together with the (unusual) contour γ which only comprises the pole z3 shows the following graph2

ics. The closed contour γ is defined by the following points in  : 0, R, - 12 + 

sons the interval [0, R] is denoted as 1 , the arc segment [R + 0 , - +  1

- 1 + 

3 2

1+

2

3

.

The contour plot is created by the procedure contourPathGraphic. ? contourPathGraphic

46

 · R, 0  . For consistency rea-

· R] is called R and the interval

 · R, 0 + 0  is 2 where R∞. Hence, the closed contour is given as γ = 1 + R + 2 with a circular 2

segment of 120° containing the pole z3 = 2

3

3 2

3/9/16

2

MmaDay_WIAS2016_ContourIntegration.nb

contourPathGraphic[pts,singPts,contour_:All,opts] shows a contour path which consists of arcs and polylines going through 'pts'. The list of points 'pts' which determines the blue contour are Pi =xi +· yi in the complex plane . The points 'pts' are shown as red dots. 'singPts' denotes a list of singular points which could be included or excluded from

the contour and are shown in black. Index list 'contour' ( e.g. contour={{1,2,3},3,4,{4,5,6},6,7} ) defines the sequence of circular arcs and polylines constituting the contour

path. The sublists { ...,{i,j,k},l,m,n,...}  circle[{i,j,k}] specify arcs through 3 points { Pi ,Pj ,Pk }. Interlaced indices (besides these sublists for arcs), e.g. {...,l,m,n,...} 

line[{...,l,m,n,...}], specify polylines. The default value for 'contour' is All for which a single polyline line[{1,2,3,...,n}] results. For a closed contour the last point is equal to

the first point : Pn == P1 . There is an optional parameter opts___ which specifies e.g. the coordinate range of the plot using PlotRange-> {{x0 ,x1 },{y0 ,y1 }} respectively All.

Moreover, with the global variable $branchCut a branch cut can be drawn. Thus $branchCut={0+ 0,a+ 0} denotes a branch cut along the positive real axis from x=0 to a.

R

2



1

As regards to integration along the contour γ the contour integral γ can be split into three parts : γ = ℐ1 + R + ℐ2 = ∫ 0+∞ 31 x + ∫ R 31 z + ∫ 2 31 z = 2 π  Res f (z) x +1 z +1 z +1

where the residue of z3 is given as :

z3 = 1 +  -

π 3

+

π

3   2 ; res3 = 2 π  Residue

+1

1 z3

z=z3

(♯)

, {z, z3 } // ce

3

Evaluation of the integral ℐ2 along 2 (by change of variables)

The integral R w.r.t. the circular arc R usually vanishes for R ∞. The line integral ℐ2 along 2 (which runs from  -1 +2

3

 ·R to 0 + 0 with R∞) can be rewritten with z = r  ϕ into an integral over r which becomes

quite simple if ϕ = 2π/3 is chosen. Thus : ℐ2 = ∫  2

1 z 3 +1

3/9/16

z

=

 ∫ ∞ (r 2π/3 )3 +1 r 0

2π/3

=

-2π3 ∫ 0



1 r 3 +1

r

=

-2π/3 ℐ1

47

MmaDay_WIAS2016_ContourIntegration.nb

Inserting this result for ℐ2 into (♯) one obtains ℐ1 + 2 = 1 -  2 π/3 ℐ0 = res3 =

yields the result ℐ1 =



.

π

3

-

π 3

. Solving for ℐ0 finally

Solve1 -  2 π/3  ℐ1 == res3, ℐ1 〚1, 1, 2〛 3

3

3



3

Of course, this calculation done in single steps can be completely done with Mathematica by applying the transfor2π mation z r  ϕ with ϕ  to the integral ℐ2. There exist several ways achieving this [17,18]. Hint : it should be mentioned that the integration boundaries must also be transformed w.r.t the new variable ζ i.e. 3

 f[r_] =

1 + z3 1

/. z  r 

2π 3

 * Dr 

2π 3

, r,

varRange = ζ /. {ζ  r}, ζ2z /. ζ2z  z -

Integrate[f[r], varRange ]





2π 3

1 + r3 2π

3

2π 3

ζ2z /. ζ2z  z -

, r, 0, DirectedInfinity-

2π 3

 /. {z  0},

2π 3

 /. {z  ∞} 



3

(i) Change of variable with changeVariable4Integral

The change of variable z r  ϕ with ϕ 

grand f (z) =

1

2π 3

can be explicity performe for the integral [17]. Of course, the inte-

has to be transformed taken into account the ‘Jacobi-determinante’ due to the change of vari-

able, then the differential z and the lower and upper integral boundaries {za, zb} = {0, ∞} . This is achieved with the procedure changeVariable4Integral

48

1+z3

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Clear[fz, z, za, zb, z2ζ, ζ2z, ζ]; SetAttributes[changeVariable4Integral , HoldFirst]; zb_ changeVariable4Integral  ∫za_ fz_  z_, {ζ_, z2ζ_, ζ2z_} :=

Integrate[ (fz /. {z  z2ζ}) * D[z2ζ, ζ], {ζ, ζ2z /. {z  za}, ζ2z /. {z  zb} }];

? changeVariable4Integral changeVariable4Integral[ 

zb_

ζb

fz_  z_, { ζ_, z2ζ_, ζ2z_ } ] calculates the definite integral f (z)  z with a change of variables for the integral  g(ζ)ζ. Here 'fz' is the integrand f(z) zb

ζa

and 'z' the differential. 'z' is the old and 'ζ' the new variable. 'z2ζ' is the transform from z ⟹ ζ (e.g. ζ = r and z2ζ = r· ϕ ), 'ζ2z' is the inverse function (e.g. za_

za

ζ2z = z·- ϕ , ϕ=const ). {'za', 'zb'} are the lower/upper limits of the integral which must be transformed too, i.e. {za , zb } ⟹ {ζa , ζb } = { ζ2z/.{z za},ζ2z/.{z zb}}.

hence

changeVariable4Integral 3



∞ 0

1 + z3 1

z, r, r 

2π 3

, z -

2π 3



3 (ii) Change of variable with the SC package SymbolicComputing

An alternative approach to perform the change of variable is the SC package SymbolicComputing.mx of Youngjoo Chung [18] which is available for different versions of Mathematica. Evaluation of the contour integral γ for the contour γ = 1 + R + 2

The calculation of the contour integral γ w.r.t. the pole z3 = (-1) = γ = ContourIntegral Contour integral = ∮

1

1+

z3

z =

+1

1

z3 1 3

, z, {3}, {}, "No" // ce

1+ 2

3

yields

 3 -  π

3/9/16

49

MmaDay_WIAS2016_ContourIntegration.nb

-

π

+

π

Because of γ = ℐ1 + ℐ2 = 1 -  2 π/3 ℐ1 one finally obtains for the integral ℐ1 3

3

nothing but the positive real axis [0, ∞) ) the result :

ℐ1 = 3



γ

1 -  2 π/3 

3

// fs

Example 59 : ∫-∞  α x -β x x = +∞

2

π/β 

-4β α2

=

∫0



1 x3 +1

x (the contour 1 is

.

This example too was investigated by S. Hassani [16] as problem 10.3.9, pp. 283 -284. The Gaussian integral +∞  α x -β x ℐ = ∫-∞  x 2

can be calculated as contour integral γ using a trick.

where α, β ∈  , β > 0

Applying the method of completing the square to the exponent of  α x -β x one obtains :

ℐ=∫

α R -β x-  α 2 ∞ -β x-  α 2 - α 2β 4 β x =  4 β 2β  x lim ∫  -∞ R ∞ -R 2

2

With change of variable x  z + 

α  2β

=

z=(x-α/2 β)



-4β α2

2

 -β z R ∞ ∫ -R - α/2 β

· lim

R - α/2 β

2

z = 

-4β α2

· R

the definite integral can be evaluated explicity.

Clear[x, z, α, β]; $Assumptions = {α ∈ Reals, β ∈ Reals, β > 0}; ∞ α α 2 ℐ = changeVariable4Integral  α x -β x x, z, z +  , x-  // fs 2β 2β -∞ - 4 β α2

β

π

Side note : Mathematica V9 can calculate this integral directly.

50

3/9/16

(* (†) *)

MmaDay_WIAS2016_ContourIntegration.nb

$Assumptions = β > 0 && β ∈ Reals; 



-∞

 α x -β x x

- 4 β α2

2

β

π

β Here R ≡ ℐ3 = lim ∫ -RR --α/2  -β z z is an integral along the line 3 which is parallel to the real axis but shifted α/2 β R ∞

by -

2

α



. Closing the contour γ = 1 + 2 + 3 + 4 as shown below then the contour integral  = ∮ -β z z = 0

vanishes (due to the Cauchy-Goursat theorem) because  comprised no pole. -ℛ 2

-β z2

γ

is an analytic function and the rectangular contour

1

3

2

+ℛ 4

-α/(2β)



The contour integral γ can be split into four line integrals along the (line) pathes i (i = 1,...4) 2 2 2 2 2 γ = ∮ -β z z = 0 = ∑4i=1 ℐi = ∫  -β z z + ∫  -β z z + ∫  -β z z + ∫  -β z z =     γ

= lim ∫ +R  -β x x + lim ∫ -R R ∞

= -∫

+∞ -∞

-R

2  -β x

R ∞

2

1

-R- α/2 β

x + 0 + lim

R ∞

 -β z z + lim ∫ -R- α/2 β  -β z z + lim ∫ +R- α/2 β  -β z z = R ∞ R ∞ 2

2

+R- α/2 β

∫ -R- α/2 β

3

+R- α/2 β

+R

2

 -β z z + 0 = ℐ1 +ℐ3 ,

4

2

2

The boundaries of the integrals become ±∞ as R∞. For integration along the path 2 (from -R to (-R -  2αβ ) ) and likewise for 4 (from (R -  α/2β) to R) the substitutions z = - (R+ y) respectively z = (R+ y) are made which 2 gives rise to a prefactor lim -β R  0 so that both integrals ℐ2,4 turn out to be zero. Thus, from the sum of four R ∞

line integrals ℐi (i = 1,...4), which is zero anyway only the two terms γ = ℐ1 + ℐ3 survive : γ = ∮ -β z z = 0 = - ∫ γ

2

+∞

-∞

 -β x x + lim ∫  -β z z = R ∞ -R- α/2 β 2

3/9/16

+R- α/2 β

2

π β

+

R

51

MmaDay_WIAS2016_ContourIntegration.nb

(1) (-ℐ1) turns out to be the well-known Gaussian integral so that one immediately obtains for R = $Assumptions = {β > 0 && β ∈ Reals}; ∞

π β

:

ℐ1 = -  -β x x -

π β

2

-∞

(2) The contour integral γ over a closed contour γ is zero :

Off[Part::partd]; $Assumptions = {β > 0 && β ∈ Reals}; γ = ContourIntegral-β z , z, All, {}, "No" ; 2

On[Part::partd];

Contour integral = ∮ -z β z = 0 2

(3) Finally, one obtains for the integral starting from : ℐ = ∫ -∞  α x -β x x =  +∞

Clear[ℐ, α, β] ℐ  - 4 β · α2

ℐ  - 4 β · α2

R

π β

/. Solve[γ == ℐ1 + R , R ] 〚1〛

Thus, the same value

π β



- 4αβ

- 4αβ 2

· R

2

is found which was already obtained for the integral above with the help of the

procedure changeVariable4Integral. (†)

ContourIntegration (3.6 a) 52

2

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

 Contour integrals with branch cuts Remarks to branch cuts

According to the definition from Eric W. Weisstein [19] as explained in MathWorld (2007) a branch cut is a curve whose ends are either open, half-open or closed. In some cases branch cuts are lines or line segments. For clarification of branch cuts the following example is considered :

The function w = f (z) = z2 mapping z ∈  ↦ w ∈  is a well-defined, single-valued function. However, the inverse function w = f -1 z = impossible to define

z is a bi-valued function which maps z = 1 ↦ w =

1 = ± 1. It is

z thus that it is continuous for all complex values of z. There must be a branch

cut for which the function

z becomes discontinuous when this line in  is crossed. For the built-in

function Sqrt Mathematica follows the usual convention that the branch cut for

z is along the nega-

tive real axis, i.e. from (-∞, 0). A branch cut for Sqrt along the negative real axis means that Sqrt[z] (z < 0) with z+ 0 (above) and z- 0 (below) has different values. In general the choice of a branch cut in not uniquely defined but will be chosen so that the analytic properties become simple.



3/9/16

53

MmaDay_WIAS2016_ContourIntegration.nb

An alternative to the representation of multi-valued complex functions by means of branch cuts is the introduction of the concept of Riemann surfaces where a multi-valued function assumes a unique value on a specific sheet (of the Riemann surface) (see e.g. M. Trott [20-21]).

Im (z)

Riemann surface f(z) =

z

Re (z)

In addition to branch cuts singularities are known as branch points; however, the end-points of branch cuts are not necessarily branch points. Branch cuts [19] do not exist for single-valued functions f(z) such as trigonometric, hyperbolic, integer power functions and exponential functions. However, the associated inverse functions f -1(z) such as ArcSin, ArcCos, ArcTan, ArcCot, ArcSec, ArcCsc or ArcSinh, ArcCosh, ArcTanh, ArcCoth, ArcSech, ArcCsch and Log, Sqrt which are multi-valued require for a unique definition of the function branch cuts. In the accompanying file BranchCut.nb (which can be downloaded from MathWorld [19] ) for each inverse function f -1(z) a branch cut plot together visualizations of Ref -1 z , Imf -1(z) and f -1(z)

are shown (see also Yu-Sung Chang's contribution in the Wolfram Demonstrations Project [22] and Maxim Rytin's article for “Integration Across Branch Cuts” [23] ).

54

The examples discussed below are complex-valued functions f (z) with poles and branch cuts. They are either visualized in terms of 3D-plots for  f (z)  , Re(f (z) ) and Im(f (z)) with the help of the procedures 3/9/16

 ( )

( ( )) ( ( )) complexFctPlot3D, AbsReImContPlot3D or as contour plots by means of the procedure complexFctContourPlot with the branch cut being emphasized as a thick green line. MmaDay_WIAS2016_ContourIntegration.nb

? complexFctPlot3D AbsReImContPlot3D complexFctContourPlot complexFctPlot3D[ f, branchTargetPts] displays a complex function f(z) as row of three 3D plots { f(z), Re(f(z)), Im(f(z)) }. The parameter 'branchTargetPts' specifies the list of {startPt,endPt} for an arrow pointing to the branch cut (at endPt), i.e. the excluded discontinuity region shown in red.

AbsReImContPlot3D[fz_, mesh_:100, zrange_:{-2,2}, view_:{0.8,-1.5,1.0}] shows the complex function fz = f(z)

in different representations, i.e. |f(z)|, Re(f(z)) and Im(f(z)) using Plot3D. The graph Plot3D[Im[f[z]],...] displays the discontinuity of f(z) in , whereas ContourPlot[Im[f[z]],...] displays the branch cut more clearly. The (optional) parameters 'mesh', 'zrange'

and 'view' (with default values as indicated) apply only for Plot3D[Im[f[]],...] in order to allow some fine-tuning of the graph.

complexFctContourPlot[f,opts___] displays a complex function f(z) as ContourPlot. A possible branch cut is shown as a green line. 'opts' allows to include additional options such as Epilog .

ContourIntegration (3.6 b)

 Examples for contour integrals with branch cuts

The procedure ReImAbsContPlot is used for visualization of complex functions f (z) with branch cuts. ? ReImAbsContPlot

ReImAbsContPlot[fz_, zRange_:{-2,4}, branchTargetPts_List, mesh_:50, view_:{-3,5,4}, cut_:{{-∞,0},{0,0}} ] displays the complex function fz = f(z) in four different representations : as 3d plots for Re(f(z)), Im(f(z)), |f(z)| (with Plot3D) and as contour plot for Im(f(z)) (with ContourPlot). The graph Plot3D[Im[f[z]],...]

shows the discontinuity region of f(z) in  as a green cut, whereas ContourPlot[Im[f[z]],...] displays the excluded branch cut as a green line.

Optional parameter 'zRange' (with default value {-2,4}) applies only for Plot3D in order to allow some fine-tuning of the 3D plots; the parameter 'branchTargetPts' specifies the list of {startPt, endPt} for a red arrow pointing to the branch cut (at endPt), i.e. the excluded discontinutity region

shown in green. 'mesh' (with default 50) gives the number of mesh lines. 'view' (with default value {-3,5,4}) allows a fine-tuning of the viewpoint for

Plot3D[Im[f[z]],...] to position the branch cut. 'cut' allows to specify the branch cut if different from {-∞,0} on the real axis; ∓∞ is replaced by xmin or xmax.

3/9/16

55

MmaDay_WIAS2016_ContourIntegration.nb

Example 60 : ∮ γ

1 z

z = (2 - 2 )

The function f (z) =

1 z

π

has a branch cut on the negative real axis in addition to a singularity in z = 0 ; it is

visualized with the help of the procedure ReImAbsContPlot.

56

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

z =. ;

ReImAbsContPlot

1 z

, {-2, 4}, {.1, .85, .42, .51}, 100 

Because residues are not defined in branch points respectively branch cuts therefore the contour integral does not give a result. ContourIntegral

1 z

, z, All, {}, "No";

3/9/16

57

MmaDay_WIAS2016_ContourIntegration.nb

However, if for

z the representation

then there is : z =. ; w =. ;

 2 1

Log[z]

z 2

ϕ

// ce /. w_2 

1/4

z ≡  2 log (z) (for z ∈  with ϕ = Arg (z) ∈ (-π, π] ) is chosen 1

 w1/2 , Arg[z]  ϕ // fs // tF

Using the procedure changeVariable4Integral which was introduced earlier the change of variable z  ζ for integration can be made. With the transformation z   ζ (i.e. z2ζ :  ζ ) and its inverse ζ  - log(z) (i.e. ζ2z : -  Log[z] ) the integral is obtained as : $Assumptions = {ϵ > 0 && ϵ ∈ Reals, ζ > 0 && ζ ∈ Reals}; Off[Solve::ifun]; π-ϵ 1 [ϵ] = changeVariable4Integral  z, ζ,  ζ , - Log[z] , Limit[[ϵ], ϵ  0] -π+ϵ z 2  π - ϵ -

- π + ϵ , 2 - 2 

π

In the limit ϵ  0 the parametrized integral assumes the value (2 - 2 ) with the procedure SCMAF from the package SymbolicComputing. Example 61 : ∮ γ



z(z+1)

z = 2 π (sin(π α) -  cos(π α))

( 0 < α < 1,  α π ≡ (-1)α )

π . The same result is obtained

If for the exponent α the value 4/3 is chosen the function becomes f (z) = ReImAbsContPlot

58

z (z + 1) z4/3

z1/3 z+1

; the 3D plots for f (z) are :

, {-2, 4}, {.1, .85, .55, .51}, 100, {-3, 7, 4}

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

+∞

The indefinite integral ∫

-∞



x(x+1)

x can be evaluated with Mathematica straightforwardly if the pole z1 = 0

and the branch cut (-∞, 0] are excluded. Analytic continuation of xα leads to a multi-valued function. The contour excluding the branch cut and the pole in z = 0 is known as “keyhole” contour. It is visualized with the procedure contourPathGraphic. ? contourPathGraphic

3/9/16

59

MmaDay_WIAS2016_ContourIntegration.nb

R branch cut

+ϵ -ϵ

r

As regards to the generation of this particular contour (and others) a particular description language was used for the points defining the contour. The index list contour (e.g. contour = {{1,2,3,4},4,5,{7,6,5},7,8}) gives a sequence of circular arcs and polylines which define the contour path. The sublists {{1,2,3,4},...,{7,6,5},...} specify with circle[{1,2,3,4}] and circle[{7,6,5}] arcs (which contain at least three points e.g. {P7 , P6 , P5 } . Reversed order of points changes the orientation of the circular arcs from 'anti-clockwise' to 'clockwise'. Inserted indices such as {...,4,5,...,7,8} specify polylines line[{4,5}] and line[{7,8}]. With this kind of index list any contour however sophisticated can easily be described. For the power function the branch : zα =  α ln z + arg(z) is chosen with 0 < arg(z) < 2π excluding the negative real axis i.e.  = \{z ∈  z ≤ 0}. As regards to the residue theorem one obtains : ∮ z (z+1) z = 2 π  Res γ





z (z+1)

z=-1

= -2 π  ·  α π

which is independent of the radii r (around z = 0) and R ∞ for the circular arcs R and r .

(i) Due to the pole z2 = 0 the principal value integral must be chosen. Integrate has the option PrincipalValueTrue so that the following result is obtained : 1 = π sin(π α)

60

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

$Assumptions = 0 < Re[α] < 1 && α ∈ Reals; x =. ; xα 1 = Integrate , {x, -∞, ∞}, PrincipalValue  True; x (x + 1)

Re /@ ce @ 1 // fs π Sin[π α]

(ii) If the residue theorem is used with Residue then due to the pole in z1 = -1 the result is found Re ( 2) = 2 π sin(π α) $Assumptions = (0 < α < 1 && α ∈ Reals); z =. ; zα 2 = 2 π  Residue , {z, -1} // ce // sf z (z + 1)

Re /@ ComplexExpand[2 ] // fs 2 π (- Cos[π α] + Sin[π α]) 2 π Sin[π α]

(* 2 =3 *)

(iii) Finally, for the evaluation of the integral also contour integration can be applied where the real part has to be taken from the result : Re ( 3) = 2 π sin(π α) $Assumptions = 0 < Re[α] < 1 && α ∈ Reals; z =. ; zα , z, {1}, {}, "No" // ce 3 = ContourIntegral z (z + 1)

Re /@ ce @ 3 // fs

Contour integral = ∮

z-1+α

1+z

-2  π Cos[π α] + 2 π Sin[π α]

z = 2 π (sin(π α) -  cos(π α))

2 π Sin[π α]

3/9/16

61

MmaDay_WIAS2016_ContourIntegration.nb

Example 62 : ∮ γ

z z(z+1)

z = 2 π

( α = 1 / 2)

With α = 1/2 the complex function from the previous example 61 becomes f (z) = pole in z = -1 and a branch cut (-∞,0] because of the root

62

3/9/16

z.

z (z+1) z

=

1

z (z+1)

; it has a

MmaDay_WIAS2016_ContourIntegration.nb

ReImAbsContPlot

z (z + 1) z

, {-4, 3}, {.3, .84, .45, .48}, 150, {-3, -2, 2}

The contour integral turns out to be ContourIntegral

1

z (z + 1)

, z, {1}, {}, "Off"

3/9/16

(* pole z1 =-1

*)

63

MmaDay_WIAS2016_ContourIntegration.nb

f(z)=

1

z (z + 1)

has poles with multiplicity

{{zi ,μi },…}= {{-1, 1}, {0, 1}} residues= -, Residue

⟺ 1

z (z + 1)

, {z, 0}

Residues Σ Res(f(z))|z= zi = - for pole(s) i= {1} i

Contour integral = ∮



Example 63 :

1 2



γ

z

z2 +1

The function f (z) =

64

z =

z2 +1 z

1

z (1 + z)

π

2

z = 2 π



has two poles in z1,2 = ± and a branch cut (-∞,0] .

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

ReImAbsContPlot

z2 + 1 z

, {-2, 2}, {.1, .85, .47, .50}, 200, {-3, -5, 2}

The so-called keyhole contour which was encountered already in previous examples is supplemented by two additional poles z1,2 = ∓  .

3/9/16

65

MmaDay_WIAS2016_ContourIntegration.nb

(i) Both poles z1,2 = ∓ contribute to the contour integral : z =.; 1

ContourIntegral

2

z2 + 1 z

Contour integral = ∮

π

, z, All, {}, "No"

1 + z2 z

z = 

2 π

2

The additional prefactor

1 2

of the contour integral results from the fact that the original real integral runs

from (-∞,0) and not along the real axis (-∞,∞) .

(ii) Evaluation with Integrate yields for the interval (-∞,0) the value - 2.22144  ~ -

the value +2.22144 ~ [z_] = fs @ 

66

+1 z

z2

π 2

. At first, the indefinite integral 

z

// tF

3/9/16

z z2 +1

z is calculated.

π 2

 and for {0,+∞}

MmaDay_WIAS2016_ContourIntegration.nb

1

logz -

z + 1 - logz +

2

2

z + 1 - 2 tan-1 1 -

2

z  + 2 tan-1  2

z + 1

Then, values for the lower respectively upper boundaries ∓ ∞ are approximated by ∓ 10100 so that one obtains (1 + ) π  2 : 2

2

{-∞,0} = [0] - -1. 10100  /. 2.221441469079183   {0,+∞} = +1. 10100  - [0] /. 2.221441469079183  ({-∞,0} + {0,+∞} ) (1 + ) π 2

Example 64 : ∮  γ

1 z +1 2

The function f (z) = z1,2 = ∓

+

z

 z = ∮  1+

z2 +1 1

+

γ

z

=

z +z5/2  z 1+z2

1+ z +z5/2 1+z2

π

π

2

2



;

;

(*

(*

0 ∫-∞ f(z)z =

+∞ ∫0 f(z)z =

 π 2

π

2

*)

*)

= -π

has a branch cut along the negative real axis and two poles in

3/9/16

67

MmaDay_WIAS2016_ContourIntegration.nb

ReImAbsContPlot

z2 + 1 1

+

z , {-2, 3}, {.1, .85, .45, .45}, 150, {-2, -4, 2.5}

While the contour integral cannot find a reasonable result for the original form of the function ContourIntegral

z2 + 1 1

transformation of f (z) into 68

+ 1+

z , z, {2}, {}, "No"

z z2 +1 z2 +1

z2 +1 1

+

z

leads to a solution of the contour integral if the pole z2 = - is taken 3/9/16

+

 +  z +1

MmaDay_WIAS2016_ContourIntegration.nb

into account; thus the value found is  = -π . fz =

+ z // Together; +1 ContourIntegral[fz, z, {1}, {}, "No" ] 1

z2

Contour integral = ∮



1+

z + z5/2

1 + z2

z = -π

References [1] Arnold Sommerfeld “Atombau und Spektrallinien”, Verlag Harri Deutsch (1978), ISBN 3-87144-484-7 p.655 - 659 ‘Mathematische Zusätze und Ergänzungen’, (4.) Ausführung einiger Integrale auf komplexem Wege. Ludwig Waldmann “Quantentheorie” Vorlesung, WS 1965/66 University of Erlangen [2] Herbert Goldstein, Charles P. Poole Jr. & John L. Safko “Classical Mechanics” 3rd Ed. , Pearson Education, Inc. (2002), Chapt. 10.8, ‘The Kepler Problem in Action and Angle Variables’, pp. 505-516 [3] Paul Abbott “Tricks of the Trade; Contour Integration” The Mathematica Journal, Volume 4 Issue 3 (1994) , pp. 37-38 [4] Paul Abbott “Tricks of the Trade; Mathematica for Scientists and Engineers” The Mathematica Journal, Volume 6 Issue 3 (1996) , pp. 23-24 [5] Thomas Bahder “Mathematica for Scientists and Engineers”, Addison-Wesley (1995), Chapt. 6.4.3, pp. 318 -323

[6] Michael Trott & Oleg Marichev The Wolfram Functions Site : http://functions.wolfram.com/NB/Notations.nb (for the special contour ℒ )

[7] Klemens Burg, Herbert Haf & Friedrich Wille “Funktionentheorie, Höhere Mathematik für Ingenieure, Naturwissenschaftler und Mathematiker”, B.G.Teubner Verlag (2004) , ISBN 3-519-00480-1, Chapt. 3.2, pp. 129 [8] Walter Strampp, Victor Ganzha & Evgenij Vorozhtsov "Höhere Mathematik mit Mathematica, Bd. 4 : Funktionentheorie, Fourier- und Laplacetransformationen", Vieweg Lehrbuch (1997), ISBN 3-528-06791-8, Chapt. 4.1, pp. 100-126 [9] John H. Mathews & Russell W. Howell “Complex Analysis for Mathematics and Engineering” 6th ed., Jones & Bartlett Learning (2012), ISBN 978-1-4496-0445-5, Chapt. 8.7, pp. 334-343 [10] Alexander O. Gogolin “Lectures on Complex Integration”, Springer Internat. Publishing (2014) ISBN 978-3-319-00211-8 3/9/16

69

MmaDay_WIAS2016_ContourIntegration.nb

[11] Dragoslav S. Mitrinović & Jovan D. Kečkić “The Cauchy Method of Residues : Theory and its Applications” (Mathematics and its Applications), D. Reidel (1984) ISBN 1-402-00317-X [12] Dragoslav S. Mitrinović & Jovan D. Kečkić “The Cauchy Method of Residues : Vol 2: Theory and its Applications” (Mathematics and its Applications), Springer Science+Business Media (1993) ISBN-13: 978-94-010-4883-5 [13] Eric W. Weisstein “Meijer G-Function” aus MathWorld (2008) : http://mathworld.wolfram.com/MeijerG-Function.html with supplement MeijerG-Function.nb [14] Frank W. J. Olver, Daniel W. Lozier, Ronald F. Boisvert & Charles W. Clark “NIST Handbook of Mathematical Functions”, Cambridge University Press (2010), ISBN 978-0-521-14063-8, Chapt. 16.17, pp. 415 [15] A. P. Prudnikov, Yu. A. Brychkov & O. I. Marichev “Evaluation of Integrals and the Mellin Transform” Itogi Nauki i Tekhniki, Seriya Matemat. Analiz (1998) Vol. 27, pp. 3-146; A. P. Prudnikov, O. I. Marichev & Yu. A. Brychkov “Integrals and Series. Vol. 3: More Special Functions.” Gordon and Breach (1990), (ap ) Chapt. 8.2 “The Meijer G-Function Gm,n p,q z (bq )  “, pp. 617-626 [16] Sadri Hassani "Mathematical Physics; A Modern Introduction to Its Foundations", Springer-Verlag (1999), ISBN 978-3-642-87431-4, Chapt. 10.3.9, pp. 284 [17] Private Diskussion : Michael Trott / WRI (9/2013), und Diskussionen in MathGroup : Alex Krasnov [mg131613] and Alexander Elkins [mg131572], and David Park MathGroup [mg131569] with his Presentations`StudentsIntegral package [18] Youngjoo Chung MathGroup [mg131582] mit SymbolicComputing` Package presented during WTC2011 (see https://symbcomp.gist.ac.kr ). [19] Eric W. Weisstein MathWorld (2007) see: http://mathworld.wolfram.com/BranchCut.html and BranchCut.nb [20] Michael Trott “Visualization of Riemann Surfaces of Algebraic Functions” Mathematica in Edu. a. Research, Vol. 6, No. 4 (1997), p. 15-36, “Visualization of Riemann Surfaces of Algebraic Functions IIa” The Mathematica Journal, Vol. 7, No. 4 (2000), p. 465-496 , “Visualization of Riemann Surfaces of Algebraic Functions IIb” The Mathematica Journal, Vol. 8, No. 1 (2001), p. 50-62, “Visualization of Riemann Surfaces of Algebraic Functions IIc” The Mathematica Journal, Vol. 8, No. 3 (2002), p. 409-432, “Visualization of Riemann Surfaces of Algebraic Functions IId” The Mathematica Journal, Vol. 8, No. 4 (2002), p. 532-562 . [21] Simo Kivelä “On the Visualization of Riemann Surfaces” The Mathematica Journal, Vol. 11, No. 3 (2009), pp. 392-403 . [22] Yu-Sung Chang “Surface with Branch Cuts” from Wolfram Demonstrations Project, http://demonstrations.wolfram.com/SurfaceWithBranchCuts/ [23] Maxim Rytin “Integration Across Branch Cuts” MathSource [0212-409] (2002)

70

3/9/16

MmaDay_WIAS2016_ContourIntegration.nb

Acknowledgement The author wants to thank Paul Abbott for a private communication offering his help as to clarify the notational problem for line integrals [4]. Concerning the problem of a consistent treatment of change of variables in integration it is gratefully acknowledged the support of Youngjoo Chung/GIST [18] providing the author with the latest version of his Symbolic Computing package and giving additional tips how to make effective usage of the relevant routine therein. In the same context thanks to various contributors to the MathGroup thread [mg131569] “Change of Variables for Integrals” [17]. It should also be noticed that David Park had drawn attention to his Presentations`StudentsIntegral.m package which gives a different approach to the same problem of change of variables for integration. And, finally, the author is particularly grateful to Michael Trott/WRI for his tireless competent support answering - over the period where this project became mature - numerous questions and gave profound advice to subtle technical problems in Mathematica.

3/9/16

71