Department of Mathematical Sciences Examination paper for TMA4 Matematikk 4N: SOLUTION Academic contact during examination: Morten Nome Phone: 9 84 97 8 Examination date: December 7 Examination time (from to): 9: : Permitted examination support material: Kode C: Bestemt, enkel kalkulator Rottmann: Matematisk formelsamling Other information: All answers have to be justified, and they should include enough details in order to see how they have been obtained. All sub-problems carry the same weight for grading. Good Luck! Language: English Number of pages: 9 Number of pages enclosed: Checked by: Informasjon om trykking av eksamensoppgave Originalen er: -sidig -sidig sort/hvit farger skal ha flervalgskjema Date Signature
TMA4 Matematikk 4N, December 7 Page of 9 Problem Let f(x) be defined as f(x) = π 4 x, where < x < π. a) Find the Fourier cosine series of f(x). b) Use the result to compute the value of the series n= (n + ). Solution: a) The series is of the form with and a n = π π a = π a + a n cos nx, n= π Thus the Fourier cosine series is given by ( π 4 x ) dx =, ( π 4 x ) { if n is even cos nx dx = if n is odd. π n= π n cos(n + )x. (n + ) b) Taking x =, considering the even expansion f(x) of f(x), we have π 4 = ( lim x + f(x) + lim x f(x) ) = π n= (n + ). Therefore, Problem n= (n + ) = π 8. Solve the integral equation f(x t)e t dt = e x using Fourier transforms. (Hint: You may need the formula for the Fourier transform of derivatives.)
Page of 9 TMA4 Matematikk 4N, December 7 Solution: The equation is given by a convolution: f(x) e x = e x. Applying the Fourier transform on both sides, and the formulas given in the tables, we have πf(f)f(e x ) = F(e x ) Thus, F(f) = π e ω / π ω + = ( ω e ω / ) + ( e ω / ). Using the tables and the property of derivatives, we have that, applying the inverse Fourier transform on both sides, f(x) = / (e x ) + / e x = (x )e x / + ( ) / e x = x + e x /. Problem Consider the ordinary differential equation y y + y = r, y() =, y () = A () where r = r(t) is a given function and A is a constant. a) Solve this equation using the Laplace transform in the case r(t) =. b) Determine the solution in the case when r(t) = e t. c) Rewrite the equation () for an arbitrary r = r(t) as a first-order system of the form Z (t) = F (t, Z) where F (t, Z) is a vector-valued function and Z(t) is the unknown vectorvalued function to be determined. d) Write down the classical Runge Kutta method for this system of equations. e) Compute the approximate solution y(.) using h =. in the case r(t) = and A =. Keep 6 digits in the computations.
TMA4 Matematikk 4N, December 7 Page of 9 Solution: a) Introduce the Laplace transform Y (s) = L(y)(s) = y(t)e st dt. Then we find which yields (s Y (s) sy() y ()) (sy (s) y()) + Y (s) =, Thus ( ) s + A Y (s) = s + A = (s )(s ) (s )(s ) = s + (A )( s ). s y(t) = e t + (A )(e t e t ) = (A )e t (A )e t. b) As before we get, with R(s) = /(s ), that Y (s) = s + (A )( s = s + A( s s ) + R(s) ( s ) (s ) s ) s which yields y = ( A)e t + Ae t te t. c) Introduce where z = y(t), z = y (t). Thus, Z(t) = ( ) z (t) z (t) ( ) Z z (t) = F (t, Z) =. z + z + r(t) d) The Runge Kutta method for first-order systems of ordinary differential equations reads Z n+ = Z n + 6( K + K + K + K 4 ), Z = Z()
Page 4 of 9 TMA4 Matematikk 4N, December 7 where K = hf (t n, Z n ), K = hf (t n + h, Z n + K ), K = hf (t n + h, Z n + K ), K 4 = hf (t n + h, Z n + K ). Here t n = nh and < h is the discretization parameter. e) [We write all vectors as row vectors.] We choose h =., n = and Z = (, ), and compute with F (Z) = (z, z + z ) that K = hf (Z ) = (, h), K = hf (Z + K /) = hf ( h, h) = (h, h + h ), K = hf (Z + K /) = hf ( h /, h h /) = (h + h /, h + h + 7h /), K 4 = hf (Z + K ) = hf ( (h + h /), (h + h + 7h /)) = (h + h + 7h 4 /, h + 6h + 7h + 5h 4 /) which yields y(.) z, = 6 ( + h + (h + h /) + (h + h + 7h 4 /) ) = 6( 6h + 6h + 7h 4 / ) =.98897, where Z n = (z n,, z n, ). [The exact solution is y(.) = e. + e. =.98899.] Problem 4 Consider the equation e x x =. a) Show that this equation has a unique solution in the interval (, ). b) Compute iterations of Newton s method to approximate the solution, starting with x =. c) Write the equation as an equation of the form g(x) = x so that the fixedpoint iteration method converges, and compute iterations, starting with x =. Keep 5 digits in your computations.
TMA4 Matematikk 4N, December 7 Page 5 of 9 Solution: a) Let f(x) = e x x. We have f() = and f() = e <. Thus, by the intermediate value theorem, there is at least one zero. Now, f (x) = e x, which is < on the interval (, ). The function f(x) is therefore decreasing, and the zero is unique. b) Newton s method is of the form Thus, x n+ = x n f(x n) f (x n ) = x n e x n e xn. xn x = x e x x = e e x e.797, x =.797 e.797.797 e.858,.797 x =.858 e.858.858 e.858.857. c) We write the equation as x = e x/. Then the fixed-point iteration methods converges since g (x) = ex/ < on (, ). Then the fixed-point iteration gives x n+ = g(x n ), so Problem 5 x = g(x ) = e / =.956 x = g(x ) =.59 x = g(x ) =.7. Consider the function f(x) = ln(x). a) Compute the Chebyshev points, with n =, in the interval [, ]. b) Using Lagrange interpolation, find the polynomial of smallest degree that interpolates the function at the Chebyshev points found in a). Keep 5 digits in the computations.
Page 6 of 9 TMA4 Matematikk 4N, December 7 Solution: a) The three Chebychev points on the interval [, ] are given by ( ) k + y k = cos π, k. 6 This gives y =.866, y =, y =.866. Thus, the corresponding points, in increasing order, in the interval [, ] are x =.4, x =, x =.866. b) The function has corresponding values at those points: f =., f =, f =.68. Thus, the Lagrange polynomial is given by p (x) = k= l k (x) l k (x k ) f k = (.(x )(x.866) +.68(x.4)(x ))..5 Problem 6 Consider the system of equations 4x x + x = x + 4x = 8 x + 4x x = 4 a) Rearrange this system of equations so that you can apply Jacobi s method and such that it converges. b) Perform iterations of the Jacobi s method, starting with x = (,, ), using 5 digits in the computations. Solution: a) If we rewrite the system as x 4 x + x = 5 4 x + x 4 x = 4 x + x = 7 then the matrix associated to the system is strictly diagonally dominant. Thus the method converges. We can also apply Jacobi s method, since the diagonal
TMA4 Matematikk 4N, December 7 Page 7 of 9 elements are. One could also compute a norm of the matrix A associated to the system (with diagonal elements = ). b) The matrix A associated to the system of equations is 4 4 4 4 The first iteration of Jacobi method is 5 x () = b + (I A)x () = 7 + 4 4 4 4 = 4.75 9.5 7.5. The second is given by x () = b + (I A)x () = 5 7 + 4 4 4 4 4.75 9.5 7.5 = 7 4.65. Problem 7 Let u(x, t) be the temperature at time t in a laterally insulated bar of length lying on the x-axis. It satisfies the heat equation with initial condition and boundary conditions u t = u, x, t, x u(x, ) = sin ( ) πx u(, t) = u(, t) =, t. a) Find the solutions that are of the form u(x, t) = F (x)g(t) and that satisfy the boundary conditions. b) Find the solution that satisfies the initial condition. Evaluate u(,.5). c) Use Crank Nicolson method with k =.5 and h = to approximate the value of u(,.5). Keep 5 digits in the computations.
Page 8 of 9 TMA4 Matematikk 4N, December 7 Solution: a) We plug u(x, t) = F (x)g(t) into the heat equation and obtain two ODEs F kf = Ġ kg =. We split into three cases k =, k > and k <. The only non-trivial solution is for k = p <. The first equation then have solution F (x) = A cos px + B sin px. From the boundary conditions, we get F () = and F () =, so A = and sin p =, hence p = nπ, n =,,... We can set B =. We now solve the second equation. It has a solution of the form G n (t) = B n e (nπ/)t. The solutions of the form F (x)g(t) are thus given by u n (x, t) = B n sin nπx e (nπ/)t. b) To find a solution that satisfies the initial condition, we need to sum over those functions. We have u(x, t) = B n sin nπx e (nπ/)t. We thus have u(x, ) = n= n= B n sin nπx = sin ( ) πx. This is a Fourier sine series. The coefficient B n is therefore given by B n = for n, B =. Thus, Therefore, u(x, t) = sin ( ) πx e (π/)t. ( ) π u(,.5) = sin e (π/).5.. c) Crank-Nicolson method of difference equations is given by ( + r)u i,j+ r(u i+,j+ + u i,j+ ) = ( r)u ij + (u i+,j + u i,j ).
TMA4 Matematikk 4N, December 7 Page 9 of 9 where r = k/h = /. Thus, u i,j+ (u i+,j+ + u i,j+ ) = u ij + (u i+,j + u i,j ) We want to approximate u. We get, using the fact that u = u =.7, a system of equations Solving this system we get u u =.598 u u =.598 u =.9, u =.9. Thus, u(,.5).9.