trapz in r code example
Example: trapz in r
library(pracma)
# Calculate the area under the sine curve from 0 to pi:
x <- seq(0, pi, len = 101)
y <- sin(x)
trapz(x, y) #=> 1.999835504
library(pracma)
# Calculate the area under the sine curve from 0 to pi:
x <- seq(0, pi, len = 101)
y <- sin(x)
trapz(x, y) #=> 1.999835504