18.085 PROBLEM SET 4 SOLUTIONS HAOFEI WEI Problem (2.2.5a). Solution. Substituting the given values of u01 , u02 , and u03 into d ||u(t)||2 = dt = = = d dt ||u(t)||2 , we get 2 (u1 u01 + u2 u02 + u3 u03 ) 2 (u1 (cu2 − bu3 ) + u2 (au3 − cu1 ) + u3 (bu1 − au2 )) 2 (cu1 u2 − cu1 u2 + bu1 u3 − bu1 u3 + au2 u3 − au2 u3 ) 0 Thus, ||u(t)||2 does not change with time, so ||u(t)||2 = ||u(0)||2 Problem (2.2.6). Solution. The trapezoidal rule for u0 = Au, given by (24), is ∆t ∆t A Un+1 = I + A Un I− 2 2 T + UnT (since they’re vectors), we get Multiplying both sides by Un+1 T Un+1 + UnT ∆t I− A Un+1 = 2 T Un+1 + UnT ∆t A Un I+ 2 ∆t (Un+1 + Un )T A (Un+1 + Un ) 2 ∆ t ||Un+1 ||2 − ||Un ||2 = (Un+1 + Un )T A(Un+1 + Un ) 2 The right hand side is a scalar, and thus is equal to its transpose. However, AT = −A, so we get (Un+1 + Un )AT (Un+1 + Un ) = −(Un+1 + Un )T A(Un+1 + Un ) = 0. Thus, ||Un+1 ||2 = ||Un ||2 , as needed. T Un+1 Un+1 + UnT Un+1 − UnT Un+1 − UnT Un = Problem (2.2.8). Solution. Using the Forwards Euler method, we get Un+1 = Un + hVn Vn+1 = Vn − hUn Thus, 1 HAOFEI WEI 18.085 PROBLEM SET 4 SOLUTIONS 2 2 Un+1 + Vn+1 = (Un + hVn )2 + (Vn − hUn )2 = Un2 + 2hVn Un + h2 Vn2 + Vn2 − 2hVn Un + h2 Un2 = (1 + h2 )(Un2 + Vn2 ) With the Backwards Euler method, Un+1 = Un + hVn+1 Vn+1 = Vn − hUn+1 To avoid crossing n + 1 and n terms of U and V , we can rewrite the backwards Euler method as Un = Un+1 − hVn+1 and Vn = Vn+1 + hUn+1 . This gives us Un2 + Vn2 = (Un+1 − hVn+1 )2 + (Vn+1 + hUn+1 )2 2 2 2 2 = Un+1 + h2 Vn+1 + Vn+1 + h2 Un+1 + 2hVn+1 Un+1 − 2hVn+1 Un+1 2 2 = (1 + h2 )(Un+1 + Vn+1 ) 1 2 2 2 2 = 1+h + Vn+1 Thus, Un+1 2 (Un + Vn ), as needed. Next, we will calculate (1+h2 )32 for h = 2π . A simple calculation with some calculator-like 32 device will yield the answer to be approximately 3.355 Next, we must take the limit of the expression as h goes to zero. 2π lim (1 + h2 ) h h→0 h h ii 2π = exp lim ln (1 + h2 ) h h→0 2π 2 = exp lim ln 1 + h h→0 h Using L’hospital’s rule, we can reduce this to " lim (1 + h2 ) h→0 2π h d dt ln (1 + h2 ) = exp lim d h→0 h dt 2h = exp lim h→0 1 + h2 = e0 = 1 # Problem (2.3.7). Solution. The coefficients û = (C, D) satisfies the equation C = AT b A A D 2 T HAOFEI WEI 1 1 where A = 1 1 18.085 PROBLEM SET 4 SOLUTIONS 0 1 and b is as defined. Performing the multiplication gives us 2 3 4 6 6 14 C 6 = D 4 To solve this equation, we can either invert the matrix on the left hand side and multiply on both sides, or simply use MatLab’s equation solving capabilities, specifically the “\” command. Doing either one of these things will give you the result of (C, D) = (3, −1). Problem (2.3.8). Solution. To find the projection p of b onto y = 3 − x, we simply multiply to get p = Aû = 3 2 . 1 0 It is simple to check that the points (0, 3), (1, 2), (2, 1), (3, 0) lie on the line y = 3 − x. 1 −1 Finally, we can verify through direct multiplication that AT e = AT (b − p) = AT −1 = 1 0. Problem (2.3.10). 1 1 Solution. Since we only have one variable C, we have A = 1. To find the solution, we 1 4 1 must solve the system AT AC = AT 0. The solution for this is easily found to be 4C = 6 1 3 3 or C = 2 . Thus, y = 2 is the horizontal line which best fits the system. Problem (2.3.12). 1 1 Solution. For a third order polynomial, we will have A = 1 1 3 0 1 2 3 0 1 . 4 9 HAOFEI WEI 18.085 PROBLEM SET 4 SOLUTIONS 4 C 1 Now, we must solve the equation AT A D = AT b, where b = 0. Using MatLab, we E 1 C 4 T T can solve D = A A\A b = −4. E 1 4 C 1 0 0 0 1 1 1 1 D 1 Fitting instead to a cubic, we will be solving the system 1 2 4 8 E = 0. This 1 F 1 3 9 27 system can be solved exactly, and gives 4 4 1 0 0 0 C D 1 1 1 1 1 −4 = E 1 2 4 8 \ 0 = 1 0 1 1 3 9 27 F The error in this result is 4 1 0 1 1 1 e = 0 − 1 2 1 1 3 4 4 1 1 = 0 − 0 1 1 = 0 4 0 0 1 1 −4 4 8 1 0 9 27 This is expected, as the solution we found is an exact solution of the system. 4