# Calculating Cauchy Integrals in Sage

Hi!

I am relatively new to complex analysis and I am trying to write down the following integral in Sage Math:

$$ I(k) = \frac{1}{2i\pi}\oint\frac{(1-t^2)}{(1-t)^n}\frac{dt}{t^{k+1}} $$

from a paper that can be found at: http://magali.bardet.free.fr/Publis/l...

The contour is a unit circle around the origin with a radius less than 1.

whereby $$S(n) = \frac{(1-t^2)}{(1-t)^n} $$ is a formal power series. The Cauchy Integral will produce the k-th coefficient of $S(n)$. I tried doing the following:

```
def deg_reg_Cauchy(k, n, m):
R.<t> = PowerSeriesRing(CC, 't')
constant_term = 1/(2*I*pi)
s = (1-t**2)**m / (t**(k+1)*(1-t)**n)
s1 = constant_term * s.integral()
return s1
```

I realize this is probably ** very** wrong and I used $0$ till $2\pi$ as simple placeholders until I find appropriate values. Does anyone have any tips on how to go about this, please? Below is the error message that is being outputted by Sage.

```
ArithmeticError: The integral of is not a Laurent series, since t^-1 has nonzero coefficient.
```

Thank you!

Also posted at Stackoverflow.