Compute the area of a function with values y at the points x within given limits.
trapz_limits(x, y, lower, upper)
x | x-coordinates of points on the x-axis. |
---|---|
y | Function values associated with the x-coordinates. |
lower | Lower integration boundary. |
upper | Upper integration boundary. |
Area under the curve defined by the (x, y)-tuples.
#> [1] 12.5trapz_limits(x, y, -2, -1)#> [1] 0trapz_limits(x, y, -2, .4)#> [1] 0.64trapz_limits(x, y, .4, .7)#> [1] 0.795trapz_limits(x, y, .4, 3.6)#> [1] 9.16trapz_limits(x, y, .4, 7)#> [1] 11.86trapz_limits(x, y, 6, 7)#> [1] 0if (FALSE) { # throws an error trapz_limits(x, y, 4, 3) }