Question: Numpy and Python . Create a 1000x1000 matrix A with random numbers and a random number vector b with 1000 elements. Solve the simultaneous equation
Numpy and Python. Create a 1000x1000 matrix A with random numbers and a random number vector b with 1000 elements. Solve the simultaneous equation Ax = b in the following ways:
i) By using the inverse of A, i.e. A-1, with numpy.linalg.inv and then solving for Ax = b.
ii) By using numpy.linalg.solve
Find the estimation error in the solution, ||Ax - b||. It should be very close to zero.
Use @timeit to find how long it takes to use i and ii.
What difference is the between the results? Why is there a difference?
Start with the following code:
A = np.random.rand(1000,1000)
b = np. random.rand(1000)
*enter rest of code here*
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
