minimaxEval {minimaxApprox}R Documentation

Evaluate Minimax Approximation

Description

Evaluates the rational or polynomial approximation stored in mmA at x.

Usage

minimaxEval(x, mmA, basis = "Chebyshev")

Arguments

x

a numeric vector

mmA

a "minimaxApprox" return object

basis

character; Which polynomial basis to use in to evaluate the function; see minimaxApprox for more details. If Chebyshev is requested but the analysis used only monomials, the calculation will proceed using the monomials with a message. The default is "Chebyshev", and the parameter is case-insensitive and may be abbreviated.

Details

This is a convenience function to evaluate the approximation at x.

Value

A vector of the same length as x containing the approximated values.

Author(s)

Avraham Adler Avraham.Adler@gmail.com

See Also

minimaxApprox, minimaxErr

Examples

# Show results
x <- seq(0, 0.5, length.out = 11L)
mmA <- minimaxApprox(exp, 0, 0.5, 5L)
apErr <- abs(exp(x) - minimaxEval(x, mmA))
all.equal(max(apErr), mmA$ExpErr)

# Plot results
curve(exp, 0.0, 0.5, lwd = 2)
curve(minimaxEval(x, mmA), 0.0, 0.5, add = TRUE, col = "red", lty = 2L, lwd = 2)

[Package minimaxApprox version 0.4.1 Index]