Bug fix: Residue returns 0

The function residue computes the residue of an analytic function at a pole of the function.

> residue(sin(z)/z^2,z=0);


In some cases residue returns an incorrect answer of 0.

> f:= x/(1+x^7): p:= cos(Pi/7)+I*sin(Pi/7):


> pr:= RootOf(1+Z^7);

pr := RootOf(1+_Z^7)


This is usually due to the series command not recognizing that the denominator is 0 at the given point.

> series(f,x=p,1);


> series(f,x=pr,1);


Sometimes this problem can be helped by using a different representation of the point p . In this case using complex exponentials instead of sines and cosines would work.

> residue(f,x=convert(p,exp));


Another possibility which sometimes works is to change the environment variable Testzero , whose value is the procedure used in series to determine when the leading coefficient is 0. By default this uses Normalizer , another environment variable whose default value is normal . Since residue and series have the remember option, we must use forget to remove results obtained using Normalizer from their remember tables.

> Testzero:= proc(O) evalb(simplify(O)=0) end:


However, this does not work in the case of our p .

> residue(f,x=p);


Another way this problem can arise is when you have a floating-point approximation to a singularity rather than an actual singularity.

> pf:= evalf(p);

pf := .9009688678+.4338837393*I

> residue(f,x=pf);


In this case it's arguably not Maple's fault: the given point pf is not actually a singularity of f , but only an approximation of a singularity. At pf itself, f has a finite (though large) value.

> eval(f,x=pf);


If you know that f should have a simple pole at the given point, you may be able to calculate the residue "by hand". For example:

> eval(numer(f)/diff(denom(f),x),x=p);


> eval(numer(f)/diff(denom(f),x),x=pf);


See also: convert[exp] , Exact vs floating-point computations , forget , Normalizer , residue , series , Testzero

Maple Advisor Database, R. Israel 2000