📅  最后修改于: 2022-03-11 15:00:10.591000             🧑  作者: Mango
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