Question
Complete the functions import numpy as np from numpy.testing import assert_allclose np.set_printoptions(precision = 4) def p2(): ''' 2a) Implement the matrix iteation scheme for computing
"Complete the functions"
import numpy as np
from numpy.testing import assert_allclose
np.set_printoptions(precision = 4)
def p2():
'''
2a) Implement the matrix iteation scheme for computing the "dominant" eigenvalue/eigenvector (associated with the eigenvalue with largest magnitude) of a square matrix.
Here is one verion of a simple pseudo-code (that needs termination conditions)
Choose an initial vector u0 such that u0 = 1
for k = 1, 2, . . . do
v^{(k)} = A u^{(k1)}
u^{(k)} = v^{(k)}/v^{(k)}
end
'''
'''
2b) Implement the "inverse matrix iteration" scheme for computing the "recessive" eigenvalue/eigenvector pair (associated with the eigenvalue with smallest magnitude) of a square matrix.
Here is a simple pseudo-code (again missing termination conditions)
Choose an initial vector u0 such that u0 = 1
for k = 1, 2, . . . do
Solve A v^{(k)} = u^{(k1)}
u^{(k)} = v^{(k)}/v^{(k)}
end
Use `numply.linalg.solve` in your implementation.
'''
'''
2c) Use the functions you implemented in parts a and b to create a function that computes an estimate of the condition number of a square matrix.
'''
pass
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