Solutions to Problem Set 3 | Numerical Analysis | MATH 128A, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Assignment; Class: Numerical Analysis; Subject: Mathematics; University: University of California - Berkeley; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 10/01/2009

koofers-user-qwn-1
koofers-user-qwn-1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 128a, Section 3 Solutions to Problem Set 3
(2) We have three ways to represent the linear polynomial p(x) which interpolates
values y1at x1and y2at x2: (a) the power form, (b) the Newton form, and (c) the
Lagrange form. Carry out a backward error analysis of each form in floating-point
arithmetic with machine precision : in other words, either show that the computed
result ˆp(x) is the exact value of the linear polynomial interpolating ˆy1at ˆx1and
ˆy2at ˆx2and bound the relative error in the ˆx’s and ˆy’s by small multiples of ,
or show that ˆp(x) is not in general the exact value of any such linear interpolating
polynomial.
Solution: We will work these in reverse order, from easiest to hardest.
(c) The Lagrange form: The floating-point calculation ˆp(x) takes the following
form:
ˆp(x) = (xx2)(1 + δ1)
(x1x2)(1 + δ2)(1 + δ3)y1(1 + δ4) + (xx1)(1 + δ5)
(x2x1)(1 + δ6)(1 + δ7)y2(1 + δ8)(1+δ9).
By making the substitutions
(1 + 5) = (1 + δ1)
(1 + δ2)(1 + δ3)(1 + δ4)(1 + δ9)
and
(1 + 0
5) = (1 + δ5)
(1 + δ6)(1 + δ7)(1 + δ8)(1 + δ9),
this simplifies to
ˆp(x) = xx2
x1x2
y1(1 + 5) + xx1
x2x1
y2(1 + 5),
which is the exact value at xof the polynomial interpolating y1(1 + 5) at x1and
y2(1 + 0
5) at x2. Each of these relative errors is bounded by 10.
(b) The Newton form: We saw in class that there was some difficulty in assigning
the errors consistently to the input variables, but the problem asks for either a
solution, or a proof that none exists. What we need, then, is some specific choice
of inputs, and a proof that no small perturbation of those inputs produces an error
as large as the error in ˆp(x), the floating-point approximation of the Newton form
interpolating polynomial. One approach to such a proof relies on the bad behavior
of floating-point arithmetic when adding numbers of opposite sign to try to compute
0. To be specific, let x1=y1=1 and x2=y2= 0, and interpolate at the point
x= 0. The floating-point approximation is
ˆp(x) = y1+(y2y1)(1 + δ1)
(x2x1)(1 + δ2)(1 + δ3)(xx1)(1 + δ4)(1 + δ5)(1 + δ6).
By making the substitution
(1 + 5) = (1 + δ1)
(1 + δ2)(1 + δ3)(1 + δ4)(1 + δ5)
and plugging in the data points we have chosen, this simplifies to
ˆp(0) = [1+(1+∆5)] (1 + δ6)
= 5(1 + δ6)
= 5+O(2).
pf3

Partial preview of the text

Download Solutions to Problem Set 3 | Numerical Analysis | MATH 128A and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Math 128a, Section 3 — Solutions to Problem Set 3 (2) We have three ways to represent the linear polynomial p(x) which interpolates values y 1 at x 1 and y 2 at x 2 : (a) the power form, (b) the Newton form, and (c) the Lagrange form. Carry out a backward error analysis of each form in floating-point arithmetic with machine precision : in other words, either show that the computed result ˆp(x) is the exact value of the linear polynomial interpolating ˆy 1 at ˆx 1 and ˆy 2 at ˆx 2 and bound the relative error in the ˆx’s and ˆy’s by small multiples of , or show that ˆp(x) is not in general the exact value of any such linear interpolating polynomial.

Solution: We will work these in reverse order, from easiest to hardest. (c) The Lagrange form: The floating-point calculation ˆp(x) takes the following form:

pˆ(x) =

[

(x − x 2 )(1 + δ 1 ) (x 1 − x 2 )(1 + δ 2 ) (1 + δ 3 )y 1 (1 + δ 4 ) +

(x − x 1 )(1 + δ 5 ) (x 2 − x 1 )(1 + δ 6 ) (1 + δ 7 )y 2 (1 + δ 8 )

]

(1+δ 9 ).

By making the substitutions

(1 + ∆ 5 ) = (1 + δ 1 ) (1 + δ 2 )

(1 + δ 3 )(1 + δ 4 )(1 + δ 9 )

and

(1 + ∆′ 5 ) =

(1 + δ 5 ) (1 + δ 6 )

(1 + δ 7 )(1 + δ 8 )(1 + δ 9 ),

this simplifies to

pˆ(x) =

x − x 2 x 1 − x 2

y 1 (1 + ∆ 5 ) +

x − x 1 x 2 − x 1

y 2 (1 + ∆ 5 ),

which is the exact value at x of the polynomial interpolating y 1 (1 + ∆ 5 ) at x 1 and y 2 (1 + ∆′ 5 ) at x 2. Each of these relative errors is bounded by 10.

(b) The Newton form: We saw in class that there was some difficulty in assigning the errors consistently to the input variables, but the problem asks for either a solution, or a proof that none exists. What we need, then, is some specific choice of inputs, and a proof that no small perturbation of those inputs produces an error as large as the error in ˆp(x), the floating-point approximation of the Newton form interpolating polynomial. One approach to such a proof relies on the bad behavior of floating-point arithmetic when adding numbers of opposite sign to try to compute

  1. To be specific, let x 1 = y 1 = −1 and x 2 = y 2 = 0, and interpolate at the point x = 0. The floating-point approximation is

pˆ(x) =

[

y 1 +

(y 2 − y 1 )(1 + δ 1 ) (x 2 − x 1 )(1 + δ 2 ) (1 + δ 3 )(x − x 1 )(1 + δ 4 )(1 + δ 5 )

]

(1 + δ 6 ).

By making the substitution

(1 + ∆ 5 ) = (1 + δ 1 ) (1 + δ 2 )

(1 + δ 3 )(1 + δ 4 )(1 + δ 5 )

and plugging in the data points we have chosen, this simplifies to

pˆ(0) = [−1 + (1 + ∆ 5 )] (1 + δ 6 ) = ∆ 5 (1 + δ 6 ) = ∆ 5 + O(^2 ).

Is this the same as the exact value on approximate inputs? Let us define a new linear polynomial ˜p(x) which interpolates the perturbed data

yˆ 1 = y 1 (1 + ε 1 ), y ˆ 2 = y 2 (1 + ε 2 ), x ˆ 1 = x 1 (1 + ε 3 ), and xˆ 2 = x 2 (1 + ε 4 ),

and evaluate it at the point ˆx = x(1 + ε 5 ). The resulting calculation

p˜(ˆx) = −(1 + ε 1 ) +

0(1 + ε 2 ) + (1 + ε 1 ) 0(1 + ε 4 ) + (1 + ε 3 )

(0(1 + ε 5 ) + (1 + ε 3 ))

simplifies to exactly 0, showing that the floating point error, which might be as large as 5, cannot possibly be attributed to a small relative error in the input data.

Note: In actuality, ∆ 5 (1 + δ 6 ) = 0 for the input data we have chosen, since floating point calculations involving only a few 1’s and 0’s are exact. If this bothers you, play around with numbers close to −1 and 0 until you come up with a genuine counterexample.

(a) The power form (also called Van der Monde): We have seen in a previous homework assignment that this form behaves badly when the size of the xi’s is large compared to their difference, so it is reasonable to try to make backwards error analysis fail by setting x 1 = 1 and x 2 = 1 + t, where t is some small number, but larger than . It is convenient to use t =

, so that O() = O(t^2 ). We will set y 1 = y 2 = t, so the correct interpolant is the constant function p(x) = t, and then evaluate the floating-point approximation ˆp(x) of the power form interpolant at the value x = 1. The resulting mess

pˆ(x) =

[ (^) (y 1 x 2 (1+δ 1 )−y 2 x 1 (1+δ 2 ))(1+δ 3 ) (x 2 −x 1 )(1+δ 4 ) (1 +^ δ^5 )

  • ((yx^22 −−yx^11 )(1+)(1+δδ^64 )) (1 + δ 7 )x(1 + δ 8 )

]

(1 + δ 9 )

simplifies to

pˆ(1) = t(1 + t)(1 + δ 1 ) − t(1 + δ 2 )) t

= (δ 1 − δ 2 + t(1 + δ 1 ))(1 + ∆ 4 ) = p(1) + (δ 1 − δ 2 ) + O(t^3 ).

This is supposed to equal ˜p(ˆx), the exact interpolant on perturbed data. (Since the exact interpolant is the same using any method, we use the Newton form which we have already worked out.)

p˜(ˆx) = t(1 + ε 1 ) +

t(1 + ε 2 ) − t(1 + ε 1 ) (1 + t)(1 + ε 4 ) − (1 + ε 3 )

((1 + ε 5 ) − (1 + ε 3 ))

simplifies to

p˜(1 + ε 5 ) = t + tε 1 +

t t + ε 4 − ε 3 + tε 4

(ε 2 − ε 3 )(ε 5 − ε 3 )

= t + O(t^3 ) +

t t + O(t^2 )

(O(t^4 ))

= p(1) + O(t^3 ).