Numerical Methods








Numerical integration and differentiation

This page contains some programs for integrating and differentiating numerical data. A function $f(x)$ is can be specified either by inputting an expression at the top or by pasting two columns of data in the textbox at the top-left. When the "Fill table" button is pressed, the expression is used to fill the table with 300 equally spaced values of $f(x)$ equally spaced between $x_1$ and $x_2$. When the "calculate from table" button is pressed, the data is plotted on the right. Below the data and plot of $f(x)$, the derivative $\frac{df}{dx}$ and the second derivative $\frac{d^2f}{dx^2}$ are tabulated and plotted. Below the derivatives, the integral of $f(x)$ is shown as well as the integral of the integral. The integration routines assume that the measurements are equally spaced with an interval $\Delta x$.

from $x_1=$  to $x_2=$ .

 $x$   $f(x)$




The dervative
The dervative of $f(x)$ is calculated as,

$\Large \frac{df}{dx}\approx \frac{f(x+\Delta x)-f(x)}{\Delta x}.$

 $x$   $\large \frac{df}{dx}$


$\large \frac{df}{dx}$


The second dervative
The dervative of $f(x)$ is calculated as,

$\Large \frac{d^2f}{dx^2}\approx \frac{\frac{df}{dx}(x+\Delta x)-\frac{df}{dx}(x)}{\Delta x}.$

 $x$   $\large \frac{d^2f}{dx^2}$


$\large \frac{d^2f}{dx^2}$


The integral of $f(x)$
There is always an integration constant when an integral is performed. The values in the table below are,

$\large \int fdx +C_1,$

where $C_1$ is the integration constant.


The integral of $f(x)$ was calculated numerically using a method called Simpson's rule.

$\large \int \limits_a^b f(x) dx \approx \frac{b-a}{6}\left(f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right).$

 $x$   $\large \int fdx$


$\large \int fdx$


The integral of the integral of $f(x)$
Simpson's rule was used a second time to calculate the integral of the integral of $f(x)$.

$\large \int \limits_{x_0}^{x_2} \left(\int \limits_{x_0}^{x_1} f(x)dx +C_1\right) dx_1+ C_2.$


 $x$   $\large \int\left(\int fdx\right)dx^{\prime}$


$\large \int\left(\int fdx\right)dx^{\prime}$


If the data points you have are not equally spaced in time, you can use either of the apps linear interpolation, or cubic spline to generate data points that are equally spaced in time.