Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab, Please do part B. State If SOR or Gauss_Seidel is faster. Consider the differential equation du(x) dr2 = f(-). [0, ), f(x) = sin(x),
Matlab, Please do part B. State If SOR or Gauss_Seidel is faster.
Consider the differential equation du(x) dr2 = f(-). [0, ), f(x) = sin(x), u(0) = u(T) = 0. (1) We develop a numerical method for solving this problem by using finite differ- ence approximations. First we discretize the region [0, 1] by dividing it into n+1 parts of equal length h=/(n+1). The points r; = 0+ih for i = 0,1,...,n+1 are equally spaced point from To = 0 to Pn+1 = . Let u; := u(?:) and fi:= f(?;). The finite difference approximation for the differential equation is : 11-1 - 2u: + 4+1 for i=1,2..... (2) h2 Since uo = u(0) = 0 and 1+1 = (7) = 0 we need not solve the differential equation at to and In+1 but need to simply use the boundary values of u(I) given to us. Now the differential equation along with its boundary conditions reduces to at i = 0 -24 + u2 fi at i=1 h2 U=0 U1 - 2u2 + 23 = 12 h2 at i = 2 U1-1 -24, + Ui+1 h2 f at i (3) Un-2--2un-1 + 2 h2 fiat i = n-1 2u Un-1- h2 at i=n Un+1 = 0 at i = n+1 This can be re-written as the linear system -2 1 0. 0 1 -2 1 0 0 111 112 fi f2 =h2 (4) 0 1 0 --2 1 1 -2 fn . = Now if we define u = (U1...., Un]'. f = h[fi..... fn]and the n x n matrix above to be A the above system of equations is written as Au = f. The Jacobi method for this problem can be written as: u(k+1) = D-'(L+U)u()+D-' (5) a) Implement the power method for computing the largest eigenvalue of T, where T, is the matrix of Jacobi method. Plot the errors of the Jacobi method (the error is measured by the la norm of the residual) against the iteration steps with the initial guess Xo = [1,1..... 1]' and the tolerance 10-7. (Note: The eigenvalues of course depend on the size of the system 7. Furthermore, the number of iterations to achieve a specific error tolerance depends on the size of the system n. So repeat this problem for n = 5,10,20. Plot the largest eigenvalue against n.) b) Repeat part(a) for the Gauss-Seidel and SOR methods. c) Comment on which method converges faster. How does this depend on nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started