Re: HSC 2015 2U Marathon
No they weren't the exact intervals, sorry cannot remember them. But I was given them, so I'm assuming they were evenly spaced, from 0 - 1. I think it had 5.
Damn, I cannot remember if I labeled it 0,1,2 or 1,2,3.
Can I ask one more question?
You know how we find h for that formula, (b-a)/n, what is n? It is the number of subintervals right? How do you work that out? Say you had 5 function values (to sub into x).
Thanks for your help!
In that formula,
n is the number of sub-intervals, you're right. Sub-intervals refers to how many points we are using. Basically, is our interval is [
a,
b], we can split it up evenly using the following
x-values:
[
x0,
x1,
x2, ...,
xn – 1,
xn], where
x0 =
a (the starting point of our interval where we're integrating)
xn =
b (our ending point).
Each 'sub-interval' refers to the following intervals: [
x0,
x1], [
x1,
x2], ..., [
xn – 1,
xn]. As you can see, there are
n sub-intervals, because we have a total of
n + 1 points being used.
Since we have equal spacing, the width of each sub-interval is
h = (total width of intervals)/(number of intervals) = (
b –
a)/
n.
Now for Simpson's rule, we actually apply each approximation by spanning over two sub-intervals. E.g. if we had our original interval of integration as [0, 1], we'd need to split it up into at least two sub-intervals, e.g. via the partition {0,½,1} (here, we're using 3
x-values, and the two sub-intervals are [0, ½], [½, 1]).
Then what Simpson's rule would do is it essentially finds the unique quadratic (or line if the function we're integrating is linear) that goes through the points (0,
f(0)), (½,
f(½)), and (1,
f(1)) and computes the integral of this quadratic (or line), and gives us this value as an approximation to the integral of our original function. So you can see that for Simpson's rule to work, we'll need at least 3
x-values. If we want more
x-values, we can add two more (so 5
x-values), but we can't add just one more, since Simpson's rule requires a multiple of 2 to be the number of sub-intervals. E.g. if we tried using the
x-values {0, ⅓, ⅔, 1} (i.e. 4
x values, which is 3 sub-intervals), our Simpson's rule would first be applied over the interval [0, ⅔] (using the y-values at 0, ⅓, and ⅔), but for the next interval, we couldn't use Simpson's rule, since we don't have 3 remaining
x values.
So in general, for Simpson's rule,
n (the no. of sub-intervals) must be even, because we use two sub-intervals for each 'use' of Simpson's rule.
(Sorry if that's hard to understand without a picture. Here's a picture:
http://www.mathwords.com/s/simpsons_rule.htm ; Simpson's rule would be used on the interval [
x0,
x2] (as 3
x-values are used), and then the next one would use the interval [
x2,
x4], so even number of sub-intervals required (a sub-interval is just between adjacent
x values)
So if we had 5
x values to use {
x0 = a,
x1,
x2,
x3,
x4 =
b}, we'd have
n = 4, and Simpson's rule would be used on [
x0,
x2] and [
x2,
x4], and we'd sum up the results. (By using Simpson's rule on these intervals, I mean the rule for using it when there's just 3 values.) If you do this, you see that the 'odd'
x's (i.e. the
x's with odd-numbered subscripts) get counted four times, and the ones with even subscripts get counted twice (and the end points of the entire interval get counted once).