EE447: Assignment:
Numerical Integration of
Singular Integrals
Harishankar Ramachandran
EE Dept, IIT Madras
September 16, 2016
1 Reading Portion
Chapter on integration from both books. Section on Gaussian Quadratures.
2 Programming Portion - Singular Integrals
We wish to compute the following integral:
e−x
Z 3
J= √ dx (1)
1 J1 −x2 + 4x − 3
where J1 (x) is the Bessel funciton of the first kind of order 1. It is available in Python as scipy.special.jv. Note that
J1 (x) ≈ x for small arguments. So the denominator goes to zero when the argument of J1 goes to zero.
1. Graph the integrand of Eq. 1 in Python from x = 1 to x = 3.
2. Use quad and see what it does.
3. Use the open Romberg method to integrate. Study its convergence.
4. What kind of singularities are present and where? Use the transformation to convert the integral to a non-singular
one and then apply qromo. Study the convergence.
3 Programming Portion - Gaussian Quadratures
1. Consider the integral in Eq. 1. Transform the integral to −1 to 1 by a suitable transformation.
2. Evaluate the integral using Gauss-Chebyshev quadratures. Note that for this method, no program is needed to
compute x j and w j . They are given by:
!
π j − 12
x j = cos
N
π
wj =
N
Write the program in python to compute the integral for different N and plot the accuracy vs. N. To find error,
compute for N = 20 and assume that is exact.
We wish to compute the second integral in the Romberg assignment:
Z 1
I1 = Jν2 (ku)udu (2)
0
Z ∞
I2 = Kν2 (gu)udu (3)
1
where k = κa = 2.7 and g = γa = 1.2. There we assumed a large cutoff and did the integral. Here we will do Gaussian
quadratures.
1
1. Define functions corresponding to both integrands, f1 and f2.
2. Use quad and see the cost to evaluate both integrals to an accuracy of 10−12 .
3. Use Gauss-Legendre to evaluate I1 and Gauss-Laguerre to evaluate I2 . Note that in the second integral you will
have to transform the variables so that the integrand looks like f (u) exp (−u). The asymptotic behaviour of Kν is
given by r
π −x
Kν (x) ≈ e , xν (4)
2x
√
Additionally note that the 1/ x behaviour does not need to be captured since it is meant for singular behaviour
near x = 0. For large x, e−x dominates.
4. Use Romberg to evaluate the first integral to the required accuracy.
5. Transform the infinite range to a finite range via u = A tan w and use Romberg to integrate the second integral. Do
you need to use open or closed romberg? Why?
6. Compare the different methods and determine the best performing algorithm.