approximate: Approximate function with a spline

Description Usage Arguments Author(s)

View source: R/approximate.R

Description

Approximate a function by a spline, refined to a given tolerance

Usage

1
2
3
4
approximate(target, a, b, ..., method = "fmm", n_base = 17L,
  max_depth = 16L, atol = tol, rtol = tol, verbose = FALSE,
  tol = sqrt(.Machine$double.eps), target_vectorised = TRUE,
  inverse = FALSE)

Arguments

target

A function to approximate

a

The lower bound of the interpolation

b

The upper bound of the interpolation

...

Additional arguments passed through to target

method

The method of interpolation to used; passed through to splinefun

n_base

The number of equally spaced points to start with

max_depth

The number of times the base points will be subdivided, at most.

atol

The absolute tolerance; used to determine how the approximation is doing for values with small absolute value.

rtol

The relative tolerance' used to determine how the approximation is doing for values with large absolute value.

verbose

Be verbose when fitting the spline? This might be useful on expensive functions.

tol

The default value for atol and rtol; use this to set both at once.

target_vectorised

Flag indicating if target can accept a vector of x values; the default, TRUE, assumes that it can. If your function requires each x value separately set this to FALSE.

inverse

Indicates if the inverse approximate function is required. This is useful if you can use target to map x to y but you want the inverse mapping back. a and b will be the domain of x still (so the range of y, and the domain of the returned function).

Author(s)

Rich FitzJohn


richfitz/approximate documentation built on May 27, 2019, 8:16 a.m.