Description
Given a continuous function f:[a,b]→R, we want to calculate:
∫abf(x) If F is a primitive of f:
∫abf(x)dx=F(b)−F(a) Since there is not always a known primitive F, it’s better to approximate the value of the integral. The trapezoidal rule gives the following approximation:
Ii=∫xixi+1f(x)dx≈21[f(xi)+f(xi+1)](xi+1−xi) By making h=nb−a, we get:
∫abf(x)dx∫abf(x)dx=i=0∑n−1Ii≈2hi=0∑n−1[f(xi)+f(xi+1)]≈h[2f(a)+f(b)+i=1∑n−1f(xi)]