Ask Your Question

Calculating Cauchy Integrals in Sage

asked 2019-06-29 19:01:11 +0200

JoaoDDuarte gravatar image

updated 2019-06-30 00:27:26 +0200


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:

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!

edit retag flag offensive close merge delete


Also posted at Stackoverflow.

kcrisman gravatar imagekcrisman ( 2019-07-03 04:23:37 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-03 04:24:30 +0200

kcrisman gravatar image

updated 2019-07-03 04:28:13 +0200

Identical answer (not full, unfortunately) to what I posted on SO.

You're probably going to have to parametrize your integration domain (circle, here). Or use a Cauchy residue type theorem, as here.

Here is an interesting Sage cell instance by Jason Grout and Ben Woodruff that might help you get started on how to calculate some of them; unfortunately, sometimes these integrals are very tricky to do exactly. See this sage-support thread for an easier example, though I don't think in the end it fully worked because of a Maxima bug.

Relevant code:

r(t)=(2*cos(t), 3*sin(t))


def line_integral(integrand):
    return RR(numerical_integral(integrand, trange[1], trange[2])[0])

A = line_integral(dA)
integrate(dA, trange)

The last two lines do a numerical and exact (if possible) result, respectively.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2019-06-29 19:01:11 +0200

Seen: 914 times

Last updated: Jul 03 '19