HW 2
HW 2
HW 2
Homework Assignment #2
Due Thursday February 24th 2011, in class
a0 + a1 x + a2 x2 + a3 x3 = 0
when the approximation at the k-th step is the value of the parameter
xk .
Turn in a printout of the function you created. Use the function you
constructed to approximate the solution to the equation x3 + x + 1 = 0
(the real solution is x ≈ −0.6823). Use x0 = 1 as your initial guess, and
apply 5 steps of the Newton procedure you generated (i.e. you will need to
call the function NewtonCubic 5 times). List the approximations that
your function created in those 5 iterations.
2. [20%] Adapt the function you created in the previous problem into a
MATLAB function called NewtonPoly which:
(a) Accepts the vector P and the real number xk as parameters.
(b) Returns the approximation at the (k+1)-th step (i.e xk+1 ) that would
be generated by Newton’s method for the polynomial equation
1
(a) [20%] Find a polynomial of degree 3 that interpolates through (x0 , y0 ),
. . . , (x3 , y3 ) using the Lagrange interpolation method.
(b) [20%] Find a polynomial of degree 3 that interpolates through (x0 , y0 ),
. . . , (x3 , y3 ) using the Newton interpolation method. Your result
should be the same as above.
(c) [20%] The 4 points given above were taken from the “real” function
f (x) = 2x . Using MATLAB draw f (x) on the same plot as the polyno-
mial interpolant you created, for x ∈ [−5, 4] (please turn in a printout
of the plot). What do you observe?