Using SciPy linear algebra in Jupyter

There is a complete set of linear algebra functions available. For example, we can solve a linear system with steps such as the following:

import numpy as np
from scipy import linalg

A = np.array([[1, 1], [2, 3]])
print ("A array")
print (A)

b = np.array([[1], [2]])
print ("b array")
print (b)

solution = np.linalg.solve(A, b)
print ("solution ")
print (solution)

# validate results
print ("validation of solution (should be a 0 matrix)")
print (A.dot(solution) – b)

Here, the output under Jupyter looks like the following:

We validate the results with the final 0 matrix.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.59.187