

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Math 128a - Homework 2 - Due Feb 14 at the beginning of class
Complete Question 4 from Homework 1, which was postponed due to delayed availability of computer accounts.
In this question we will write a program to explore the sensitivity of roots of polynomials to perturbations in their coefficients. From the class homepage, download the matlab program polyperturb.m. Polyperturb takes an input polynomial specified by its roots r, and then adds random perturbations to the polynomial coefficients, computes the perturbed roots, and plots them. The inputs are r = vector of roots of the polynomial e = maximum relative perturbation to make to each coefficient of the polynomial m = number of random polynomials to generate, whose roots are plotted
Try running this program on some of the inputs given below to help you understand what it does. Based on the analysis done in class, where we computed the first term of the Taylor expansion of how much the roots can change when the coefficients are perturbed, modify this program to draw circles around each root, with radii equal to how much we expect the roots to change. The program should also return the values of the radii in the variable ebnd. Ideally, the circles should contain all the perturbed roots, as long as the perturbation size e is not too large. Note that in class, we only worried about the sensitivity to roundoff; now you will use the same analysis to analyze the effect of a deliberate perturbation of size e, which is generally much larger than roundoff. You should turn in your program. Next, run your program for the following inputs. In all cases choose m high enough that you get a fairly dense plot, but don’t have to wait too long. m = a few hundred or perhaps 1000 is enough. You may want to change the axes of the plot if the graph is too small or too large. (“axis([xmin,xmax,ymin,ymax])” changes the limits of the axes to the 4 values shown. “axis(’square’)” makes the plotting window square, so that if xmax-xmin = ymax-ymin, circles appear as circles instead of ellipses, etc.)
Part 1: an = 1/ 22 n
Part 2: bn = n−n
∑n i=0 cix i, then there is a another polynomial ˆp(x) = ∑n i=0(ci^ +^ δci)x i (^) where
Hint: Use the Intermediate Value Theorem.
f (x) =
ln(1 + x)/x if x = 0 1 if x = 0
has all continuous derivatives for x > −1 Show that the obvious way to implement it in Matlab
function y = f1(x) if (x == 0) y = 1 else y = log(1+x)/x; endif
is not backward stable. Hint: try evaluating it very near to 0. Does f1(x) = f(x+dx) where |dx|/|x| is very small? Extra Credit (harder): show that the alternative below is backward stable. You may assume that the computed value of log(z) has very tiny relative error, near 2−^52.
function y = f2(x) z = 1+x; if (z == 1), y = 1; else y = log(z)/(z-1); end