There are many, many methods of integrating numerically.
And they're important, because many, many integrals
don't have formulas.
And so you have to compute them with a calculator or a machine.
The first type that we've already done are Riemann sums.
They turn out to be incredibly inefficient.
They're lousy.
The next rule that I'm going to describe
is a little improvement.
It's called the trapezoidal rule.
And this one is much more reasonable
than the Riemann sum.
Unfortunately, it's actually also pretty lousy.
There's another rule, which is just a slightly trickier rule.
And it's actually amazing that it exists.
And it's called Simpson's rule.
And this one is actually pretty good, but it's clever.
So let's get started with these.
And the way I'll get started is by reminding you
what the Riemann sum is.
So this is a good review, because you need
to know all three of these.
And you're going to want to see them all laid out in parallel.
So here's the set up.
So here we go.
We have our graph.
We have our function.
It starts out at a.
It ends up at b.
It maybe goes on, but we're only paying attention
to this interval.
This is the function y is equal to f of x,
and we split it up when we do Riemann sums.
So this is one.
This is Riemann sums.
We start out with a, which is a point we call x0,
and then we go a certain distance.
And we go all the way over to b, and we subdivide this thing
with these delta x's, which are the step sizes.
So we have these little steps of size delta x.
Corresponding to these x-values, we have y-values,
y0 is f of x0.
That's the point above a.
Then y1 is f of x1.
That's the point above x1, and so forth all the way up
to yn, which is f of xn.
In order to figure out the area, you really
need to know something about the function.
You need to be able to evaluate it.
So that's what we've done.
We've evaluated here at n plus 1 points, enumerated 0 through n.
And those are the numbers out of which
we're going to get all of our approximations to the integral.
So somehow we want to average these numbers.
So here's our goal.
Our goal is to average or add.
I'm using average very loosely here,
but I'm going to say add up these numbers,
add the y's to get an approximation
to the integral part, which we know
is the area under the curve.
So here's what the Riemann sum is.
It's the following thing.
You take y0 plus y1 plus up to yn and minus 1,
and you multiply by delta x.
That's it.
Now this one is the one with left end points, so
the left-hand sum.
There's also a right one, which is if you
start at the right-hand ends.
And that will go from y1 to yn.
So this one is the right-hand, right Riemann sum.
Those are the two that we did before.