# Propagation of uncertainty in integral formula

I have a moving object with mass $M$ whose 1D trajectory $x$ can be tracked and known over time with a certain sampling rate (EDIT: to make it clear, I don't have the analytical form of $x$, that's a sequence of measurements. Thus, the integral needs to be numerically evaluated). I want to estimate the energy of that object by applying: $$E=\int_{x_{start}}^{x_{end}}F(x)\mathrm{d}x=\int_{x_{start}}^{x_{end}}Ma(x)\mathrm{d}x=M\int_{x_{start}}^{x_{end}}\frac{\mathrm{d^2x}} {\mathrm{d}t^2}\mathrm{d}x=M\sum_{k=1}^{N}\frac{\mathrm{d^2x}} {\mathrm{d}t^2}(k)\Delta x(k)$$ and then calculate the uncertainty on the resulting energy, knowing the uncertainty on $x$.

At this point, I am a little confused regarding how to propagate the uncertainty from $x$ to $E$, since I know that the general formula is, neglecting correlation for now, $$\sigma_f^2=\sum_{x_i}\left|\frac{\partial f}{\partial x_i}\right|_{\bar{x_i}}^2\sigma_{x_i}^2$$ but I don't have a clue as how to apply that to the integral formula.

Since the energy would be known through numerical solution of the integral, say by approximating it with rectangles, should I compute the uncertainty corresponding to any $M\frac{\mathrm{d^2x}}{\mathrm{d}t^2}\mathrm{d}x$ sample and then sum the squared values of those to obtain $\sigma_E^2$?

• You don't need to worry about the integration. You integrated function will be a function of the same variables as that of the integrand. You have to apply the usual uncertainty rules to compute the uncertainty in energy from the uncertainty in position once you have found energy as a function of position. – Yashas Jul 27 '17 at 14:57

It really depends on if you are allowed to analytically calculate the integral or if you have to do it numerically.

Assuming you are allowed to analytically calculate the integral, you can simplify it as the difference in kinetic energy at the start and end. You have to calculate the velocity only at the beginning and end.

$$E=M\int_{x_\text {start}}^{x_\text {end}}\frac{\mathrm d^2x}{\mathrm dt^2}\mathrm dx=M\int_{v_\text{start}}^{v_\text{end}}v\mathrm dv=\frac{1}{2}M\left(v_\text{end}^2-v_\text{start}^2\right)=\frac{1}{2}M\left(\left(\frac{x_\text{end}-x_{\text{end}-1}}{\Delta t}\right)^2-\left(\frac{x_{\text{start}+1}-x_\text{start}}{\Delta t}\right)^2\right)$$

You can then use the formula to find $\sigma_E^2$ easily.

If, on the other hand, you have to integrate, then you are really doing a sum. You have to calculate every acceleration each time.

$$\int_{x_\text {start}}^{x_\text {end}}\frac{\mathrm d^2x}{\mathrm dt^2}\mathrm dx=\sum_{x_i}\frac{\mathrm d^2x}{\mathrm dt^2}\Delta x=\sum_{x_i}\left(\frac{\mathrm d}{\mathrm dt}\frac{x_{i+1}-x_i}{t_{i+1}-t_i}\right)\left(x_{i+1}-x_i\right)=\sum_{x_i}\frac{\left(\frac{x_{i+1}-x_i}{t_{i+1}-t_i}\right)-\left(\frac{x_i-x_{i-1}}{t_i-t_{i-1}}\right)}{t_{i+1}-t_i}\left(x_{i+1}-x_i\right)\approx\sum_{x_i=x_{\text{start}+1}}^{x_{\text{end}-1}}\left(\left(\frac{x_{i+1}-x_i}{t_{i+1}-t_i}\right)-\left(\frac{x_i-x_{i-1}}{t_i-t_{i-1}}\right)\right)\frac{x_{i+1}-x_{i-1}}{t_{i+1}-t_{i-1}}$$

Propagating error here is going to be much tougher, but only because you're going to have to do a lot of algebra. The first step might be too rewrite the expression so that the sum only involves $x_i$ and not $x_{i+1}$ or $x_{i-1}$.

• It's a numerical integration, which is not a problem. The issue is the uncertainty associated with it: are you confirming that I have to compute the uncertainty of all the quantities contributing to the integral and then propagate them as in a linear sum? – DavideM Jul 28 '17 at 8:32
• @DavideM yes I am – Johnathan Gross Jul 28 '17 at 15:11

It is a subtle question. The numerical integration itself implies a truncation error which you don't handle using analytical tools, at least to a basic level.

So it does not matter you are tracking the positions with a given uncertainity, as long as you are performing a numerical integration within its own error, at least in what matters to error propagation.

I would rather suggest you a different approach. I guess for a given trayectory you have a set of $x_{i}\left(t_{n}\right) \pm \Delta x_{i}\left(t_{n}\right)$

Then I would run a set of numerical integrations, in which each position $x_{i}\left(t_{n}\right)$ is drawn from a uniform distribution $\mathcal{U}\left[x_{i}\left(t_{n}\right) - \Delta x_{i}\left(t_{n}\right),x_{i}\left(t_{n}\right) + \Delta x_{i}\left(t_{n}\right)\right]$. Or rather the best distribution that suits with your collection of positions. Which distribution did you assume to compute their uncertainities?. Then you would have an stochastic sample of energies, from which you can perform the statistics you need, such as computing the variance (error) of E.

If you really want to propagate the errors analytically, I think you would need to apply the propagation formula to the sum of all the steps carried out by the numerical integration, as if it were an analytical exact formula for the energy $E_{i}=f\left(x_{i}\left(t_{1}\right),x_{i}\left(t_{2}\right),... x_{i}\left(t_{n}\right)\right)$. I think this approach would be less elegant.

• Could I instead compute the energy for a number of trajectories in order to obtain the sample of energies on which computing the variance? In the end, it should be a quite similar approach to what you proposed, wouldn't it? – DavideM Aug 2 '17 at 8:19
• Sorry for being so late. But I think yes!, that is exactly what I say. But you need to take into account you are computing the energies with the stochastic positions. – Juan Luis Gómez González Jan 8 '18 at 10:21

Uncertainty is not associated with functions; uncertainty is a property of the variables.

You don't have to worry about how uncertainty propagates as you integrate. You have to integrate the expression and the apply the uncertainty rules.

$$E=\int_{x_{start}}^ {x_{end}} M a dx = M\int_{x_{start}}^ {x_{end}} v dv = \frac {1}{2} M[v^2]_{v_{start}}^{v_{end}}$$

You have energy as a function of velocity. You have to use the given equation of state to write velocity as a function of position.

$$v = \frac{dx}{dt}$$

From that (function relating velocity and position), you can calculate the uncertainty in velocity from uncertainty in position. Knowing the uncertainty in velocities, you can now find the uncertainty in energy.

• The problem is that I have to do everything numerically, for I have no analytical form for any of the above. Thus, in the end E would "simply" be a number. (Mind that I'm not sure whether I completely understood what you tried to tell me). – DavideM Jul 28 '17 at 8:35