Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Simpson's Rule and Integration, Lecture notes of Calculus

Simpson's Rule. Simpson's Rule is based on the fact that given any three points, you can find the equation of a quadratic through those points.

Typology: Lecture notes

2021/2022

Uploaded on 09/27/2022

lilylily
lilylily 🇬🇧

4

(8)

218 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Simpson’s Rule and Integration
Approximating Integrals
Simpson’s Rule
Programming Integration
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Simpson's Rule and Integration and more Lecture notes Calculus in PDF only on Docsity!

Simpson’s Rule and Integration

  • Approximating Integrals
  • Simpson’s Rule
  • Programming Integration

Approximating Integrals

In Calculus, you learned two basic ways to approximate the value of an integral:

  • Reimann sums: rectangle areas with heights calculated at the left side, right side, or midpoint of each interval
  • Trapezoidal sums: areas of trapezoids formed at each interval

Simpson’s Rule

Simpson’s Rule, named after Thomas Simpson though also used by Kepler a century before, was a way to approximate integrals without having to deal with lots of narrow rectangles (which also implies lots of decimal calculations). Its strength is that, although rectangles and trapezoids work better for linear functions, Simpson’s Rule works quite well on curves.

Simpson’s Rule

Simpson’s Rule is based on the fact that given any three points, you can find the equation of a quadratic through those points. For example, let’s say you had points (3, 12), (1, 5), and (5, 9). Starting with (3, 12) and using y = ax 2

  • bx + c, you could write: 12 = a(3) 2
  • b(3) + c 12 = 9a + 3b + c You could do the same thing with the other two points as well, getting: 5 = a + b + c 9 = 25a + 5b + c Then you could solve this system of equations for a, b, and c, and get the equation of the quadratic. x y

Simpson’s Rule

This fact inspired Simpson to approximate integrals using quadratics, as follows. If you want to integrate f(x) over the interval from a to b,

  1. Find f(a), f(b), and f(m) where m is the midpoint of the interval.
  2. Find a quadratic P(x) that goes through the same three points.

Simpson’s Rule

Then, because quadratics are easy to integrate, you could just integrate the quadratic over the interval. It ends up being a very good approximation, but it’s also a lot of math! Fortunately, there’s a nice shortcut. It turns out that the integral of the quadratic over the interval [a, b] always comes out to 𝑏 − 𝑎 6 ∙ 𝑓 𝑎 + 4𝑓 𝑚 + 𝑓(𝑏) where f(a), f(m) and f(b) were the values of the original function at a, m, and b. You don’t need the quadratic at all.

Practice Problem 1

1a. Take the integral of y = - 1.25x 2

  • 8.5x – 2. from 1 to 5. Verify that it has the same value as the Simpson’s Rule formula for the three points (1, 5), (3, 12) and (5, 9). 1b. Verify Simpson’s Rule using the quadratic y = 2x 2
  • 5x + 12 on the interval [-1, 5]. 1c. Verify Simpson’s Rule using the cubic y = x 3

2x 2

  • 5x – 2 on the interval [0, 2]

Simpson’s Rule

As you (hopefully) noticed in problem 1, Simpson’s Rule gives exactly correct answers for quadratics and cubics. For other functions, Simpson’s Rule only gives an approximation.

Simpson’s Rule

Like any other approximation rule, Simpson’s works best when the interval is narrow and the function values over that interval have a similar shape to the approximation device (in this case, a quadratic curve). Some function types, like exponentials, can cause problems because their shape over a broad interval is not similar enough to a quadratic. Here, the exponential is shown in red and the Simpson’s quadratic in blue.

Simpson’s Rule

However, this problem can be alleviated by dividing larger intervals into smaller sub- intervals over which Simpson’s Rule will continue to work well. The number of sub-intervals should depend on the width of the original interval; it makes as little sense to divide an interval of width 0.5 by 5 as it does to divide an interval of width 100 by 5.

Practice Problem 4

Decide how you will divide any interval of width w into a whole number of evenly-spaced sub- intervals whose width is approximately the width you chose in problem 3.

Practice Problem 5

Design a program to take integrals using Simpson’s Rule that…

  • divides the given interval into a whole number of even sub-intervals of acceptable width
  • runs Simpson’s Rule across those subintervals
  • finds the sum of the subinterval integrals for the total area. Test, document and save your code!