#C16.txt: March 19, 2018, ExpMath (RU), back to Cauchy, contour integrals and argument principle Help:=proc(): print(` CIc(f,z,C0,r), CIcN(f,z,C0,r), CIr(f,z,C0,a,b)`): end: #CIc(f,z,C0,r): the contour integral of f of z over the circle center C0 (a complex number) #and radius r #e.g. CIr(1/z,z,0,3); CIc:=proc(f,z,C0,r) local t: int(evalc(subs(z=r*exp(I*t)+C0,f*I*(z-C0)))/(2*Pi*I),t=0..2*Pi): end: #CIcN(f,z,C0,r): Numerical contour integration #the contour integral of f of z over the circle center C0 (a complex number) #and radius r #e.g. CIrN(1/z,z,0,3); CIcN:=proc(f,z,C0,r) local t: evalf(Int(evalc(subs(z=r*exp(I*t)+C0,f*I*(z-C0))/(2*I*Pi)),t=0..2*Pi)): end: #CIr(f,z,C0,a,b): the contour integral of f of z over the rectangle whose bottom-left corner #is the point C0=[x0,y0], and horiz. side a and vertical side b, in other words #the rectangle whose vertices are [x0,y0], [x0+a,y0],[x0+a,y0+b],[x0,y0+b] CIr:=proc(f,z,C0,a,b) local x0,y0, H1,H2,V1,V2,x,y: x0:=C0[1]: y0:=C0[2]: H1:=int(subs(z=x+y0*I,f),x=x0..x0+a): H2:=int(subs(z=x+(y0+b)*I,f),x=x0+a..x0): V2:=int(subs(z=x0+y*I,f)*I,y=y0+b..y0): V1:=int(subs(z=x0+a+y*I,f)*I,y=y0..y0+b): simplify(evalc((H1+H2+V1+V2)/(2*Pi*I))): end: #CIrN(f,z,C0,a,b): Numerical version #the contour integral of f of z over the rectangle whose bottom-left corner #is the point C0=[x0,y0], and horiz. side a and vertical side b, in other words #the rectangle whose vertices are [x0,y0], [x0+a,y0],[x0+a,y0+b],[x0,y0+b] CIrN:=proc(f,z,C0,a,b) local x0,y0, H1,H2,V1,V2,x,y: x0:=C0[1]: y0:=C0[2]: H1:=evalf(Int(subs(z=x+y0*I,f),x=x0..x0+a)): H2:=evalf(Int(subs(z=x+(y0+b)*I,f),x=x0+a..x0)): V2:=evalf(Int(subs(z=x0+y*I,f)*I,y=y0+b..y0)): V1:=evalf(Int(subs(z=x0+a+y*I,f)*I,y=y0..y0+b)): evalf((H1+H2+V1+V2)/(2*Pi*I)): end: