# Math 104A Homework #3

Math 104A Homework #3 ∗

Instructor: Xu Ynag
(on Gauchoapace) to turn it in. Write your own code individually. Do not copy codes!
(b) Let P1(x) be the linear polynomial that interpolates f(x) = sin x at x0 = 0 and x1 = π/2.
Using (a) find a bound for the maximum error kf f P1k∞ and compare this bound with
the actual error at x = π/4.
2. (a) Equating the leading coefficient of in the Lagrange form of the interpolation polynomial
Pn(x) with that of the Newton’s form deduce that
(b) Use (a) to conclude that divided differences are symmetric functions of their arguments,
i.e. any permutation of x0, x1, ..., xn leaves the corresponding divided difference un￾changed.
3. In Newton’s form of the interpolation polynomial we need to compute the coefficients, c0 =
f[x0], c1 = f[x0, x1], ..., cn = f[x0, x1, ..., xn]. In the table of divided differences we proceed
column by column and the needed coefficients are in the uppermost diagonal. A simple 1D
array, c of size n + 1, can be used to store and compute these values. We just have to compute
them from bottom to top to avoid losing values we have already computed. The following
pseudocode does precisely this:
for j = 0, 1, ..., n do
∗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
written permission of Prof. Hector D. Ceniceros.
(a) Write computer codes to compute the coefficients c0, c1, ..., cn and to evaluate the corre￾sponding interpolation polynomial at an arbitrary point x. Test your codes and turn in
(b) Consider the function f(x) = e
for x ∈ [[1, 1] and the nodes xj = =1 + j(2/10),
j = 0, 1, ..., 10. Use your code in (a) to evaluate P10(x) at the points ¯xj = =1+j(2/100),
j = 0, 1, ..., 100 and plot the error f(x) ) P10(x).
4. Inverse Interpolation. Suppose that we want to solve the equation f(x) = 0, for some function
f which has an inverse f
. If we have two approximations x0 and x1 of a zero ¯x of f then we
can use interpolation to find a better approximation, ¯x ≈ f
(0), as follows. Let y0 = f(x0)
[y0, y1, y2]. Once this is computed we can evaluate P2(0) to get an improved
approximation ¯x, etc. Let f(x) = x x e
䛈x using the values f(0.5) = =0.106530659712633
and f(0.6) = 0.051188363905973 find an approximate value for the zero ¯x of f by evaluating
P1(0).
5. Obtain the Hermite interpolation polynomial corresponding to the data f(0) = 0, f

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp2