Professional Documents
Culture Documents
128ahw5sum10 PDF
128ahw5sum10 PDF
128ahw5sum10 PDF
BENJAMIN JOHNSON
0 f (x0 ) = f (x0 ) = 1
1 f (x0 ) = f (x1 ) f (x0 ) = 1.64872 1 = 0.64872.
2 f (x0 ) = (f (x2 ) f (x1 )) (f (x1 ) f (x0 )) = (2.71828 1.64872) 0.64872 = 0.42084.
3 f (x0 ) = (f (x3 )2f (x2 )+f (x1 ))0.42084 = 4.4816922.71828+1.648720.42084 =
0.27301.
Now we have:
P1 (0.43) = f (x0 ) + 1.72
1
f (x0 ) = 1 + 1.72 0.64872 = 2.1158.
P2 (0.43) = P1 (0.43) + 2 2 f (x0 ) = 2.1158 + 1.72(1.721)
1.72
21
0.42084 = 2.37638.
1.72
3 1.72(1.721)(1.722)
P3 (0.43) = P2 (0.43) + 3 f (x0 ) = 2.37638 + 3!
0.27301 = 2.3606.
9. a. Approximate f (0.05) using the following data and the Newton forward divided-difference
formula:
4
X 0.25
P4 (0.05) = 4 f (x0 )
k=0
k
0.25 0 0.25 1 0.25 2 0.25 3 0.25
= f (x0 ) + f (x0 ) + f (x0 ) + f (x0 ) + 4 f (x0 )
0 1 2 3 4
= 1 1 + 0.25 0.22140 + 0.09375 0.04902 + 0.0546875 0.01086 + 0.0375977 0.00238
= 1.05126
For this problem I computed both the choose functions and the k s using Mathemat-
ica. I have included the relevant session transcript below for reference. Even though
Mathematica isnt covered in this class, it may be useful to see what it can do easily. It
is a useful program for doing symbolic algebra, manipulating lists, and for employing a
variety of common mathematical functions without having to write too much code. Of
course for this problem you could also have written some MATLAB code to accomplish
more or less the same thing, or written out more steps by hand.
In[389]:= Binomial[0.25, 2]
Out[389]= -0.09375
In[390]:= Binomial[0.25, 3]
Out[390]= 0.0546875
In[391]:= Binomial[0.25, 4]
Out[391]= -0.0375977
Out[388]= {0.00238}
MATH 128A, SUMMER 2010, HOMEWORK 5 SOLUTION 3
16. For a function f , the Newton divided-difference formula gives the interpolating polynomial
16
P3 (x) = 1 + 4x + 4x(x 0.25) + x(x 0.25)(x 0.5),
3
on the nodes x0 = 0, x1 = 0.25, and x3 = 0.75. Find f (0.75).
solution: Since the interpolating polynomial agrees with f at the xi and we are asked to
find f (x3 ), it suffices to compute P3 (x3 ). We get
P3 (0.75) = 1 + 4(0.75) + 4 0.75 (0.75 0.25) + 16
3
0.75(0.75 0.25)(0.75 0.5) = 6.
section 3.3
2. Use Theorem 3.9 or Algorithm 3.3 to construct an approximating polynomial for the follow-
ing data.
x f (x) f 0 (x)
a. 0 1.00000 2.00000
0.5 2.71828 5.43656
solution: I will
P use Theorem 3.9. It says the Hermite P polynomial is given by the formula
H2n+1 (x) = nj=0 f (xj )[12(xxj )L0n,j (x)]L2n,j (x)+ nj=0 f 0 (xj )(xxj )L2n,j (x). In our
case n = 1 and there are only two points x0 = 0 and x1 = 0.5. The formula becomes
solution: Since there are only two points, there will only be one cubic function S0
in the cubic spline. This function must have the form S0 (x) = ax3 + bx2 + cx + d.
Our constraints are that S0 (0.25) = 1.33203, that S0 (0.25) = 0.800781, and that
S000 (0.25) = S000 (0.25) = 0. From these constraints we need to determine a, b, c and d.
We begin by considering the constraints on the second derivative. Starting with our
assumed form for S0 , we have S00 (x) = 3ax2 + 2bx + c. Then S000 (x) = 6ax + 2b. Since
this is a linear degree one equation, the only way it can be zero at two distinct points
x = 0.25 and x = 0.25 is if it is the zero equation, which gives a = b = 0.
We thus have that S0 is a linear function. The slope of this function is 0.8007811.33203
0.25(0.25)
=
1.0625, and so c = 1.0625. Now we can solve for d using (for example) c 0.25 + d =
0.800781, obtaining d = 1.06641.