1
$\begingroup$

I need to use the trapezoid rule to approximate the following integral: $$\int^{0}_{-2}\frac{1}{4+x^2}dx$$ for a given step $n=5$.

I'm not exactly sure how to do a problem like this.

  • 0
    What's the formula you're using for the trapezoidal rule, first of all?2012-07-30
  • 0
    I'm not really sure actually. http://en.wikipedia.org/wiki/Trapezoidal_rule2012-07-30
  • 0
    This problem you have came from a book, no? What's the formula given in the book?2012-07-30
  • 0
    I believe that it is: $$\frac{1}{2}h(f(a)+2f(x_1)+2f(x_2)+2f(x_3)+...+2f(x_{n-1})+f(b))$$2012-07-30
  • 0
    Very good. Now, why are you unable to use that formula?2012-07-30
  • 0
    It's not that I've never been able to use the formula, I've just never done a problem like this before.2012-07-30
  • 1
    First things first: how would you divide the interval $[-2,0]$ into *four* sub-intervals? (If you have four sub-intervals, you have *five* points; think of the number of fingers in a hand, and the number of gaps in between the fingers.)2012-07-30
  • 0
    it would be (-2/5), so the intervals would be... $f(0),2f(-2/5),2f(-4/5),2f(-6/5),2f(-8/5),f(-2)$?2012-07-30
  • 0
    You've cut up your interval into *five* **intervals** (and thus *six* points); you only need *five* points (and thus *four* intervals)...2012-07-30
  • 0
    so $f(0),2f(−2/5),2f(−4/5),2f(−6/5),f(−2)$?2012-07-30
  • 0
    and then take the sum of each one of those answers, multiply it by (1/2)(1/5), and would that be my approximation?2012-07-30
  • 1
    Still not that. Try an increment of $\frac12$.2012-07-30
  • 0
    why would it be 1/2? wouldn't it be 2/5?2012-07-30
  • 1
    $(-2,-3/2,-1,-1/2,0)$. Five points, four panels.2012-07-30
  • 0
    yes, I understand what I did wrong there. But when figuring out what $h$ is equal to ($h=\frac{b-a}{n}$), in this case, wouldn't it be 2/5 since n=5?2012-07-30
  • 0
    is it 2/4 because there are only 4 subintervals? That just doesn't make sense to me because it clearly says that n=5, and if in the formula it says (b-a)/n, why wouldn't it just be 5?2012-07-30
  • 0
    That's why I was asking for the formula you're familiar with. The convention I'm used to has $n$ be the number of points, while it seems the convention you're using has $n$ be the number of subintervals. So, which?2012-07-30
  • 0
    I just looked and n was referring to the number of trapezoids. So in that case, would I be correct?2012-07-30
  • 0
    For a domain discretized into "N" equally spaced panels, or "N+1" grid points (1, 2, ..., N+1), where the grid spacing is "h=(b-a)/N", the approximation to the integral becomes $$\int_{a}^{b} f(x)\, dx \approx \frac{h}{2} \sum_{k=1}^{N} \left( f(x_{k+1}) + f(x_{k}) \right) {}= \frac{b-a}{2N}(f(x_1) + 2f(x_2) + 2f(x_3) + \ldots + 2f(x_N) + f(x_{N+1}))$$.2012-07-30
  • 0
    In that formula you gave, then your increment of $2/5$ would be right.2012-07-30
  • 0
    except, that formula says 2n where it is supposed to be 1n. Regardless, could you solve the problem so I can verify that I have the correct answer? this problem is a test grade! also, I tried to do a similar problem and I got it wrong somehow..2012-07-30

1 Answers 1

1

http://www.ugrad.math.ubc.ca/coursedoc/math101/notes/techniques/numerical.html, check if it helps..