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 ≈ σu2 (∂F/∂u)2 + σv2 (∂F/∂v)2 + σw2 (∂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(x0, x1, x2, y0, y1, y2) = y0x12/(x01x02) + y1(1/x12 – 1/x01) – y2x01/(x02x12)

where x01 = x0 – x1, x02 = x0 – x2, and x12 = x1 – x2

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 = (σy02 + σy22)/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 = σy02 [x12/(x01x02)]2 + σy12 [1/x12 – 1/x01]2 + σy22 [x01/(x02x12)]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, x0, x1, x2, y0, y1, y2. 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