Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This won't work with a complicated example as yours, but perhaps it will give you some ideas:

sage: f = sinh(x)/(sin(x)-1/2)
sage: (1/f == 0).solve(x)
[x == 1/6*pi]
sage: pole = _[0].rhs()
sage: (f*(x-pole)).limit(x=pole)
1/3*(e^(1/3*pi) - 1)*sqrt(3)*e^(-1/6*pi)
sage: f.taylor(x,pole,-1)*(x-pole)
2/3*sqrt(3)*sinh(1/6*pi)

the second line solves 1/f(x)=0, which for meromorphic functions is like solving f(x)=infinity. We then store the pole found in "pole". The last two lines calculates the residue, assuming the pole is simple (the two answers are identical).

Here is an example with a non-simple pole:

sage: f = sinh(x)/(sin(x)-1/2)-1/(x-pi/6)^2
sage: (1/f == 0).solve(x)
[x == 1/6*pi]
sage: pole = _[0].rhs()
sage: f(x=x+pole).taylor(x,0,-1).coeff(x,-1)
2/3*sqrt(3)*sinh(1/6*pi)

The substitution "x=x+pole" is needed - f.taylor(x,pole,-1).coeff(x-pole,-1), which should have given the same answer returns zero, since some automatic simplification takes place and messes things up:

sage: 1/(x-pole)                                  
-6/(pi - 6*x)

hope this helps!

This won't work with a complicated example such as yours, but perhaps it will give you some ideas:

sage: f = sinh(x)/(sin(x)-1/2)
sage: (1/f == 0).solve(x)
[x == 1/6*pi]
sage: pole = _[0].rhs()
sage: (f*(x-pole)).limit(x=pole)
1/3*(e^(1/3*pi) - 1)*sqrt(3)*e^(-1/6*pi)
sage: f.taylor(x,pole,-1)*(x-pole)
2/3*sqrt(3)*sinh(1/6*pi)

the second line solves 1/f(x)=0, which for meromorphic functions is like solving f(x)=infinity. We then store the pole found in "pole". The last two lines calculates the residue, assuming the pole is simple (the two answers are identical).

Here is an example with a non-simple pole:

sage: f = sinh(x)/(sin(x)-1/2)-1/(x-pi/6)^2
sage: (1/f == 0).solve(x)
[x == 1/6*pi]
sage: pole = _[0].rhs()
sage: f(x=x+pole).taylor(x,0,-1).coeff(x,-1)
2/3*sqrt(3)*sinh(1/6*pi)

The substitution "x=x+pole" is needed - f.taylor(x,pole,-1).coeff(x-pole,-1), which should have given the same answer returns zero, since some automatic simplification takes place and messes things up:

sage: 1/(x-pole)                                  
-6/(pi - 6*x)

hope this helps!