GSoC 2015 Application Shivam Vats - paramsingh/sympy GitHub Wiki
#About me
##Contact Information
Name : Shivam Vats
University : Indian Institute of Technology, Kharagpur
email-id : [email protected]
github username : shivamvats
##Personal Information My name is Shivam Vats, a second year undergraduate student at IIT Kharagpur, India. I am pursuing a degree in Mathematics and Computing. I use Ubuntu 14.04 LTS on my workstation and GVim (with some really cool extensions) as my primary text editor. I've been using Winpdb for debugging for some time now, and think it's really awesome. I've been coding in C and C++ for over 3 years and in Python for over a year and am proficient in all three of them now.
I have had a fairly decent exposure to various topics in Maths, with courses taken including those in Linear Algebra, Computational Number Theory, Probability and Statistics, Discrete Mathematics, ODE and PDE besides familiarity with real and complex analysis and abstract algebra.
#The Project
##Motivation
Currently CSympy lacks the ability to represent a series and compute the series expansion of a function. Series expansion and series manipulation is of fundamental importance in dealing with many mathematical operations like, integration, solving differential equations, function approximation, etc.
Though a closed form for any series is always helpful for manipulations, in many cases it is not possible. In such situations we usually do series manipulations with only a part of the series (say till powers of n
). Thus, effectively we get polynomials to deal with. It is for this reason, that a decent polynomial arithmetic capability is a prerequisite for series expansion.
##The Plan It is becoming increasingly clear to me that first thing to do should be get polynomials working as soon as possible, as series expansion (even if tested on Sympy) would not be possible without it. How we actually do it and how much we need right now, is something we need to think over. Using piranha can let us get series expansion working sooner but given that Sympy's polynomials are pretty decent, we have an incentive to port that to C++ too (later if not now).
Once we decide on which way to go, I'd need to spend considerable amount of amount on polynomials and hence, I plan to divide my project into three parts :
- Extend polynomial capabilities by porting Sympy's sparse polynomial implementation/use piranha
- Using sparse representation, implement Series class in Sympy
- Port it to C++
(If we choose to use piranha, the first part should not take too much time)
###Extending polynomial capabilities To be updated
###Implement Series class in Sympy I plan to use this as a starting point. This needs to be modified to use sparse representation.
I propose to create four classes- FormalBaseSeries, PowerSeries, LaurentSeries and PuiseuxSeries to represent base, power/taylor, laurent and puiseux series. Every series class will derive from FormalBaseSeries. The reason I favour creating different classes for different series is that user always knows what series to expect. Moreover new series can easily be added by subclassing.
However, there cannot be a very rigid division of series, so for example, if the user asks for the laurent series of sin(x)
, he should get a LaurentSeries object even though, strictly speaking, it is a Taylor series. Further, results of arithmetic operations will also be of some Series class. So sum of two taylor series is a Taylor series, sum of a Taylor and laurent series is a laurent series, and so on.
I also propose to create a function, series
, very much like the one in Sympy, that decides which series to evaluate and returns the appropriate series. However, the user can ask for evaluation of a particular type of series by specifying it. Further, the user should also have control over the way the series is returned.
There are two ways to return any expansion. We either return a specified number of terms or else we return a generator that can return the next term as many times as the user wants. The former is implemented in Sympy as nseries while the latter, called lazy expansion is implemented as lseries. Sympy's lseries is rather slow as by default, it internally uses nseries repeatedly.
One issue with nseries is that given a nested function, you never know how many terms you need to expand in the innermost function to finally get the desired order. There are two ways to tackle this:
- Start with 'n' terms in the innermost part and if the order falls short, keep increasing 'n' till you get the desired order.
- Start with 'n' terms in the innermost part and output whatever ordered expansion you get. This method would be much faster than the 1st one but there is no guarantee you'd get the requested order.
####References