Learn R Programming

cubicBsplines (version 1.0.0)

trapeze: Trapeze integration from a vector of function values evaluated at quadrature points

Description

Trapeze integration from a vector of function values evaluated at quadrature points

Usage

trapeze(x, fx)

Arguments

x

grid of values for the quadrature (vector).

fx

values of the function on the grid (vector).

Value

vector with a numerical approximation of \(\int_{min(x)}^{max(x)} f(t) dt\) on the grid using the trapeze method.

Examples

Run this code
# 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