{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw9 - f π 6 using this scheme and indicate the order of...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Due: November 6, 2008 CS 257 (Luke Olson): Homework #9 Problem 1 Problem 1 We are coding for a particle physics team and asked to compute the mass of a region with density ρ = ln ( x ) x - 1 . That is, compute m = Z 1 0 ρ ( x ) dx. We convince the team use n -point Gauss Quadrature, praising its ability to achieve spectral convergence as n increases. Is this a good idea in this situation? Why not Newton-Cotes? Use int gauss.m and hand in a plot (with code) of n versus error along with comments on the outcome . ( hint: the integral should be π 2 / 6 . See dilog and polylogarithm in Wikipedia for more information ). Problem 2 The same team of scientists uses a difference scheme f 0 ( x ) 1 2 h [4 f ( x + h ) - 3 f ( x ) - f ( x + 2 h )] in many of their calculations. Using f ( x ) = cos ( x ) as a test case, approximate
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f ( π/ 6) using this scheme and indicate the order of convergence (i.e. what is p in | f ( pi/ 6)-approx | = ch p . Use the ratio of p = | e k | | e k +1 | for this estimate). Hand-in code, and estimate of p , and the following table. h approx df exact df error ratio 1/10 1/20 1/40 1/80 1/160 1/320 1/640 The following printline in Matlab may help printing the table: 1 fprintf ( ’%-10s %-10s %-10s %-10s %-10s\n’ , ’h’ , ’approx df’ , ’exact df’ , ’error’ , ’ratio’ ); 2 fprintf ( ’%-10s %-10g %-10g %-10.2g %-10.2g\n’ ,strtrim( rats (h)),df,dfexact,err(j),ratio); Page 1 of 1...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern