Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Computer Science & Numerical Computation question. Python 3, JupyterNoteBook; fill the #your code here part. I will give thumb up, thank you! Please let me
Computer Science & Numerical Computation question. Python 3, JupyterNoteBook;
fill the #your code here part. I will give thumb up, thank you!
Please let me know if any information is missing.
Question and test case:
Tridiagonalization suppose we implement a sequence of transformations Oi Q. to introduce zeros in successive columns and rows. Then we'll have -... Q2Q 10010 Q 102 First, we note that the natural way to store O is as a list of reflector vectors . To check our results, we'd like to be able to make O as an explicit matrix. This function is a near copy of one in the Linear Algebra notebook. :def Qtimes_x(V, x): Apply orthogonal matrix Q represented as list of Householder reflectors yx.copy for v in reversed(V): --1en(v) y[-= 2 * v * (v @ y[:1) return y def Q as_explicit(V): Q = np.eye(m) for i, col in enumerate(Q.T) return I: def symtridiagonalize(A): "Reduce the symmetric matrix A to tridiagonal form using orthogonal transformation QATA Q B = A.copy() nlen (B) for i in range(n - 2): v = B[14:,].copy( ) # Turn v into a normalized vector representing # the reflection 1-2 v v^T # YOUR CODE HERE raise NotImplementedError() V.append(v) return B, Q_as_explicit(V) Ahat, Q symtridiagonalize(A) print(Ahat) # symmetric and tridiagonal print('Error:', np.linalg.norm(Q.Te A Q Ahat)) [ ] : Ahat, Q = symtridiagonalize(A) np.allclose(A, Q Ahat @ Q.T) Tridiagonalization suppose we implement a sequence of transformations Oi Q. to introduce zeros in successive columns and rows. Then we'll have -... Q2Q 10010 Q 102 First, we note that the natural way to store O is as a list of reflector vectors . To check our results, we'd like to be able to make O as an explicit matrix. This function is a near copy of one in the Linear Algebra notebook. :def Qtimes_x(V, x): Apply orthogonal matrix Q represented as list of Householder reflectors yx.copy for v in reversed(V): --1en(v) y[-= 2 * v * (v @ y[:1) return y def Q as_explicit(V): Q = np.eye(m) for i, col in enumerate(Q.T) return I: def symtridiagonalize(A): "Reduce the symmetric matrix A to tridiagonal form using orthogonal transformation QATA Q B = A.copy() nlen (B) for i in range(n - 2): v = B[14:,].copy( ) # Turn v into a normalized vector representing # the reflection 1-2 v v^T # YOUR CODE HERE raise NotImplementedError() V.append(v) return B, Q_as_explicit(V) Ahat, Q symtridiagonalize(A) print(Ahat) # symmetric and tridiagonal print('Error:', np.linalg.norm(Q.Te A Q Ahat)) [ ] : Ahat, Q = symtridiagonalize(A) np.allclose(A, Q Ahat @ Q.T)Step 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