Sympy: Definite Integration via Integration in the Complex Plane Proposal

Rizgar Mella March 26, 2008
Abstract Symbolic packages become far more powerful when able to solve definite intergrals. A majority of these problems can be solved in the complex plane. A straightforward and effective method done by hand is very powerful, but translation to code may be problematic. Definite integrals are very important in many scientific fields such as quantum mechanics, combined with the importance of open source software in academic circles. Expansion of the Sympy package to include complex variable analysis, through the inclusion of Laplace Transforms and calculation of residues of contours from analysis of its poles (residue calculus). The residues allow almost all definite integrals to be resolved after reformatting into an appropriate contour, where the sum of residues is the solution. Continuing the expansion to include Inverse Laplacians to aid the solution of partial differential equations will make it a more affective tool.



Detailed Description

The proposed addition I would like to implement for finding the solution for definite integration and integration on complex plane using residues, is to begin with an implementation of finding the residues appendix Figure 1 of an arbitrary contour. The difficulty in finding the residue is to find code that detects the poles (easy for humans, must be cautious when dealing with computers). Pole detection can be found by decomposing the function into a tree structure, poles can be found from a set of rules for traversing the tree e.g.( [/s(s + a)], is two single poles one when s=0 and one when s = −a). For more complicated examples the computer program must be more robust. Finding of the residues with reformatting of a definite integral to an appropriate contour, will allow almost every definite integral to become solvable. A straight forward example in the appendix Figure 2. With the use of the Bromwich Contour, the Inverse Laplacian function could be created. The Bromwich Contour/Integral, easily produces a contour where the sum of the residues is the Inverse Laplacian, a very useful mathematical operation. BromwichContour = F (t) = 1 2πi

est f (s)ds


The finding of residues, Laplacian transform and inverse Laplacian Tranform have many other applications such as solving partial differential equations, this is done by running a Laplace Transform on the partial differential equation to produce an ordinary differential equation, when solved just apply the inverse Laplacian transform to arrive at the correct solution. I hope to write a Residue finding, Laplacian Transform and Inverse Laplacian Transform in python for sympy project.



Testing is an important step in the development of any computational implementation of a mathematical method. Evaluation of most (e.g some number to some number) definite integrals can be validated, by first numerically evaluating the result of the algorithm to be tested, then separately evaluating the integral with numerical methods (well tested and trusted). Both results can be tested to an arbitrary number of decimal places. The sympy nitegrate function can serve as the comparison; obviously the test integrals will then have to be wellbehaved integrals. There are ways of testing non well behaved integrals, which is to symbolically evaluate the integral over many finite domains where if the domains are small enough, a majority will seem well behaved to the numerical integrate method and the confidence in the symbolic method for that integral can then be evaluated in terms of the number of successful domains evaluated over the unsuccessful domains. The test files in sympy contain ’test xxx’ functions filled with asserts, which is a simple enough framework to include my proposed testing method. A random integral generator would be an excellent extreme test, but such a piece of code would require substantial testing on its own, only would be attempted if time permitted. 2



Figure 1: Finding Residue Example

Figure 2: Definite Integration, with the use of residues. First Example



Example of Integration taken from: 3

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.