https://github.com/cran/pracma
Raw File
Tip revision: d5bfb0e3b7a3211ff2bbe2926e5ba31aa24e4df6 authored by HwB on 09 March 2012, 00:00:00 UTC
version 1.0.1
Tip revision: d5bfb0e
piecewise.R
##
##  p i e c e w i s e . R  Test suite
##


piecewise <- pracma::piecewise

x <- c(0, 1,  2, 3, 4, 5)
y <- c(1, 1, -1, 0, 1, 0)
identical(piecewise(x, y)$area,  1.5)
identical(piecewise(x, y)$zeros, c(1.5, 3, 5))
identical(piecewise(x, y, abs = TRUE)$area,  3.0)
identical(piecewise(x, y, abs = TRUE)$zeros, c(1.5, 3, 5))
back to top