HW #5, due Thursday April 23 (I may add more problems ...) ========================================================== Problem #1 ---------- We want to solve numerically the following boundary value problem: y"(x) - y(x) = 0, -1 < x <1 y(1) = 1 y(-1) = 1 Introduce n equispaced nodes such that x(0) = -1, x(n) = 1 At each node use approximation y"(x(k)) = ( y(x(k-1)) + y(x(k+1)) - 2*y(x(k)) ) /(h*h) where h is the discretisation step, h = (1 - (-1) )/(n-1). This gives n linear equations, including y(x(0)) = 1 and y(x(n)) = 1 . Re-write this in the form A*y = b. We will use the Jacobi iterations to solve this system. Here are the steps that need to be made: 1) Analyze the matrix that will be iterated during Jacobi iterations, and prove theoretically that the iterations will converge. 2) Solve the problem analytically (Hint: exp(x) and exp(-x) both solve the equation; find such a combination of these two functions that satisfies the boundary conditions). 3) For n = 11, 21, 41, 81, 161 solve the problem numerically, using Jacobi iterations. In each case stop the iterations when the next approximation differs from the previous by less than 1.e-8 in infinity norm. Compare your answer with the exact solution and fill the following three-column table: ---------------------------------------------------------------------------- n Number of iterations Max difference with the exact solution ---------------------------------------------------------------------------- 11 21 41 81 161