Numerical integration - Techniques to remove singularities

In summary, the function does not have a singularity at x=-1 but does at x=0. Taking the absolute value of x and then taking its square root solves the problem. There is convergence for numerical integration methods near x=0.
  • #1
franciobr
13
0
Hello everyone!

I am trying to understand why the following function does not provide problems to being computed numerically:

∫dx1/(sin(abs(x)^(1/2))) from x=-1 to x=2.

Clearly there is a singularity for x=0 but why does taking the absolute value of x and then taking its square root solve the problem?

I searched for quite a while on the internet and on numerical integration books and was surprised that I couldn't find the answer for that. Apparentlly there is a lack of documentation on singularity removal techniques on the web or I am not searching with the right keywords. Any introductory documentation on the subject is welcome!

For the record I am using MATLAB built-in functions such as quadtx() or integral() to solve it but I that's not the point since it turns out even the most simple simpson rule algorithm can deal with that integral.
 
Technology news on Phys.org
  • #2
Just because you get a certain number out of a numerical routine does not mean it is accurate. Convergence for a particular definite integral containing a singularity within the limits of integration must be shown using other analysis methods before judging whether the resulting evaluation has any meaning.
 
  • #3
Yes. The result is accurate since if you exclude the singularity by simply integrating from -1 to 0 and then from 0 to 2 and sum them up the answer is exactly the same. I do not know how to analytically solve this integral and, well, that's the whole point of numerical integration.

I dind't mention that if you try to take the integral without taking the absolute value or the square root you get no answer and there is no convergence of the method. I am interested on why quadrature methods of integration converges on these cases. I am not interested on that particular integral, if you do the same with 1/x kinds of functions and integrate it going through its singularity on 0 you get convergence for the same methods of integration and they agree with analytical results. There is a reason why taking taking a square root and the absolute value of the denominator the numerical methods converges.

The absolute value application seems logical since you don't want a imaginary number coming out of the square root. But the convergence of the method is what astonishes me. I would like to know why there is the convergence and also if anyone has a good source for these techniques of excluding singularities for numerical integration.
 
  • #4
It's fairly easy to see that the integral is convergent. Expand the function as a power series and you get $$\frac{1}{|x|^{1/2}} \frac {1}{1 - |x|/3! + |x|^2/5! - \cdots}$$

So close to ##x = 0## the function is similar to ##|x|^{-1/2}## which can be integrated everywhere.

If you want to remove the singularity before you do the numerical integration, one way is to write the function as ##f(x) = s(x) + g(x)## where the ##s(x)## contains the singular part and can be integrated explicitly.

Then integrate ##s(x)## analytically and ##g(x)## numerically.

For this example you could take ##s(x) = |x|^{-1/2}## and ##g(x) = f(x) - s(x)## (where ##f(x)## is the function the OP wants to integrate).

You know that ##g(0) = 0## and ##g(x)## is well behaved near ##x = 0##, so any numerical integration method should converge quickly.
 
Last edited:
  • #5
Good job Aleph, it makes sense now. Thanks!
 

Related to Numerical integration - Techniques to remove singularities

1. What is numerical integration?

Numerical integration is a mathematical method used to approximate the value of a definite integral. It involves dividing the area under a curve into smaller, simpler shapes and calculating their individual areas to estimate the total area.

2. What are singularities in numerical integration?

Singularities in numerical integration refer to points in the integration interval where the function being integrated becomes undefined or infinite, making it difficult to accurately calculate the integral using traditional methods.

3. What techniques can be used to remove singularities in numerical integration?

There are several techniques that can be used to remove singularities in numerical integration, such as substitution, change of variables, and the use of special integration rules for specific types of singularities.

4. How does substitution help in removing singularities in numerical integration?

Substitution involves replacing the variable in the integral with a new variable that removes the singularity. This allows for a simpler and more accurate calculation of the integral without the singularity.

5. Can numerical integration accurately handle all types of singularities?

No, there are some types of singularities, such as essential and branching singularities, that cannot be accurately handled by numerical integration methods. In these cases, other numerical techniques may need to be used.

Similar threads

  • Programming and Computer Science
Replies
15
Views
2K
Replies
5
Views
707
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
6
Views
6K
  • Science and Math Textbooks
Replies
12
Views
971
  • Programming and Computer Science
Replies
6
Views
2K
  • Atomic and Condensed Matter
Replies
1
Views
1K
Back
Top