https://github.com/cran/pracma
Tip revision: c1688b374d201c13fb40b4dda2d2a89e34b94ec6 authored by Hans W. Borchers on 23 January 2021, 09:10:02 UTC
version 2.3.3
version 2.3.3
Tip revision: c1688b3
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)
}