# HW02.pdf - Math 104A Homework#2 Instructor Lihui Chai...

• 3

This preview shows page 1 - 2 out of 3 pages.

Math 104A Homework #2*Instructor: Lihui ChaiGeneral Instructions:Please write your homework papers neatly. You need to turn in bothfull 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 polynomialP2(x) corresponding to thedata in the table below:xjf(xj)01113-5(b) UseP2(x) you obtained in (a) to approximatef(2).2.(optional)We proved in class thatkf-Pnk(1 + Λn)kf-P*nk,(1)wherePnis the interpolating polynomial offat the nodesx0, ...,xn,P*nis the best ap-proximation off, in the maximum (infinity) norm, by a polynomial of degree at mostn,andΛn=nXj=0l(n)j,(2)is the Lebesgue constant (here thel(n)jare the elementary Lagrange polynomials).(a) Write a computer code to evaluate the Lebesgue functionL(n)(x) =nXj=0l(n)j(x),(3)associated to a given set of pairwise distinct nodesx0, ...,xn.