1 | initial version |

There's a `residue`

method on symbolic expressions which is documented to do the thing you want, but of course you should check that it does indeed do what you want.

I think you can use:

```
k=3
br(x)=sqrt(x)-sqrt(1/x)
q1,q2=var('q1,q2')
X=var('x_0,x_1,x_2')
rho=[1,q1,q2]
chi=1/prod([ br(X[j])*br(q1/X[j])*X[j]*br(q2/X[j]) for j in range(k)])
[chi.residue(xi==rhoi) for xi,rhoi in zip(X,rho)]
```

2 | No.2 Revision |

There's a `residue`

method on symbolic expressions which is documented to do the thing you want, but of course you should check that it does indeed do what you want.

I think you can use:

```
k=3
br(x)=sqrt(x)-sqrt(1/x)
q1,q2=var('q1,q2')
X=var('x_0,x_1,x_2')
rho=[1,q1,q2]
chi=1/prod([ br(X[j])*br(q1/X[j])*X[j]*br(q2/X[j]) for j in range(k)])
[chi.residue(xi==rhoi) for xi,rhoi in zip(X,rho)]
```

or, if as in the example that you posted as an answer to the question here, you really want to take the residues iteratively,

```
for xi,rhoi in zip(X,rho):
chi = chi.residue(xi,rhoi)
print chi
```

it returns almost instantaneously for me. You may want to simplify the answer a bit, with something like `chi.factor()`

or so.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.