powered by
Trapeze integration from a vector of function values evaluated at quadrature points
trapeze(x, fx)
grid of values for the quadrature (vector).
values of the function on the grid (vector).
vector with a numerical approximation of \(\int_{min(x)}^{max(x)} f(t) dt\) on the grid using the trapeze method.
# NOT RUN { x = seq(-4,2,length=100) ; fx = dnorm(x) ; res = trapeze(x,fx) cbind(true=pnorm(x),trapeze=res) # }
Run the code above in your browser using DataLab