Integrals 1+0=0

Hi :slight_smile:
When I was making some integrals as

\int_{-\infty}^{\infty}\left(e^{\pi}\right)^{-x^{2}}dx

and

\int_{-\infty}^{\infty}\frac{\sin\left(100x\right)}{50}dx

I encountered an issue. The first integral should give 1 (which he did) and the second integral should give 0 (which he did). then added those together:

\int_{-\infty}^{\infty}\left(\left(e^{\pi}\right)^{-x^{2}}+\frac{\sin\left(100x\right)}{50}\right)dx

I surprisingly got 0.

But I expected 1.

Here’s the link to the page, dashboard, or activity:

And here are some screenshots or a video:

These give different answers even with [-10,10] as limits of integration.

1 Like

Thats a tricky one, but engineering is fairly confident that this is the case:

The smoother the function is, the better our integration routine works. For functions like sin(100x)/50 that oscillate rapidly, we have to repeatedly subdivide the integration region into smaller regions until we get to something where the function is smooth enough to integrate accurately. There’s a limit on how much subdivision we’ll do because we don’t want to tie up the evaluator forever, so eventually we give up and return a possibly inaccurate answer.

Our integration routine has a heuristic that it uses to approximate how big the error in the result is likely to be. When the result is small and the error is large, we round the result to 0. This helps us avoid saying the answer to every integral that should be 0 is actually 1.4320582398×10^-16 or something like that because of rounding errors.

We compute the first sin integral inaccurately, but the answer is small and we know the error is large, so we round the result to 0. In the integral that combines the sin integral with another term, the error is still appreciable, but the result is no longer very small, so the error no longer gets hidden by rounding to 0.

Numerical integration is one of the trickier things the calculator does, and numerically integrating rapidly oscillating integrands is still a topic of active mathematical research.

2 Likes

So 1 isn’t big enough to make a difference? Ok, it’s fine thank you for the answer. :innocent: at least my math wasn’t wrong.