We can't find a formula for $\int e^{\sin x}\,dx$ - but can we still know everything about it?

When Formulas Fail

We all know that $\int \cos x\,dx = \sin x + C$. Beautiful, clean, done. But what about this one?

$$\int e^{\sin x}\,dx = \;???$$

Try every technique you know - substitution, integration by parts, partial fractions - nothing works. This isn't a failure of cleverness. It's a mathematical fact: no combination of elementary functions (polynomials, trig, exponentials, logs) will express this antiderivative in closed form.

The same is true for $\int e^{-x^2}\,dx$, the famous Gaussian integral that's fundamental to probability and statistics. And for $\int \frac{dt}{\sqrt{1-k^2\sin^2 t}}$, which shows up whenever you try to measure the arc length of an ellipse.

Common mistake: When students hit one of these integrals, the instinct is to try harder - more substitutions, cleverer tricks. But no amount of technique will help. These are provably non-elementary. Recognizing this early saves real time on exams. The right response isn't "try harder" - it's "switch strategies."

So what do we do? Are these integrals unknowable?

Not at all. Think about it: even before you knew antiderivative formulas, the definite integral $\int_a^b f(x)\,dx$ still had a perfectly clear meaning - the signed area under $f$. The fundamental theorem of calculus tells us something powerful: if we define

$$F(x) = \int_a^x f(t)\,dt$$

then $F$ is a perfectly legitimate function, with $F'(x) = f(x)$, whether or not we can write $F$ in terms of familiar functions. We know exactly what $F$ does at every point - we just need to compute it numerically rather than write down a formula. And we can do that as accurately as we want, one step at a time.

Building Functions from Scratch

Here's the key insight: we don't need a formula to know a function. We just need to be able to compute its values.

Given any continuous $f$, the function $F(x) = \int_a^x f(t)\,dt$ is completely determined. We know its value at $x = a$ (it's zero). We know its derivative everywhere ($F'(x) = f(x)$). And we can approximate it at any point using numerical integration.

The simplest approach: the trapezoidal rule. Break $[a, x]$ into small steps of width $\Delta x$. For each step, we need to approximate the area under $f$ on that tiny interval. We could use a rectangle (left or right endpoint), but a trapezoid - using both endpoints - is smarter. Why? A rectangle with height $f(x_k)$ overshoots where $f$ is decreasing and undershoots where it's increasing. The trapezoid splits the difference, using the average of the two endpoint heights:

$$\Delta F \approx \frac{\Delta x}{2}\bigl[f(x_k) + f(x_{k+1})\bigr]$$

This simple averaging cuts the error dramatically - the trapezoidal rule's error shrinks like $1/n^2$ (where $n$ is the number of steps), versus $1/n$ for plain rectangles. Accumulate these trapezoid areas, and you get $F$ at each grid point.

Choose a function and watch $F(x)$ build up step by step:

The Trapezoidal Buildup

Let's walk through the computation for $f(t) = e^{\sin t}$ on $[0, 1]$, exactly as Kaplan does in Table 4.1. We'll use $\Delta x = 0.1$, giving us 11 grid points from $x = 0$ to $x = 1$.

At each step, we compute the trapezoid area $\Delta F = \frac{0.1}{2}[f(x_k) + f(x_{k+1})]$ and add it to the running total.

$x$$f(x)=e^{\sin x}$$\Delta F$$F(x)$

A built-in sanity check. Here's something beautiful: since $F'(x) = f(x)$, the ratio $\Delta F / \Delta x$ should approximate $f$ at the midpoint of each step. Let's test this. Look at the step from $x = 0.5$ to $x = 0.6$. Before computing, ask yourself: what should $f(0.55) = e^{\sin 0.55}$ be roughly? Since $\sin 0.55 \approx 0.52$, we'd expect $e^{0.52} \approx 1.68$.

Now check the table:

$$\frac{\Delta F}{\Delta x} = \frac{F(0.6) - F(0.5)}{0.1} = \frac{0.816 - 0.647}{0.1} = 1.69$$

That matches our prediction almost exactly. This is a lovely way to verify your work at any step - and it's really just the fundamental theorem in reverse: if $F' = f$, then differences in $F$ must reflect values of $f$.

Elliptic Integrals

Here's a classic problem: what is the arc length of an ellipse?

For a circle of radius $r$, the arc length from angle $0$ to $\varphi$ is simply $r\varphi$. Easy. But for an ellipse $x = a\cos\varphi$, $y = b\sin\varphi$ (with $b > a > 0$), we get

$$ds = \sqrt{a^2\sin^2\!\varphi + b^2\cos^2\!\varphi}\;d\varphi = b\sqrt{1 - k^2\sin^2\!\varphi}\;d\varphi$$

where $k^2 = (b^2 - a^2)/b^2$. So the arc length from $\varphi = 0$ to $\varphi = \alpha$ is

$$L = b\,E(\alpha), \quad \text{where}\quad E(\varphi) = \int_0^{\varphi}\sqrt{1-k^2\sin^2 t}\,dt$$

This is the elliptic integral of the second kind. There is no elementary formula for it. There is also the first kind:

$$F(\varphi) = \int_0^{\varphi}\frac{dt}{\sqrt{1 - k^2\sin^2 t}}$$

These integrals earned their name because they first arose in computing the perimeter of an ellipse. The story behind them is remarkable. In the 18th century, mathematicians like Euler and Legendre spent decades studying these integrals, building elaborate tables of values by hand - essentially doing what our trapezoidal rule does, but with quill and paper. Legendre devoted forty years of his life to classifying elliptic integrals into three standard "kinds."

Then in the 1820s, two young mathematicians - Abel and Jacobi - had a stunning insight. Instead of studying the integral $F(\varphi)$ directly, they studied its inverse function: given $y = F(\varphi)$, what is $\varphi$ as a function of $y$? This is exactly the move that turns $\int dt/\sqrt{1-t^2}$ from the obscure "arcsin" into the familiar "sin." The resulting elliptic functions sn, cn, dn turned out to be doubly periodic and spectacularly well-behaved - opening up an entire new branch of mathematics.

Elliptic integrals show up far beyond geometry: the period of a pendulum at large angles, the shape of magnetic field lines, orbits in general relativity. Every time you see $\sqrt{\text{cubic or quartic}}$ under an integral sign, elliptic integrals are likely nearby.

Drag the slider to change the eccentricity. Watch how the arc length function $E(\varphi)$ departs from the circular case ($k = 0$) as the ellipse gets more elongated:

k = 0.000, a = 1.00, b = 1.00

Every Integral Defines a Function

Step back for a moment and appreciate the big idea. We started with the worry that some integrals "can't be solved." But what we've actually discovered is more powerful: every integral, solvable or not, defines a legitimate function.

In fact, even some of our most familiar functions could have been defined this way. Consider:

$$y = \int_0^x \frac{dt}{\sqrt{1-t^2}} \quad\implies\quad x = \sin y$$

The integral $\int_0^x \frac{dt}{\sqrt{1-t^2}} = \arcsin x$ - so this integral "defines" the sine function in reverse. We could have introduced sin this way, starting from the integral and working backward.

The elliptic functions $\operatorname{sn}$, $\operatorname{cn}$, $\operatorname{dn}$ arise exactly the same way from elliptic integrals, just as sin arises from $\int dt/\sqrt{1-t^2}$. And the error function $\operatorname{erf}(x) = \frac{2}{\sqrt{\pi}}\int_0^x e^{-t^2}\,dt$ is indispensable in probability and statistics.

The lesson: our "toolkit" of named functions isn't a fixed list. Every time we study a new integral, we potentially add a new function to the toolkit - one that we can evaluate numerically, differentiate exactly, and reason about just as rigorously as sin or exp.

Playground: Numerical Integrator

Enter any function $f(x)$ and bounds. We'll compute $F(x) = \int_a^x f(t)\,dt$ numerically and show the buildup.

Supported: sin, cos, tan, exp, sqrt, log, abs, pow(a,b), pi, e, x. Use * for multiplication.

Press Compute to see the numerical antiderivative.

Practice Problems - §4.2

From Kaplan, problems after §4.2

1(b) Evaluate $\displaystyle\int e^{-x^2}\,dx$ numerically for $0 < x < 1$
Evaluate $\displaystyle F(x) = \int_0^x e^{-t^2}\,dt$ numerically for $0 < x < 1$, using $\Delta x = 0.1$.

Step 1: Compute $f(x) = e^{-x^2}$ at grid points

We evaluate $f$ at $x = 0, 0.1, 0.2, \ldots, 1.0$:

$f(0) = 1.0000$, $f(0.1) = 0.9900$, $f(0.2) = 0.9608$, $f(0.3) = 0.9139$, $f(0.4) = 0.8521$, $f(0.5) = 0.7788$

$f(0.6) = 0.6977$, $f(0.7) = 0.6126$, $f(0.8) = 0.5273$, $f(0.9) = 0.4449$, $f(1.0) = 0.3679$

Step 2: Apply the trapezoidal rule

$\Delta F_k = \frac{0.1}{2}[f(x_k) + f(x_{k+1})]$

For example, the first step: $\Delta F_0 = \frac{0.1}{2}[1.0000 + 0.9900] = 0.0995$

Step 3: Accumulate to get $F(x)$

$F(0)=0$, $F(0.1)\approx 0.0997$, $F(0.2)\approx 0.1981$, $F(0.3)\approx 0.2918$, $F(0.4)\approx 0.3794$

$F(0.5)\approx 0.4610$, $F(0.6)\approx 0.5349$, $F(0.7)\approx 0.6004$, $F(0.8)\approx 0.6574$, $F(0.9)\approx 0.7060$, $F(1.0)\approx 0.7468$

Step 4: Verify

Check: $\Delta F/\Delta x$ at $x\approx 0.55$ should give $f(0.55) = e^{-0.3025} \approx 0.739$.

$$\frac{F(0.6)-F(0.5)}{0.1} = \frac{0.5349-0.4610}{0.1} = 0.739 \;\checkmark$$
1(c) Evaluate $\displaystyle\int \cos x\,dx$ numerically for $0 < x < 1$ and compare with $\sin x$
Evaluate $\displaystyle F(x) = \int_0^x \cos t\,dt$ numerically for $0 < x < 1$ using $\Delta x = 0.1$, and compare with the exact answer $\sin x$.

Step 1: Compute $f(x) = \cos x$ at grid points

$f(0) = 1.0000$, $f(0.1) = 0.9950$, $f(0.2) = 0.9801$, $f(0.3) = 0.9553$, $f(0.4) = 0.9211$

$f(0.5) = 0.8776$, $f(0.6) = 0.8253$, $f(0.7) = 0.7648$, $f(0.8) = 0.6967$, $f(0.9) = 0.6216$, $f(1.0) = 0.5403$

Step 2: Trapezoidal accumulation

Apply $\Delta F_k = \frac{0.1}{2}[\cos(x_k) + \cos(x_{k+1})]$ and sum:

$F(0.1)\approx 0.0998$, $F(0.2)\approx 0.1987$, $\ldots$, $F(1.0)\approx 0.8415$

Step 3: Compare with exact answer

The exact answer is $F(x) = \sin x$, so $F(1) = \sin 1 = 0.8415$.

$$\text{Numerical } F(1) \approx 0.8415 \quad\text{vs.}\quad \sin 1 = 0.8415 \;\checkmark$$

The trapezoidal rule with 10 steps already gives 4-decimal-place accuracy for this smooth function.

4 Show that the arc length of an ellipse involves an elliptic integral of the second kind
Let the ellipse be $x = a\cos\varphi$, $y = b\sin\varphi$ with $b > a > 0$. Show that the arc length from $\varphi = 0$ to $\varphi = \alpha$ is $b\,E(\alpha)$, where $E$ is the elliptic integral of the second kind with $k^2 = (b^2 - a^2)/b^2$.

Step 1: Compute $ds$

From $x = a\cos\varphi$, $y = b\sin\varphi$:

$$dx = -a\sin\varphi\,d\varphi, \quad dy = b\cos\varphi\,d\varphi$$

$$ds^2 = dx^2 + dy^2 = (a^2\sin^2\!\varphi + b^2\cos^2\!\varphi)\,d\varphi^2$$

Step 2: Factor out $b^2$

$$a^2\sin^2\!\varphi + b^2\cos^2\!\varphi = b^2 - (b^2 - a^2)\sin^2\!\varphi = b^2\!\left(1 - \frac{b^2-a^2}{b^2}\sin^2\!\varphi\right)$$

Setting $k^2 = (b^2 - a^2)/b^2$, we get

$$ds = b\sqrt{1 - k^2\sin^2\!\varphi}\;d\varphi$$

Result

$$L = \int_0^{\alpha} ds = b\int_0^{\alpha}\sqrt{1 - k^2\sin^2\!\varphi}\;d\varphi = b\,E(\alpha) \quad\square$$