[
Home
]
Numerical Methods. Note
«
2
»
Lectures
Classical formulas for equally spaced abscissas.
Closed {Newton-Cotes} formulas
1-point {rectangular rule}
∫
0
h
f{x}dx ≈ I\sub{1} ≡ f{
h
/
2
}h +
1
/
12
h\sup{3} [
f''{0}
/
2!
]
2-point {trapezoidal rule}
∫
0
h
f{x}dx ≈ I\sub{2} ≡ [
1
/
2
f{0} +
1
/
2
f{h}]h +
-1
/
6
h\sup{3} [
f''{0}
/
2!
]
3-point {Simpson's rule}
∫
0
h
f{x}dx ≈ I\sub{3} ≡
2
/
3
I\sub{1} +
1
/
3
I\sub{2} +
1
/
15
h\sup{5} [
f''''{0}
/
3!
]
Problems
Make a subroutine that estimates an integral from a to b by the following algorithm:
subdivide the interval into n subintervals
for each sub-interval estimate the subintegral using one- and two-point {rectangular and trapezoidal} closed rules.
estimate the suberror and combine the rectangular and trapezoidal rules into Simpson's rule
estimate the global integral and global error
Using your program calculate numerically the integral
∫
-10
10
[
1
/
1+x\sup{2}
] dx
with relative accuracy 0.0001 and find out, how many times the integrand should be called.
m4
"
Copyleft
"
©
2001
D.V.Fedorov
(
fedorov@ifa.au.dk
)