首页 > > 详细

讲解R程序、R编程辅导、辅导留学生R设计、R讲解、辅导留学生R设计、R程序讲解

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:
(b) Use P2(x) you obtained in (a) to approximate f(2).
2. (optional) We proved in class that
kf Pnk1 (1 + n)kf P nk1; (1)
where Pn is the interpolating polynomial of f at the nodes x0, ..., xn, P n is the best ap-
proximation of f, in the maximum (in nity) norm, by a polynomial of degree at most n,
is the Lebesgue constant (here the l(n)j are the elementary Lagrange polynomials).
(a) Write a computer code to evaluate the Lebesgue function
associated to a given set of pairwise distinct nodes x0, ..., xn.
All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma-
terials) 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
(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. xk = 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
L(n)(x) and n with those corresponding to the equidistributed points in (b).
3. (a) Implement the Barycentric Formula for evaluating the interpolating polynomial for arbi-
trarily distributed nodes x0;:::;xn; you need to write a function or script. that computes
the barycentric weights (n)j = 1= k6=j(xj xk) rst and another code to use these values
in the Barycentric Formula. Make sure to test your implementation.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!