# Are There Integrals That Are Easier to Solve Numerically Than Analytically?

• loupblanc
In summary: \int_{0}^{1} f \sin \left( \frac{1}{x} \right)dxgives an improper integral, since the function f has a discontinuity at x=0.
loupblanc
There isn't an applied mathematics thread so i'll post this here.

I'm an undergraduate and I have a presentation for my numerical methods/matlab class . I'm looking for examples of
1)Integrals which are easier/faster to integrate numerically than do evaluate using their antiderivatives. (power series etc)
2)Integrals whose antiderivatives are not elementary functions on a bounded interval without ''smoothness'' problems on bounds, and if possible with a known integral value.

Thank you.

... correct me if I'm wrong, but aren't most integrals easier to evaluate numerically? Being able to find an antiderivative for a general function is supposed to be tricky.

I mean, but a fraction bar in there, add some exponentiation to algebraic functions of x, throw in some discontinuous functions and you should be good to go. As an example,...

[x^2e^sqrt(x+sin(x))]/(sinh x + cos x + x^x)

If that has an elementary function as its antiderivative, I'm retiring.

Or are you asking for useful examples?

Sorry, i wasn't clear.

By easier i meant that MATLAB would take less time/ computer memory to evaluate the integral using a numerical integration method ( Simpson, Romberg, etc) than evaluating the antiderative itself which is usually quite complicated ( expressed using power series, etc). I've read about this in articles but I've never seen an example.

Yeah, I'm looking for useful examples; like we know that integral of exp(-x^2) from -infinity to +infinity is root of phi, so i was wondering if there were integrals without antiderivatives like this on a bounded interval so that i could evaluate it using of the numerical integration methods for a presentation.

loupblanc said:
By easier i meant that MATLAB would take less time/ computer memory to evaluate the integral using a numerical integration method ( Simpson, Romberg, etc) than evaluating the antiderative itself which is usually quite complicated ( expressed using power series, etc). I've read about this in articles but I've never seen an example.

Well actually software such as mathematica, maple and perhaps even MATLAB do not use the elementary algorithms that we learn in high school calculus.

You are actually asking two different questions-- one question is what class of functions would be easier to integrate numerically using elementary methods, and the other question is what class of functions would be easier to integrate numerically if using sophisticated mathematical software.

For the latter, I think it's easier to just try and see. If you do it symbolically and it chokes, do it numerically instead. You would be amazed how many crazy integrals a program that Mathematica can handle! But still my experience is that the type of integrals that show up in research are not the kind that have analytic expressions that Mathematica can find.

DavidWhitbeck said:
Well actually software such as mathematica, maple and perhaps even MATLAB do not use the elementary algorithms that we learn in high school calculus.

You are actually asking two different questions-- one question is what class of functions would be easier to integrate numerically using elementary methods, and the other question is what class of functions would be easier to integrate numerically if using sophisticated mathematical software.

For the latter, I think it's easier to just try and see. If you do it symbolically and it chokes, do it numerically instead. You would be amazed how many crazy integrals a program that Mathematica can handle! But still my experience is that the type of integrals that show up in research are not the kind that have analytic expressions that Mathematica can find.

My bad, i assumed that mathematical software uses elementary methods. Out of curiosity i'd like to know what methods they use.

But more importantly I'm searching for functions belonging to the former class i.e. easier to integrate numerically using elementary methods, as an example to add to my class presentation.To me at least, it's counterintuitive that numerical integration works better.

What about $$\int_{-1}^{1}\sin{(1/x)}dx$$?

It has an essential discontinuity which should (I hope) make evaluating the integral by series expansion tricky (and I believe also the anti-derivative is non-elementary)... but it can be handled numerically by splitting up the integral by

$$\int_{-\epsilon}^{\+\epsilon}f + \int_{[-1,1]\backslash [-\epsilon,+\epsilon]} f$$

where you show that the first part vanishes in the limit as $$\epsilon \rightarrow 0$$ and the other part can be done using numerical methods, and so evaluating the right hand side for non-zero but small $$\epsilon$$ should yield a good approximation to the integral.

DavidWhitbeck said:
What about $$\int_{-1}^{1}\sin{(1/x)}dx$$?

Too easy.

$\sin \left(1/x \right)$ goes wonky at $x=0$, so

$$\int_{-1}^{1} \sin \left( \frac{1}{x} \right)dx$$

is an improper integral, and

$$\int_{-1}^{1} \sin \left( \frac{1}{x} \right)dx = \lim_{\epsilon \rightarrow 0} \left( \int_{-1}^{ - \epsilon} \sin \left( \frac{1}{x} \right) dx + \int_{\epsilon}^{1} \sin \left( \frac{1}{x} \right) dx \right) = 0 ,$$

since $\sin( \left(1/x \right)$ is an odd function.

I don't know whether

$$\int_{0}^{1} \sin \left( \frac{1}{x} \right)dx$$

meets the original poster's criteria, but it is an interesting integral.

The substitution $w = 1/x$ followed by an integration by parts turns this integral into the special function $ci \left( x \right)$.

Last edited:
Doing definite integrals with numerical integration is typically 1000s of times faster than with symbolic integration (anti-derivatives). It would be more notable to find an integralwhich can be done very simply using anti-derivatives but will choke most numerical integration algorithms.

The following description of the implementation of the symbolic integrator in Mathematica is taken from the Wolfram Inc website:

* For indefinite integrals, an extended version of the Risch algorithm is used whenever both the integrand and integral can be expressed in terms of elementary functions, exponential integral functions, polylogarithms and other related functions.

* For other indefinite integrals, heuristic simplification followed by pattern matching is used.

* The algorithms in Mathematica cover all of the indefinite integrals in standard reference books such as Gradshteyn-Ryzhik.

* Definite integrals that involve no singularities are mostly done by taking limits of the indefinite integrals.

* Many other definite integrals are done using Marichev-Adamchik Mellin transform methods. The results are often initially expressed in terms of Meijer G functions, which are converted into hypergeometric functions using Slater's Theorem and then simplified.

* Integrals over multidimensional regions defined by inequalities are computed by iterative decomposition into disjoint cylindrical or triangular cells.

* Integrate uses about 500 pages of Mathematica code and 600 pages of C code.

Oh woops yeah George, that was dumb of me to claim an odd integral over [-1,1] was hard when it's obviously 0! lol

Yes, I'm looking for functions like the one David and George proposed, but which are defined on the bounds of the integral. I doubt ci(x) can be integrated properly with elementary methods, since it wobbles so much near zero.

@ Crosson : wow,now i see how advanced the maths is to integrate symbolically with math software. But I'm searching for cases where even though we know what the antiderivative is, it is still faster to integrate numerically than to evaluate the antiderivative.

Perhaps some massively piecewise function would work. I mean, in the limit, it would be doing the same thing as numerical integration, and it would have the extra work of doing the antiderivative in the first place.

## 1. What is numerical integration?

Numerical integration is a mathematical method used to approximate the definite integral of a function. It involves dividing the area under the function's curve into smaller shapes and then summing up the areas of these shapes to get an estimate of the integral.

## 2. Why is numerical integration important?

Numerical integration is important because it allows us to approximate complex integrals that cannot be solved analytically. It is also essential in many scientific and engineering applications where precise calculations are needed.

## 3. What are the different methods of numerical integration?

There are several methods of numerical integration, such as the trapezoidal rule, Simpson's rule, and Gaussian quadrature. These methods differ in the way they divide the area under the curve and the accuracy of their estimates.

## 4. How do you choose the appropriate method of numerical integration?

The appropriate method of numerical integration depends on the function being integrated and the desired level of accuracy. For smooth functions, Simpson's rule or Gaussian quadrature may be more accurate, while for discontinuous functions, the trapezoidal rule may be a better choice.

## 5. What are the limitations of numerical integration?

Numerical integration is subject to rounding errors and truncation errors, which can affect the accuracy of the estimate. It also requires a finite number of intervals, so it may not be suitable for functions with infinite intervals. Moreover, some functions may be difficult to integrate numerically due to their complexity or oscillatory behavior.

• Cosmology
Replies
2
Views
332
• Calculus
Replies
5
Views
2K
• Calculus
Replies
5
Views
3K
• Science and Math Textbooks
Replies
12
Views
898
• MATLAB, Maple, Mathematica, LaTeX
Replies
27
Views
3K
• Calculus
Replies
9
Views
2K
• Calculus
Replies
2
Views
3K
• Calculus
Replies
4
Views
285
• Atomic and Condensed Matter
Replies
4
Views
1K
• Calculus
Replies
3
Views
3K