HW02.pdf - Math 104A Homework#2 Instructor Xu Yang General Instructions Please write your homework papers neatly You need to turn in both your codes and

HW02.pdf - Math 104A Homework#2 Instructor Xu Yang General...

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

Math 104A Homework #2 * Instructor: Xu Yang General Instructions: Please write your homework papers neatly. You need to turn in both your codes and descriptions on the appropriate runs you made by compressing and emailing them to TA with your name and perm number as the file name. 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.(a) Implement the Barycentric Formula for evaluating the interpolating polynomial for arbi-trarily distributed nodesx0, ..., xn; you need to write a function or script that computesthe barycentric weightsλ(n)j= 1/Πk6=j(xj-xk) first and another code to use these valuesin the Barycentric Formula. Make sure to test your implementation.(b) Consider the following table of dataxjf(xj)0.000.00000.250.70710.501.00000.750.70711.25-0.70711.50-1.0000Use your code in (a) to findP5(2) as an approximation off(2).3.The Runge Example.Letf(x) =1

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture