GSoC 2012 Application Arpit Goyal: Definite integration using residue

Sean Vig edited this page Apr 11, 2012 · 1 revision
Clone this wiki locally

Name and Contact Info

Arpit Goyal

Email: agmps18@gmail.com

Institute : Indian Institute of Technology Delhi

IRC: arpitgyl on freenode

Phone: +91 9540730871

About Me


My name is Arpit Goyal ,I am doing my major in Mathematics and Computing ,from Indian Institute of Technology, Delhi(IIT-D).

I have done relevant courses on Complex analysis, Data structures, Analysis and Design of algorithm, Numerical methods and computing.

About my computer programming Experience: I have once made a Web-Based application Fast Scheduler (www.gofastschedule.com). I am now working with an open source organization Raxa working on their IVR project which aims which aims to build a interactive system by which user can ask for any medical diagnosis and system will intelligently diagnose. Follow on Raxa wiki page for more information of the project. I am handling the Database module of the project right now. Well this information is irrelevant in this context. I am a beginner in python but I can get through it as I am proficient in Java and Matlab. So I just have to focus more on syntax as my programming basics are clear.


Introduction to the group

My introduction to the list is here.


Project

I would like to work on Definite Integration using residues. At present Sympy has a strong algorithm that uses Meijer G-Functions implemented but there are many integrals that are easy to integrate but cannot be computed by current algorithm. I have done course on complex analysis and I believe I have a strong hand in required mathematical background. Issues 2810 , 3179 are related to current system which will be removed by this module.


Deliverables


As already a very efficient algorithm that uses Meijer G-Functions has been implemented , so major part of the project comes handy where Meijer G-Functions are unable or is time consuming to solve the integral. Many kinds of (real) definite integrals can be found using the results for contour integrals in the complex plane. As values of contour integrals can usually be written down with very little difficulty. We simply have to locate the poles inside the contour, find the residues at these poles, and then apply the residue theorem. I illustrate these steps for a set of five types of definite integral:

  • Integrals of trigonometric functions from 0 to 2π:

I = integral((trigonometric function),(symbol,0,2pi)

The obvious way to turn this into a contour integral is to choose the unit circle as the contour, in other words to write z = exp(iθ), and integrate with respect to θ. On the unit circle, both cos θ and sin θ can be written as simple algebraic functions of z: cos θ =(1/2)(z + 1/z) sinθ =(1/2i)(z − 1/z) and dθ=dz/iz and making this replacement turns the trigonometric function into an algebraic function of z whose poles can be easily found.

  • Indefinite integrals

I= integral(f(x),(x,-oo,oo)) and for even function I= integral(f(x),(x,0,oo))

It can be found quite easily, by inventing a closed contour in the complex plane which includes the required integral. The simplest choice is to close the contour by a very large semi-circle in the upper half-plane. Suppose we use the symbol “R” for the radius. The entire contour integral comprises the integral along the real axis from −R to +R together with the integral along the semicircular arc. In the limit as R→∞the contribution from the straight line part approaches the required integral I, while the curved section may in some cases vanish in the limit.

  • I = integral((trigonometric function /Polynomial function),(x,-oo,oo))

In this case have to take special care over the choice of the complex function, in other words the continuation of the trigonometric function away from the real axis. The three functions cos z , e(iz) and e(−iz) all have the same real parts on the real axis, but are different elsewhere. In particular, when z = iR and R →∞ the first and last become infinite, while the second tends to zero. Consequently the methods described for Type 2 integrals will work only if we adopt the second continuation.

Jordan’s Lemma makes contour integration a useful method for a large class of integrals and it is very important case in this condition.

  • Last type of integral will be those involving branch cuts. Far from being a problem, these can actually make some kinds of definite integral possible because we can make use of the discontinuity across the cut to construct the required integral.

Example: I=integral ((1+x**n),(x,-oo,oo))

With the discussion in group and my experience with the topic I have break the project in chunks ,which we have to look one by one , which will add efficiency and take make Definite Integration more wide.

  1. Modify solve() function ,as it is inefficient in finding general solution of periodic functions. It works very well for polynomial functions indeed.
  • At present solve function is not giving the general solutions for periodic functions and for the integration i need to know all possible poles .so what i suggest is to work on the periodicity of the function as if i know the periodicity then it's trivial to get a general solutions.
  1. Modify residue() function , as it was discussed on developers list it is very buggy . Issue 2555 is related to this.
  • Residue function at present is showing an error because of wrong series expansion , so my main aim would be to make sure that series expansion is right .
  1. Given a concrete integral, transforming it into one in the complex plane ,so that we can use integration theorems.

  2. Check the convergence of Integrand as it is very important step in calculating integrals using residues.

    For this i have thought to check for different type of integrands possible:

  • f(x)= p(x)/q(x) , check deg(q(x)) - deg(p(x))>=2 then we are confirm of the convergence of this function.

  • G(x)=f(x)(sin(ax) or cos(ax) ) , then for convergence we just need to make sure f(x)= p(x)/q(x) deg(q(x)) - deg(p(x))>=1 by Jordan's lemma convergence condition is satisfied.

  • General function other then this we need to find the maximum value of numerator and minimum value of the denominator , if it converges to zero then our function converges.

  • Note that we need not require convergence condition when integrating inside a contour as we will be knowing the function's behavior and bound inside the contour.

  1. Categorizing the function into the category stated above.
  • For this i just need to know what type of integrand i am dealing with. I have already stated the what type integrand of integrand i will be looking for.
  1. Choosing the contour with the position of the pole, For example, if you end up with a contour around the unit circle, and one of your poles is a*I, then answer will depend on |a| (whether it is < or > than 1).

Lets look how will the algorithm work like:

In order to evaluate integral(1/(5+4sin(x),(x,0,2pi)) (which cannot be calculated by current system)

  • Transform it into one in the complex plane using

sin(x)= (1/2I)(z+1/z) and dx=dz/Iz

it becomes integral(1/(2z**2+5I*z-2),(|z|=1))

  • Convergence condition is nor required since here we have to integrated inside a compact contour and continuos on the contour.

  • Using solve(2z**2+5I*z-2,z) Ans: [-2I,-(1/2)*I]

  • As contour is |z|=1 so pole with |z|<1 is only accepted ,so (-1/2)*I is the required pole.

  • Using residue(2z**2+5Iz-2,z) gives 1/3I ( which is an error in current system ,answer comes to be zero because of wrong series expansion)

  • Answer will be 2piI*(1/3I) = 2pi/3

In one other example , integrate(xsin(x)/(2+2x+x**2),(x,0,oo)) which gives an error in current system ,

  • Transform it into one in the complex plane applying the rule 2 above:

Im [integral(f(z)e(Ix))] where f(z)=z/(z**2+2z+2)

  • Convergence condition shows that deg(z**2+2z+2)-deg(z)=1 so by jordan's lemma [integral(f(z)e(Ix))] over Cirle is zero as r->oo.

  • Using solve (z**2+2*z+2,z)= [-1-I,-1+I] we have to take the pole which is inside the contour (im(z)>=0). so z=-1+I will lie in the contour.

  • Finding residue(zexp(Iz)/(z**2+2*z+2),z,-1+I)= (1/2)exp(-1-I)(1+I) (this one is perfectly calculated by residue function)

  • Answer= im(2piI*((1/2)exp(-1-I)[1+I]))= (pi/exp)(sin(1)+cos(1))


Tentative Schedule


I have no significant plans for the summer, so GSOC will be my first priority. I will be in touch with my mentor on a regular basis. Project will start on May 21 and supposed to be completed on August 13. This gives 12 weeks. My college exams end on 8th august and this will give me a 13 day head start. For these 13 days I am not planning to start coding but reading related to the topic and developing a plan how to work for these 13 weeks .

Week 1-2 (21st May- 4th June):

Modifying the solve function for periodic functions , testing ,documentation.

Week 3-4 (4th June -18th June) :

Improving Residue() function ,Testing ,documentation

Week 5 (18th June- 25th June) :

Adding Convergence function ,order of convergence , testing and documentation.

Week 6-7 (25th June - 9nd July):

Transformation of integral into complex plane , categorizing the integrand, testing ,Documentation.

Mid Term Evaluation

Week 8-9(9th July -23rd July):

Implementation of algorithms for different category ,Testing ,Documentation

Week 10-11 (23rd July-6th August):

Implementation of choice of contour depending on the position of poles, back log ,Testing Documentation

Week 12-13(6th August - 19th August): Integration of whole module, Testing of whole, Documentation of whole module. This is a rough schedule, it may be possible that some more ideas area added or deleted, subject to the discussion with the mentor.

As stated above I will be in touch with my mentor on daily basis via mails, skype, irc.


Reference:


[1] Complex Variables and Applications 7ed_J.W. Brown, R.V. Churchill (McGraw-Hill 2004 467s)

[2] Ahlfors Lars. Complex Analysis