Professional Documents
Culture Documents
Sympy: Definite Integration Via Integration in The Complex Plane Proposal
Sympy: Definite Integration Via Integration in The Complex Plane Proposal
Abstract
Symbolic packages become far more powerful when able to solve defi-
nite integrals. A majority of these problems can be solved in the complex
plane. A straightforward and effective method done by hand is very pow-
erful, but translation to code may be problematic. Definite integrals are
very important in many scientific fields such as quantum mechanics, com-
bined 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 this is achieved from analysis of its poles (residue calculus). The
residues allow almost definite integrals to be resolved after reformatting
into an appropriate contour, where the sum of residues is the solution.
Continuing expansion to include Inverse Laplacians to aid the solution of
partial differential equations.
1
1 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 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.
With the use of the Bromwich Contour, the Inverse Laplacian function can be
implemented. The Bromwich Contour/Integral easily produces a contour where
the sum of the residues is the Inverse Laplacian, a very useful mathematical
operation.
Z γ+i∞
1
BromwichContour = F (t) = est f (s)ds (1)
2πi γ−i∞
2 Motivation
I have currently completed my third year of Masters of Science in Theoretical
Physics at Royal Holloway University of London. With an interest in compu-
tational modeling with emphasis on symbolic methods, there are far too many
numerical methods that offer no insight into the behavioral properties of simi-
lar systems. There are also no commercial packages that are not substandard.
Mathematica fails repeatedly at problems that on pen and paper are quite simple
to solve; I suppose this comes from the difficulty of conveying human intuition
into code. Previously I have wanted to join open source project to offer help
but, I could offer nothing but testing as a user. Now I hope I can use what uni-
versity has so far taught me to contribute, at least in an area I enjoyed which
is complex analysis.
3 Deliverables
First target would be set of functions that allow for definite integrals to be
solved.
Second target is expansion on the complex analysis done in target one to
attempt to solve differential equation.
2
Functions to be created listed below, these most probably have to change
over the course of the project, but for now they will serve as a starting point.
3
• Week 2 to 5: is the development of pseudo-code for the deliverables (First
Target Functions). Ensuring that issues are covered such as functions
interfacing together properly and errors handled. Then the movement to
python, with each function completion the associated test will then be
applied.
• Week 6: some over flow time for smaller issues. Discussion with the com-
munity, to evaluate if changes are needed or if any enhancements can be
suggested. Start preparations of code and documentation for delivery to
be evaluated.
5 Testing
Testing is an important step in the development of any computational imple-
mentation 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 well-
behaved 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.
6 Curriculum Vitae
• Name: Rizgar Mella
4
• Completed Secondary School education at Burlington Danes Church of
England.
7 Conclusion
Thank you for you time in evaluation. Any further questions please feel free to
contact me.
E-mail: [email protected]
5
8 Appendix
9 References
Example of Integration taken from: www.exampleproblems.com/wiki/index.php/CVRC1