128ahw14sum10

# 128ahw14sum10 - MATH 128A SUMMER 2010 HOMEWORK 14 SOLUTION...

This preview shows pages 1–2. Sign up to view the full content.

MATH 128A, SUMMER 2010, HOMEWORK 14 SOLUTION BENJAMIN JOHNSON Homework 14: Due Wednesday, August 11 8.1; 5ab 8.2; 1d section 8.1 5. Given the data: x i 4 . 0 4 . 2 4 . 5 4 . 7 5 . 1 5 . 5 5 . 9 6 . 3 6 . 8 7 . 1 y i 102 . 56 113 . 18 130 . 11 142 . 05 167 . 53 195 . 14 224 . 87 256 . 73 299 . 50 326 . 72 a. Construct the least squares polynomial of degree 1, and compute the error. Solution: The two normal equations are: a 0 · m + a 1 · m i =1 x i = m X i =1 y i a 0 · m X i =1 x i + a 1 · m i =1 x 2 i = m X i =1 x i y i . We have m = 10, 10 i =1 x i = 54 . 1, 10 i =1 y i = 1958 . 39, 10 i =1 x 2 i = 303 . 39, and 10 i =1 x i y i = 11366 . 843. So it remains to solve the linear system: ± 10 54 . 1 1958 . 39 54 . 1 303 . 39 11366 . 843 ² using Gaussian elimination with backward substitution. Doing this in Octave using format long gives: a 0 = - 194 . 1382407320925 and a 1 = 72 . 0845176953960. (Oddly enough, using the Octave function “polyﬁt” gives an answer that diﬀers from the above in the last one or two decimal places. In any case, the two methods agree to several decimal places). The linear least squares approximation is P ( x ) = 72 . 084517695396 x + - 194 . 13824073209 . The error is given by the equation 10 i =1 ( y i - P ( x i )) 2 , which evaluates to 329.013193033898 b. Construct the least squares polynomial of degree 2, and compute the error. Solution:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

128ahw14sum10 - MATH 128A SUMMER 2010 HOMEWORK 14 SOLUTION...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online