Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide results screen capture and python codes, Thanks Q1) In this question, you will use the Gauss-Seidel method to solve systems of linear equations.

image text in transcribed

image text in transcribed

Please provide results screen capture and python codes, Thanks

Q1) In this question, you will use the Gauss-Seidel method to solve systems of linear equations. The Python code for the Gauss-Seidel iterations is provided to you at the end of this question. Some information about the Python code: a) Recall that Xx is the vector generated by the Gauss-Seidel iterations. b) The Python code performs 20 iterations of the Gauss-Seidel method. After 20 iterations, the code prints the value of xx. C) The Python code has the vector d. The kth component of vector "d" is the largest element of X: Xx-1). That is, dk = max max Xx - XX-11. d) The Python code has the vector "Itr that contains the index of iterations. e) You need to enter the entries of matrix A and vector of the Gauss-Seidel method into the Python code. The Python code will not find the right answer if you entry the entries of A and b (instead of A and b). f) You need to enter the entries of initial vector X, into the Python code. 1. Consider the following system of linear equations. Find the matrix A and the vector 5 which are used in the Gauss-Seidel iterations. Include the steps in your report. (3 marks) 5 3 1 4 1 x (1) 1 1 3 3 2. Check if matrix A in the system of linear equations above is diagonally dominant? Include the steps in your report. (3 mark) 3. Enter A and B (from Part 1) and Xo = [2,2, 2] into the Python code. Run the code to solve the system of linear equations. Include the output of the code in your report. (1 mark) 4. Plot the vector d versus "Itr. Include the plot in your report. (1 mark) 5. In your plot from Part 4, what will happen as the number of iterations increases? (2 marks) 6. Consider the following system of linear equations. Find the matrix A and the vector 5 which are used in the Gauss-Seidel iterations. Include the steps answer in your report. (3 marks) 5 10 4 1 4 1 = (2) 1 1 3 6 7. Check if matrix A of the system of linear equations in (2) is diagonally dominant? Include the steps in your report. (3 mark) 8. Run the code with A and B from Part 6 and Xo = [2, 2, 2]. Include the output of the code in your report. (1 mark) 9. Plot the vector d versus Itr for Part 8. Include the plot in your report. (1 mark) 10. Does the Gauss-Seidel method find the solution of system of linear equations in (2)? If not, why? (2 marks) Hint: Check if the output of the code in Step 8 satisfies (2). Hint: Check if the matrix A in (2) is diagonally dominant. Python code of the Gauss-Seidel method: import numpy as np import matplotlib.pyplot as plt import math At np.array matrix A [[0,0,0], [0,0,0], [0,0,0]]) bt= np.array( [[O], [0].[0]]) vector 6 X0= np.array( [[0].[0].[0]]) Iteration=20 S=C3.Iteration) Initial vector x X = np.array(np.zeros(s)) d= np.zeros(Iteration) X[:30]= np.transpose(bt-np.matmul(At.XO)) d[0]= np.amax(np.abs(np.reshape(X[30].3.1))-X0)) for i in range(1,Iteration): X[:1)= np.transposebt-np.matmul(At, np.reshape(X[:1-1],3,1)))) Maximum of the d[i]= np.amax(np.abs(X[...]-X[:1-1])) difference vector print("The solution is", X[:1]) Itr= np.linspace(1, Iteration. Iteration) Number of iterations

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago