hw8solns

# hw8solns - 151A HW 8 Solutions Will Feldman 1(a Calculus(b...

This preview shows pages 1–2. Sign up to view the full content.

151A HW 8 Solutions Will Feldman 1. (a) Calculus. (b) e in both cases by calculus. (c) For composite trapezoid rule the error bound is (for h = 1 /N the grid length) Z 1 0 f ( x ) dx - h 2 ( f (0) + N - 1 X k =1 2 f ( kh ) + f (1)) h 2 max ξ [0 , 1] | f 00 ( ξ ) | 12 . So in order to be sure that the error for composite trapezoid for f ( x ) = e x is less than 10 - 8 we should choose N - 2 e/ 12 < 10 - 8 i.e. N ( e · 10 8 12 ) 1 / 2 4760. Meanwhile for Simpson’s rule the error bound looks like Z 1 0 e x dx - I S N ( e x ) h 4 180 max ξ [0 , 1] | f (4) ( ξ ) | so we solve for N - 4 e/ 180 < 10 - 8 i.e. N 36. (d) Straightforward Matlab computations. 2. Similar to the Matlab computations from last assignment. If a method is of order α then we expect that as 1 /N = h 0 we have E ( N ) C (1 /N ) α or log E ( N ) = - α log N + ˜ C . That is, the dependence of the error E ( N ) on the number of grid panels N is log linear and the slope of the line is - α . Below code is a Matlab function which implements Trapezoid rule: function out = trapezoid(f,a,b,n) h = (b-a)/n; int = f(a); for i = 1:n-1 int = int+2*f(i*h); end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern