Learn R Programming

minimaxApprox (version 0.4.3)

minimaxErr: Evaluate the Minimax Approximation Error

Description

Evaluates the difference between the function and the minimax approximation at x.

Usage

minimaxErr(x, mmA)

Value

A vector of the same length as x containing the approximation error values.

Arguments

x

a numeric vector

mmA

a "minimaxApprox" return object

Author

Avraham Adler Avraham.Adler@gmail.com

Details

This is a convenience function to evaluate the approximation error at x. It will use the same polynomial basis as was used in the approximation; see minimaxApprox for more details.

See Also

minimaxApprox, minimaxEval

Examples

Run this code
# Show results
x <- seq(0, 0.5, length.out = 11L)
mmA <- minimaxApprox(exp, 0, 0.5, 5L)
err <- minimaxEval(x, mmA) - exp(x)
all.equal(err,  minimaxErr(x, mmA))

# Plot results
x <- seq(0, 0.5, length.out = 1001L)
plot(x, minimaxErr(x, mmA), type = "l")

Run the code above in your browser using DataLab