R/simpson.R

Defines functions simpson

simpson <- function(fxs,a,b){
	np<-length(fxs);h=(b-a)/(np-1)
	int<-3*(fxs[1]+fxs[np])/8+7*(fxs[2]+fxs[np-1])/6+23*(fxs[3]+fxs[np-2])/24+sum(fxs[4:(np-3)])
	return(int*h)
}

Try the BwQuant package in your browser

Any scripts or data that you put into this service are public.

BwQuant documentation built on Feb. 8, 2022, 5:17 p.m.