peter.vlasschaert@gmail.com ,19/09/2017
residue a(-1) ,appendix   (version 1.0)

appendix : how   find residue a(-1)
definition :Laurent expansion : f(z) is analytic inside and one simple closed curve C except at z=a 
                    with a pole of  ' order n '
f(z) =a(-n) *1/(z-a)^-n +....+a(-2)*1/(z-a)^2+a(-1)*1/(z-a)^1+a(0)+a(1)*(z-a)^1+.............

kill(all)$

pole of  ' order 1 '   n=1   'simple pole'

n:1;

p1:fz=sum(a(k)*(z-a)^k, k, -n, inf), simpsum;

p2:(z-a)*lhs(p1)=(z-a)*rhs(p1);

p3:a(-1)=limit(part(p2,2), z, a);

definition : find residue simple pole  z=a

kill(all);

pole of  ' order n '   n=2   'pole order 2'

f1(z):=sum(a(k)*(z-a)^k, k, -2, -1)+sum(a(k)*(z-a)^k, k, 0, 5);

p5:f1(z)*(z-a)^2;
p6:u=z-a;
p7:ratsimp(subst(u, z-a, p5));
p8:diff(p7,u);
p9:limit(p8,u,0);

pole of  ' order n '   n=3   'pole order 3'

m=3;

f2(z):=sum(a(k)*(z-a)^k, k, -3, -1)+sum(a(k)*(z-a)^k, k, 0, 5);

p10:f2(z)*(z-a)^3;
p11:ratsimp(subst(u, z-a, p10));
p12:diff(p11,u,2);
p13:limit(p12,u,0);
p131:ifactors(coeff(p13,a(-1)));

rem :   2 = 2*1 = 2!=> (3-1)!

pole of  ' order n '   n=4   'pole order 4'

f3(z):=sum(a(k)*(z-a)^k, k, -4, -1)+sum(a(k)*(z-a)^k, k, 0, 5);

p14:f3(z)*(z-a)^4;
p15:ratsimp(subst(u, z-a, p14));
p16:diff(p15,u,3);
p17:limit(p16,u,0);
p18:ifactors(coeff(p17,a(-1)));

rem :  6 = 3*2*1 = 3! => (4-1)!

general equation of  residue  of  ff(z)  for pole of order 'm'
-------------------------------------------------------------------------------------

p19:'a(-1) = limit(1/(m-1)! *diff((z-a)^m*ff(z),z,m-1),z,a);