piecewise | R Documentation |
Compute zeros and area of a piecewise linear function.
piecewise(x, y, abs = FALSE)
x, y |
x- and y-coordinates of points defining the piecewise linear function |
abs |
logical; shall the integral or the total area between the x-axis and the function be calculated |
Compute zeros and integral resp. area of a piecewise linear function given by points with x and y as coordinates.
Returns a list with the integral or area as first element and the vector as all zeroes as second.
trapz
x <- c(0, 2, 3, 4, 5)
y <- c(2, -2, 0, -2, 0)
piecewise(x, y)
piecewise(x, y, abs=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.