powered by
trapz(x, y)
x <- seq( 0, 1, by = 0.0001 ) y <- exp( x ) # Compare with true area of exp( 1 ) - 1 = 1.718282... areaEstimate <- trapz( x, y )
Run the code above in your browser using DataLab