Today we discussed three different ways to use Sage to calculate complex integrals. Sage can directly calculate integrals of real-variable functions (including functions that take complex values):
You can also use Sage to calculate Riemann sums. If \(g: [a,b] \rightarrow \mathbb{C}\), then the Riemann sum approximation with \(n\) rectangles is: \[\sum_{k = 1}^n g(t_k) \Delta t\] where \(\Delta t = \frac{b-a}{n}\) and \(t_k = a + k \Delta t\). You can apply this to complex integrals of the form \(\int_\gamma f(z) \, dz\) by letting \(g(t) = f(\gamma(t)) \gamma'(t)\).