The DERIVSIG function computes the standard deviation of the uncertainty of the derivative found by the DERIV function, using the standard deviations of the estimated errors in the *X* and *Y* parameters.

The standard deviations are computed using the method of propagation of errors. Given a function of several variables, F(u, v, w), each of which has an uncertainty with standard deviations σ_{u}, σ_{v}, σ_{w}, the approximation for the standard deviation σ of F is given by:

σ^{2} ≈ σ_{u}^{2} (∂F/∂u)^{2} + σ_{v}^{2} (∂F/∂v)^{2} + σ_{w}^{2} (∂F/∂w)^{2}

where it has been assumed that all of the cross terms are zero (in other words, the uncertainties in u, v, and w are uncorrelated).

For the DERIV function, the derivative at all points (except the first and last points) is given by:

y' = F(x_{0}, x_{1}, x_{2}, y_{0}, y_{1}, y_{2}) = y_{0}x_{12}/(x_{01}x_{02}) + y_{1}(1/x_{12} – 1/x_{01}) – y_{2}x_{01}/(x_{02}x_{12})

where x_{01} = x_{0} – x_{1}, x_{02} = x_{0} – x_{2}, and x_{12} = x_{1} – x_{2}

The error estimate σ^{2} is computed by taking the partial derivative for each variable in F, multiplied by the error estimates for that variable, and then finding the sum of the squares.

If the *Y* values are evenly spaced with no error in the *X* locations then the equation reduces to:

σ^{2} = (σ_{y0}^{2} + σ_{y2}^{2})/4

If the *Y* values are not evenly spaced (the distance between the *X* locations is not the same), but there is still no error in the X values, then the error equation becomes:

σ^{2} = σ_{y0}^{2} [x_{12}/(x_{01}x_{02})]^{2} + σ_{y1}^{2} [1/x_{12} – 1/x_{01}]^{2} + σ_{y2}^{2} [x_{01}/(x_{02}x_{12})]^{2}

The above equation is valid for all points within Y except for the first and last point. For the equation for the first and last points see the source code for derivsig.pro, found in the lib subdirectory.

Finally, if there are errors in both the *X* and *Y* values, then the partial derivatives need to be computed for all six variables, x_{0}, x_{1}, x_{2}, y_{0}, y_{1}, y_{2}. Consult the source code for details.

This routine is written in the IDL language. Its source code can be found in the file derivsig.pro in the lib subdirectory of the IDL distribution.

For a detailed example of using DERIVSIG see the DERIV function.

## Syntax

*Result* = DERIVSIG( [ *X*, *Y*, *Sigx* ] *Sigy* )

## Return Value

Returns a one-dimensional array containing the standard deviations of the uncertainty in the derivative. Each value within *Result* gives the uncertainty of the corresponding value in the result from the DERIV function. If any of the input arguments are double precision then the result will be double precision, otherwise the result will be single precision.

## Arguments

### X

A one-dimensional array of data containing the X locations, as passed into DERIV. If *X*, *Y*, and *Sigx* are omitted then the *Y* points are assumed to be evenly spaced with no error in the *X* positions.

### Y

A one-dimensional array of data containing the Y values, as passed into DERIV.

### Sigx

A scalar or one-dimensional array containing the standard deviation of the *X* values. Use 0.0 if the abscissa is exact.

### Sigy

A scalar or one-dimensional array containing the standard deviation of *Y*. *Sigy* must be a vector if the other arguments are omitted, but may be either a vector or a scalar if *X*, *Y*, and *Sigx* are supplied.

## Keywords

None.

## Version History

Pre 4.0 |
Introduced |

8.3 | Improve accuracy of the algorithm for unevenly-spaced data. |

## Resources and References

F. B. Hildebrand, *Introduction to Numerical Analysis*, *2nd ed.*, Dover Books, 1987, p. 85.

P.R. Bevington and D. K. Robinson, *Data Analysis and Reduction for the Physical Sciences, 3rd ed.*, McGraw-Hill, 2002, p. 39.

## See Also

DERIV, INT_TABULATED, QROMB, QROMO, QSIMP