[ Home ] Numerical Methods. Note « 2 »

Lectures
Classical formulas for equally spaced abscissas.
Closed {Newton-Cotes} formulas
1-point {rectangular rule}
0h f{x}dx ≈ I\sub{1} ≡ f{h/2}h + 1/12 h\sup{3} [f''{0}/2!]
2-point {trapezoidal rule}
0h 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}
0h f{x}dx ≈ I\sub{3} ≡ 2/3 I\sub{1} + 1/3 I\sub{2} + 1/15h\sup{5} [f''''{0}/3!]
Problems
  1. Make a subroutine that estimates an integral from a to b by the following algorithm:
    1. subdivide the interval into n subintervals
    2. for each sub-interval estimate the subintegral using one- and two-point {rectangular and trapezoidal} closed rules.
    3. estimate the suberror and combine the rectangular and trapezoidal rules into Simpson's rule
    4. estimate the global integral and global error
  2. Using your program calculate numerically the integral
    -1010 [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)