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 a formula at the top or by pasting two columns of data in the textbox at the top-left. When the "calculate from formula" button is pressed, the formula is used to fill the table with 1000 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$.

$f(x)=$ 
in the range from $x_1=$  to $x_2=$ .

 $x$   $f(x)$

  

$f(x)$

$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}$

$x$

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}$

$x$

The integral of $f(x)$

$\large I_1(x)=\int\limits_{x_1}^{x} f(x')dx' +I_1(x_1)$.

Here $I_1(x_1)$ is the integration constant.

$I_1(x_1)=$

The integral of $f(x)$ is 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$   $I_1(x)$

  

$I_1(x)$

$x$

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

$\large I_2(x) = \int \limits_{x_1}^{x} I_1(x')dx' + I_2(x_1).$

$I_2(x_1)=$

 $x$   $I_2(x)$

  

$I_2(x)$

$x$

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