Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Math 104A Homework #2 Instructor: Lihui Chai General Instructions: Please write your homework papers neatly. You need to turn in both full printouts of your

Math 104A Homework #2 Instructor: Lihui Chai General Instructions: Please write your homework papers neatly. You need to turn in both full printouts of your codes and the appropriate runs you made. Write your own code, individually. Do not copy codes! 1. (a) Write the Lagrangian form of the interpolating polynomial P2 (x) corresponding to the data in the table below: xj 0 1 3 f (xj ) 1 1 -5 (b) Use P2 (x) you obtained in (a) to approximate f (2). 2. We proved in class that kf Pn k1 , Pn k1 (1 + n ) kf (1) where Pn is the interpolating polynomial of f at the nodes x0 , ..., xn , Pn is the best approximation of f , in the maximum (infinity) norm, by a polynomial of degree at most n, and n = n X (n) lj j=0 (n) is the Lebesgue constant (here the lj , (2) 1 are the elementary Lagrange polynomials). (a) Write a computer code to evaluate the Lebesgue function L(n) (x) = n X (n) lj (x) , (3) j=0 associated to a given set of pairwise distinct nodes x0 , ..., xn . All course materials (class lectures and discussions, handouts, homework assignments, examinations, web materials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of Prof. Hector D. Ceniceros. 1 (b) Consider the equidistributed points xj = 1 + j(2/n) for j = 0, ..., n. Write a computer code that uses (a) to evaluate and plot L(n) (x) (evaluate L(n) (x) at a large number of points x to have a good plotting resolution, e.g. x k = 1 + k(2/ne ), k = 0, ..., ne with ne = 1000) for n = 4, 10, and 20. Estimate n for these three values of n. (c) Repeat (b) with the nodes given by xj = cos( j n ), j = 0, ..., n. Contrast the behavior of (n) L (x) and n with those corresponding to the equidistributed points in (b). 3. (a) Implement the Barycentric Formula for evaluating the interpolating polynomial for arbitrarily distributed nodes x0 , ..., xn ; you need to write a function or script that computes (n) the barycentric weights j = 1/k6=j (xj xk ) first and another code to use these values in the Barycentric Formula. Make sure to test your implementation. (b) Consider the following table of data xj 0.00 0.25 0.50 0.75 1.25 1.50 f (xj ) 0.0000 0.7071 1.0000 0.7071 -0.7071 -1.0000 Use your code in (a) to find P5 (2) as an approximation of f (2). 4. The Runge Example. Let f (x) = 1 , 1 + x2 x 2 [ 5, 5]. (4) Using your Barycentric Formula code (Prob. 3) and (5) and (6) below, evaluate and plot the interpolating polynomial of f (x) corresponding to (a) the equidistributed nodes xj = (b) (c) 5 + j(10/n), j = 0, ..., n for n = 4, 8, and 12. the nodes xj = 5 cos( j n ), j = 0, ..., n 2 Repeat (a) for f (x) = e x /5 for x 2 for n = 4, 8, 12, and 100. [ 5, 5] and comment on the result. Remark 1. It can be shown that for equidistributed nodes one can use the barycentric weights (n) j n = ( 1) , j = 0, ..., n, (5) j j where n j is the binomial coefficient (nchoosek(n,j) in Matlab). It can be shown that for the nodes xj = a+b 2 + b a 2 cos( j n ), j = 0, ..., n, in [a, b], one can use (n) j = ( 1 2( 1)j ( 1)j for j = 0 or j = n for j = 1, ..., n 1. (6) Make sure to employ (5) and (6) in your Barycentric Formula code for this problem. To plot the corresponding Pn (x) evaluate Pn (x) at a large number of points x to have a good plotting 2 resolution, e.g. x k = 5 + k(10/ne ), k = 0, ..., ne with ne = 5000. Note that your Barycentric Formula cannot be used to evaluate Pn (x) when x coincides with an interpolating node! Plot also f for comparison. Compare (a) and (b) and comment on the result in view of what you observed in Prob. 2. 3 Interpolation Hector D. Ceniceros 1 Approximation Theory Given f C[a, b], we would like to find a \"good\" approximation to it by \"simpler functions\

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

College Algebra Graphs and Models

Authors: Marvin L. Bittinger, Judith A. Beecher, David J. Ellenbogen, Judith A. Penna

5th edition

321845404, 978-0321791009, 321791002, 978-0321783950, 321783956, 978-0321845405

More Books

Students also viewed these Mathematics questions

Question

=+How would you convince this individual that this is not the case?

Answered: 1 week ago