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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!