CS/SE Eng 4X03
Do Not Share this document
Problem 1 [4 points] Let x and y be finite IEEE-754 double precision numbers. Consider the evaluation of
u = x*sqrt(y);
v = 2*u;
in IEEE double precision (sqrt is the square root fuction). Assume no overflows or underflows occur in this evaluation. Derive a bound for the relative error in v. This bound should be a numeric value.
Do Not Share this document
Page 3 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 2 [4 points] The following Matlab program
y = [ pi , 1e-8, 1e-100, 1e-155]; for i = 1:length(y)
x = y(i);
u = 1.0/x^3;
v = sin(x*x)^3;
A = 1.0/sqrt(v) – u;
fprintf(“i=% d, x = %g\n”,i, x);
fprintf(” A = %g\n”, A); end
outputs
i= 1, x = 3.14159
A = -0.0322515
i= 2, x = 1e-08 A=0
i= 3, x = 1e-100
A = Inf
i= 4, x = 1e-155
A = NaN
In the following, provide sufficient detail justifying your answer. (a) When i = 1, is the value of A accurate?
(b) Wheni=2,whyA=0?
(c) Wheni=3,whyA= Inf?
(d) Wheni=4,whyA=NaN?
Do Not Share this document
Page 4 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 3 [4 points] Given the three data points ( 1,1), (0,0), (1,1) write the polynomial interpolating them using
(a) monomial basis
(b) Lagrangian basis
(c) Newton basis
Show that the three representations give the same polynomial.
Do Not Share this document
Page 5 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 4 [3 points] Consider f(x) = (x 1)2ex = 0.
(a) Write Newton’s method when applied to this f .
(b) Show that when the initial condition is x0 ⇡ 1 Newton converges linearly. (c) What would the bisection method produce on the interval [ 1, 2]?
Do Not Share this document
Page 6 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 5 [4 points] A common problem in surveying is to determine the altitudes of a series of points with respect to some reference point. The measurements are subject to error, so more observations are taken than are necessary to determine the altitudes, and the resulting overdetermined system is solved in the least square sense to smooth out the error. Suppose that there are four points whose altitudes x1, x2, x3, x4 are to be determined. In addition to direct measurements of each xi, with respect to a reference point, measurements are taken of each point with respect to all of the others. The resulting measurements are:
x1 = 2.95
x3 = 1.45 x1 x2 = 1.23 x1 x4 = 1.61 x2 x4 = 0.45
x2 = 1.74
x4 = 1.32 x1 x3 = 4.45 x2 x3 = 3.21 x3 x4 = 2.75
(a) Describe how you would find the best values for the altitudes, that is values for x1,x2,x3, and x4. That is, describe the problem you need to solve?
(b) How would you measure how good your values are?
Do Not Share this document
Page 7 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 6 [4 points] If A and B are n ⇥ n matrices, with A nonsingular, and c is a vector with n elements, how would you efficiently compute the product A 1Bc? What is the complexity of your computation and why?
Do Not Share this document
Page 8 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 7 [5 points] Consider the following method for integrating y0 = f(t,y), y(t0) = y0: y i + 1 = y i + h2 [ f ( t i , y i ) + f ( t i + 1 , y i + 1 ] .
(a) (2 points) Show that this method is stable on y0 = 10y for any h > 0.
(b) (1 point) Consider y0 = t sin(y). Write the above formula when applied to this ODE.
(c) (2 points) To solve for yi+1 we need to apply Newton’s method. Write this method for solving for yi+1. That is, write the function f and its derivative f 0 in
xn+1=xn f(xn). f0(xn)
Do Not Share this document
Page 9 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 8 [5 points]
(a) (1points)ApproximateR12xln(x+2)dxusingSumpson’srule.
(b) (2 points) How many (equal) subintervals n are needed to approximate this integral with the composite
trapezoid rule such that the error in the approximation is 10 10.
(c) (2 points) After you have obtained your n, describe how you would verify that this n gives you an error
within 10 10.
Do Not Share this document
Page 10 of 11
CS/SE Eng 4X03
Do Not Share this document
Problem 9 [4 points] A planet follows an elliptical orbit, which can be represented in a Cartesian (x,y) coordinate system by the equation
ay2 +bxy+cx+dy+e = x2
Suppose you are given coordinates (xi,yi), i = 1,…,n.
Describe how you would compute the constants a,b,c,d,e in this equation. That is, setup a problem and explain how you can solve it.
Do Not Share this document
THE END. Page 11 of 11