Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

runge

Runge Function


Description

Runge's test function for interpolation techniques.

Usage

runge(x)

Arguments

x

numeric scalar.

Details

Runge's function is a classical test function for interpolation and and approximation techniques, especially for equidistant nodes.

For example, when approximating the Runge function on the interval [-1, 1], the error at the endpoints will diverge when the number of nodes is increasing.

Value

Numerical value of the function.

See Also

Examples

## Not run: 
x <- seq(-1, 1, length.out = 101)
y <- runge(x)
plot(x, y, type = "l", lwd = 2, col = "navy", ylim = c(-0.2, 1.2))
grid()

n <- c(6, 11, 16)
for (i in seq(along=n)) {
    xp <- seq(-1, 1, length.out = n[i])
    yp <- runge(xp)
    p  <- polyfit(xp, yp, n[i]-1)
    y  <- polyval(p, x)
    lines(x, y, lty=i) }

## End(Not run)

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.