Suspicious behaviour of "residue"



Leo,

You made a very good point: it is possible to get the correct result with simple methods, and furthermore, Maxima asks the good questions to get there (as opposed to the pure "residue" method, where Maxima never seem to ask any questions).

Nevertheless I don't think this is a good reason not to improve the "residue" function:

1. If the "limit" function is clever enough to enquire about the range of the parameters, why isn't the "residue" function ?

2. Using "limits" is just fine for low-order poles, but it becomes impractical for high-order poles or even poles with "symbolic" order.

3. A typical application of residues is to compute inverse Laplace transforms, which involves the sum of residues over all the poles:

(%i1) H : (s+3)/(s+1)/(s-3) $
      lsum(residue(H * exp(s*t), s, rhs(pi)), pi, solve(denom(H)));

(%o1) (3*%e^(3*t))/2-%e^(-t)/2

(%i3) ilt(H, s, t);
(%o3) (3*%e^(3*t))/2-%e^(-t)/2

In this example , ilt works just as well, but there are cases where the residue method is the only way. I think it's just great to rely on a simple line like:

lsum(residue(H * exp(s*t), s, rhs(pi)), pi, solve(denom(H)));

Now, if you can't really trust the "residue" funcion, but have to use ad-hoc ways to compute the residues, the whole thing kind of falls apart, and has no interest whatsoever.

Obviously this is a simplified example, but I think you get the idea. 
David.


----- Mail Original -----
De: "Leo Butler" <l.butler at ed.ac.uk>
?: "David Chappaz" <david.chappaz at free.fr>
Cc: maxima at math.utexas.edu
Envoy?: Vendredi 8 Mai 2009 19h30:43 GMT +00:00 GMT - Grande-Bretagne, Irlande, Portugal
Objet: Re: [Maxima] Suspicious behaviour of "residue"

< -----Original Message-----
< From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
< 
< Subject: Suspicious behaviour of "residue"
 However I've come across the following problem, involving residues :
< 
< (%i1) set_display('ascii) $
< domain : complex $
< declare(N, integer) $
< H : 1 / (x*(x - x0)*(1 - x^N/y)) $
< 
< (%i5) residue(H, x, 0);
<                                        y
< (%o5)                           - ------------
<                                           N
<                                   x0 y - x  x0
< 
 

You can compute the residue from first principles and maxima
does it correctly in 2/3 cases:

(%i4) domain:complex$ declare(N,integer)$ H : 1/(x*(x-x0)*(1-x^N/y));

(%o6) 1/(x*(x-x0)*(1-x^N/y))
(%i7) limit(x*H,x,0);

Is  N+1  positive, negative, or zero?

p;
Is  N  positive, negative, or zero?

p;
(%o7) -1/x0
(%i8) limit(x*H,x,0);

Is  N+1  positive, negative, or zero?

p;
Is  N  positive, negative, or zero?

z;
(%o8) -y/(x0*y-x0)

(%i9) is(x^0=1);

(%o9) true
-----------------------------------------------------
Bug: (I have filed a report),

(%i1) domain:complex$ declare(N,integer)$ H:1/((x-x0)*(1-x^N));
(%o3) 1/((1-x^N)*(x-x0))
(%i4) limit(H,x,0);
Is  N+1  positive, negative, or zero?

n;
Is N an even number?

y;
(%o4) -1/x0     <-----incorrect answer


(%i5) H:subst(N=-N,H);
(%o5) 1/((1-1/x^N)*(x-x0))
(%i6) limit(H,x,0);
Is  N-1  positive, negative, or zero?

p;
Is N an even number?

y;
(%o6) 0
(%i7) build_info();

Maxima version: 5.18.1
Maxima build date: 14:8 4/20/2009
host type: i686-pc-linux-gnu
lisp-implementation-type: CLISP
lisp-implementation-version: 2.47 (2008-10-23) (built 3448862542)
(memory 3449221717)


Leo.


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.