Question: Answer the following questions about this program: (a) What mathematical problem does this program solve? (b) What numerical method does this program use? (c) What
Answer the following questions about this program:

(a) What mathematical problem does this program solve?
(b) What numerical method does this program use?
(c) What is the initial condition used to start the numerical method?
(d) What is the criteria for convergence?
(e) What is the reason you might choose the value 0.8 in line 17?
(f) What is the significance of changing line 17 to: x(i)= x(i)+ (b(i)-s)/A(i,i);
(g) What happens if you change line 17 to: x(i)= x(i)+ 2.5*(b(i)-s)/A(i,i);
(h) If we forget to include line 13, the program does not work. Explain the problem with this bug.
(i) How would you modify the mathematical problem from part (a) (with the same initial guess) to ensure that this numerical method will converge? Explain the reason behind your answer. Your answer can be in words, and you do not need to rewrite the program.
1 function problem2_79 2 clc 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 n = 3; x = zeros (n,1); A = [3 10 -5; -4 1 2; 1 1 -4]; b = [-2; 1; 0]; R = norm (A*x-b); k = 0; fprintf('k \t err ') fprintf('%2d \t %6.4e ', k, R) while R 1e-7 for i=1:n s = 0; for j = 1:n end S = s + A (i, j) *x(j); end x(i) = x(i) + 0.8* (b(i)-s)/A (i, i); end R k = k + 1; fprintf('%2d \t 86.4e ', k, R) if k > 50 norm (A*x-b); fprintf('Did not converge. ') R = -1; 26 end 27 if R = -1
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
