relerror: Relative error

Description Usage Arguments Details Value References See Also Examples

Description

This function computes the relative error.

Usage

1
relerror(xt, xa)

Arguments

xt

numeric vector that contains the true value(s)

xa

numeric vector that contains the approximate value(s)

Details

Relative error is expressed as

\varepsilon_{t} = \frac{{true \: value} - {approximation}}{true \: value} \cdot 100

\varepsilon_t

the "true percent relative error"

true value

the true value

approximation

the approximate value

Value

relative error, as a percent (%), as a numeric vector.

References

Steven C. Chapra, Applied Numerical Methods with MATLAB for Engineers and Scientists, Second Edition, Boston, Massachusetts: McGraw-Hill, 2008, page 82-83.

See Also

sgm for geometric mean, shm for harmonic mean, cv for coefficient of variation (CV), rms for root-mean-square (RMS), approxerror for approximate error, and ranges for sample range.

Examples

1
2
3
library("iemisc")
# Example 4.1 from the Reference text (page 83)
relerror(1.648721, 1.5) # answer as a percent (\%)

iemisc documentation built on Aug. 2, 2020, 9:07 a.m.