## 辅导案例-104B

• September 5, 2020

Math 104B Homework #5 ∗ Instructor: Xu Yang General Instructions: Please write your homework papers neatly. You need to turn in both your codes and descriptions on the appropriate runs you made by following TA’s instructions. Write your own code, individually. Do not copy codes! 1. (a) Implement the tridiagonal solver seen in class or lecture notes. (b) Test your implemen- tation. 2. Consider the boundary value problem: −u′′ + pi2u = 2pi2 sin(pix), 0 < x < 1, u(0) = u(1) = 0. (1) We can find a numerical approximation to the solution of this problem by employing the finite different method. Use a uniform grid with N − 1 interior nodes to obtain, by replacing the second derivative with a second order finite difference and neglecting the (truncation) error, the linear system −vj−1 + 2vj − vj+1 h2 + pi2vj = 2pi 2 sin(pixj), for j = 1, 2, · · · , N − 1, (2) where h = 1/N , vj is the approximation to u(xj) for j = 1, 2, · · · , N − 1, and v0 = vN = 0. (a) Use your tridiagonal solver to solve (3) for N = 50 and plot your corresponding solution. (b) The exact solution to the boundary value problem (1) is u(x) = sin(pix). Check this. (c) For N = 100, by how much would you expect the error to decrease? Verify your answer by comparing the error for N = 50 and N = 100. (d) In real applications we do not know the exact solution. Describe a process to check the convergence and rate of convergence of your approximation if you don’t know the exact solution. 3. Consider the linear system of the boundary value problem discussed in the last problem, i.e. −vj−1 + 2vj − vj+1 h2 + pi2vj = 2pi 2 sin(pixj), for j = 1, 2, · · · , N − 1, (3) where h = 1/N , vj is the approximation to u(xj) for j = 1, 2, · · · , N − 1, and v0 = vN = 0. ∗All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma- terials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of Prof. Hector D. Ceniceros. 1 (a) Implement Jacobi’s iteration method to find an approximation of the solution to (3) using a stopping criterium of ||b − Ax(k)|| < 0.1h, with h = 1/N . Do this for N = 50 and N = 100 and comment on the required number of iterations. (b) Repeat (a) for the Gauss-Seidal iteration. 2

• #### COST CALCULATOR

计算费用

###### MOST POPULAR

ezAce多年来为广大留学生提供定制写作、留学文书定制、语法润色以及网课代修等服务，超过200位指导老师为您提供24小时不间断地服务。