Texts: This is a problem that needs to be solved with Python code. Please teach me how to write the code needed for it and list the code separately. It would be best if you could attach the expected results. Thank you very much.
1. a. Discretize a continuous variable x into 5 points: To, 1, T2, T3, and 4. Explicitly write down the matrices A, B, and R = A^(-1)B. You should write down the matrices by hand without substituting any numerical value for w (Please notice the boundary of A and B, namely A[0,:] = [1,0,0,0,0] and for B is: B[4,:] = [0,0,0,0,-]).
1. b. Using w = 0.9, write a program to calculate the powers of R. Use Rmax to denote the element in R with the largest magnitude. In Python, it is np.max(np.abs(R)). Plot Rmax versus n for n from 0 to 10. You can use np.matmul() repeatedly to calculate powers of a matrix, do not use R**n. From the plot and the definition of the matrix R, comment on whether the Gauss-Seidel method is stable.