We show here how to read a square matrix
A from a file
A.txt and a vector
b from a file
b.txt and print the solution
x to the equation
Ax = b.
Here are the new features of the code:
numpypackage contains a
linalgsubpackage. It is automatically loaded with
numpy, and it can be accessed with
np.linalg. But with this command we can access it with
LAinstead and save typing.
np.linalg. Here we access them with
solvemember of the subpackage that we use here takes a matrix and a vector and solves the linear system.
Try running the code to see the result.