How to calculate the antiderivative of a numeric discrete set of data?

669 Views Asked by At

Suppose you have a table representing some unknown function $f(t)$. From it, you can compute another table for its derivative using $f'(t_i)=\frac{f(t_{i+1})-f(t_i)}{\Delta t}$. Is there a similar way for me to get a table with the antiderivative $\int f(t) dt$?

All I get when I google it are ways to compute a definite integral and that's not what I need. I need a discrete way for computing indefinite integrals from a discreete function that in general will not be a candidate for symbolic integration.

2

There are 2 best solutions below

0
On

Given a table of points: $t,f(t)$ there are a few ways to estimate the integral. All are tied to the Reimann sum.

Here is the trapezoidal sum.

$\sum_\limits{k=1}^n \frac 12 (t_{k} - t_{k-1})(f(t_k) + f(t_{k-1}))$

2
On

Following @JairTaylor's comment, all possible antiderivatives of $f(x)$ are of the form

$$F(x) = \int_{a}^{x} {f(t) \:\mathrm{d}t},$$

where the choice of $a$ is equivalent to the choice of a constant of integration. This is essentially the first fundamental theorem of calculus.

We necessarily have $F(a) = 0$. You can pick a starting point $a=x_i$ and then construct the corresponding antiderivative using a relationship such as

$$F(x_{j+1}) = F(x_j) + (x_{j+1} - x_j)f(x_{j+1}) \text{ for all } j,$$

which corresponds to the right Riemann sum of $f(x)$ using a mesh/partition $M = \{ x_1, x_2, \dots, x_n \}$ of the domain of $f$; or

$$F(x_{j+1}) = F(x_j) + (x_{j+1} - x_j)f(x_j) \text{ for all } j,$$

which corresponds to the left Riemann sum of $f(x)$ using that same mesh $M$.

Without loss of generality, you can pick $a=x_1$, so that $F(x_1) = 0$, then construct a particular antiderivative $F(x)$ by applying such a relationship to determine $F(x_2), F(x_3), \dots, F(x_n)$, whence all other antiderivatives $G(x)$ differ from $F(x)$ by a constant. In particular, if $G(x)$ would be constructed using a different starting constant, $b$, i.e. $G(x) = \int_{b}^{x} {f(t) \:\mathrm{d}t}$, then we have $G(x) - F(x) = \int_{b}^{a} {f(t) \:\mathrm{d}t} = \text{constant}$.