swh:1:snp:81eadaa089e8253d8469bcef66aa332632c6c669
Tip revision: fdf16693b000f3e309c56091892c61f0ec9fd670 authored by Hans W. Borchers on 21 November 2017, 16:15:00 UTC
version 2.1.1
version 2.1.1
Tip revision: fdf1669
fnorm.R
##
## f n o r m .R Function Norm
##
fnorm <- function(f, g, x1, x2, p = 2, npoints = 100) {
stopifnot(is.numeric(x1), length(x1) == 1,
is.numeric(x2), length(x2) == 1, x1 < x2,
is.numeric(npoints), length(npoints) == 1, npoints >= 2)
f <- match.fun(f)
g <- match.fun(g)
x <- seq(x1, x2, length.out = npoints)
yf <- f(x)
yg <- g(x)
if (length(yf) != npoints || length(yg) != npoints)
stop("Arguments 'f' and 'g' must be vectorized functions.")
fd <- Norm(yf - yg, p = p)
return(fd)
}