Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm taking a course on numerical methods to be able to program math, it's part of the game option of my compsci bachelors.This is part of one of the questions:

Given the integral: $\int_6^{12} (9x^3 - x^4)dx$

A. Using the Composite Trapezoidal Rule, what is the min. n required to have an accuracy of six decimal places (TOL. $\le 10^{-6}$), in the approximation of the given integral. n must be solved theoretically.

B. just use the composite trapezoidal rule with said n, which is easy since I programmed the rule (code here: http://pastebin.com/QzRdijrh)

C. Same as A but for Composite Simpson's rule.

D. Same as B but for Composite Simpson's rule (code here: http://pastebin.com/V9DYdRXU)

So the problem I'm having is I can't remember how to find minimum n, I know for Bisection Algorithm you make $2^n \le (b-a)/TOL$ But I forgot how to apply that to other rules...

share|improve this question
add comment

1 Answer 1

The error term of the composite trapezoidal rule is $\frac {(b-a)^3}{12n^2}f''(\xi)$ so you need to evaluate the second derivative of your function, find its maximum and plug everything in. You will get something like error $\lt \frac a{n^2}$. Then you choose $n$ to get the error lower than $10^{-6}$. For the composite Simpson's rule, the approach is the same, but you have a different expression for the error.

share|improve this answer
    
The reason we ignore the error term is we're given no value of z (the number plugged into the 3rd derivative). But basically to get min n for any of these it's $error term \ge TOL$? I'm just trying to figure out a way to generalize it because I can't seem to find it in any of my notes and I copy everything off the board word for word. –  Portaljacker Nov 9 '12 at 16:27
    
@Portaljacker: you can find the maximum of the second derivative over your interval. The derivative is $54x-12x^2$, which has maximum absolute value at $x=12$ of 1080, so you can use that for the second derivative term. The real error will be less. –  Ross Millikan Nov 9 '12 at 16:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.