{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lab2 - MA 2213 Numerical Analysis 1 Year 20122013 Semester...

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

MA 2213 Numerical Analysis 1 Year 2012–2013 Semester II Laboratory 2 Objectives 1. Task 1: to reduce the interpolation error by adjusting the locations of the nodes 2. Task 2: to build a function that computes the coeﬃcients of natural cubic splines Background 1. Let P n be the interpolating polynomial for f : [ a, b ] R using n + 1 distinct nodes x 0 , x 1 , . . . , x n . The interpolation error at x is given by | f ( x ) - P n ( x ) | . If we are allowed to choose the n + 1 nodes freely, then which choice is the “best”? A natural way to define “the best” is the one that makes the maximum absolute error in [ a, b ] (worst-case error throughout the interval [ a, b ]) max x [ a,b ] | f ( x ) - P n ( x ) | minimal. To simplify the problem, we let y j = a + j ( b a ) m for j = 0 , 1 , 2 , . . . , m with a large integer m (e.g. 2 × 10 5 ) and consider the minimization of E ( x 0 , x 1 , . . . , x n ) := max j =0 , 1 ,...,m | f ( y j ) - P n ( y j ) | . with respect to x 0 , x 1 , . . . , x n . In this task, you are asked to empirically determine a good distribution of the nodes (one that makes the error E ( x 0 , . . . , x n ) small). When you finish this task, upload the best error and the corresponding nodes that you found to IVLE. The best three solutions will be posted in the Forum for sharing. 2. We shall use notations that are consistent with Matlab. Let ( x i , f i ) for i = 1 , 2 , . . . , n be given data (note that the index starts from 1 instead of 0 because indices of Matlab arrays start from 1). Let h i = x i +1 - x i for i = 1 , 2 , . . . , n - 1 be the spacing of the i th subinterval. Then, the n × n linear system that determines the coeﬃcients { c i } i =1 , 2 ,...,n of a natural spline is (the blanks depict zeros) 1 0 h 1 2( h 1 + h 2 ) h 2 h 2 2( h 2 + h 3 ) h 3 . . . . . . . . . . . . . . . . . . h n - 2 2( h n - 2 + h n - 1 ) h n - 1 0 1 c 1 c 2 c 3 . . . . . . c n - 1 c n = 0 3 h 2 ( f 3 f 2 ) 3 h 1 ( f 2 f 1 ) 3 h 3 ( f 4 f 3 ) 3 h 2 ( f 3 f 2 ) .

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