Numerical Methods/Numerical Integration
Often, we need to find the integral of a function that may be difficult to integrate analytically (ie, as a definite integral) or impossible (the function only existing as a table of values).
Some methods of approximating said integral are listed below.
Trapezoidal Rule
Consider some function, possibly unknown, , with known values over the interval [a,b] at n+1 evenly spaced points xi of spacing , and .
Further, denote the function value at the ith mesh point as .
Using the notion of integration as "finding the area under the function curve", we can denote the integral over the ith segment of the interval, from to as:
= (1)
Since we may not know the antiderivative of , we must approximate it. Such approximation in the Trapezoidal Rule, unsurprisingly, involves approximating (1) with a trapezoid of width h, left height , right height . Thus,
(1) = (2)
(2) gives us an approximation to the area under one interval of the curve, and must be repeated to cover the entire interval.
For the case where n = 2,
= (3)
Collecting like terms on the right hand side of (3) gives us:
or
Now, substituting in for h and cleaning up,
To motivate the general version of the trapezoidal rule, now consider n = 4,
Following a similar process as for the case when n=2, we obtain
Proceeding to the general case where n = N,
This is an example of what the trapezoidal rule would represent graphicly, here .
Example
Approximate to within 5%.
First, since the function can be exactly integrated, let us do so, to provide a check on our answer.
= (4)
We will start with an interval size of 1, only considering the end points.
(4)
Relative error =
Hmm, a little high for our purposes. So, we halve the interval size to 0.5 and add to the list
(4)
Relative error =
Still above 0.01, but vastly improved from the initial step. We continue in the same fashion, calculating and , rounding off to four decimal places.
(4)
Relative error =
We are well on our way. Continuing, with interval size 0.125 and rounding as before,
(4)
Relative error =
Since our relative error is less than 5%, we stop.
Error Analysis
Let y=f(x) be continuous,well-behaved and have continuous derivatives in [x0,xn]. We expand y in a Taylor series about x=x0,thus-
Simpson's Rule
Consider some function possibily unknown with known values over the interval [a,b] at n+1 evently spaced points then it defined as
where and and .
Example
Evaluate by taking ( must be even)
Solution: Here
Since & so
Now when then
And since , therefore for , , , , , the corresponding values are , , , , ,
Incomplete ... Completed soon
Error Analysis
Simpson's 3/8
Headline text
Example
Error Analysis
References
Eric W. Weisstein. "Trapezoidal Rule." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/TrapezoidalRule.html