Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
Tutorials
Project: Inverse Problems in Imaging
Views: 1388Kernel: Python 3 (Ubuntu Linux)
Linear Algebra
We can perform basic linear algebra using numpy
In [15]:
[3 2 0]
[2 2 0]
array([[2, 3, 1],
[2, 2, 0],
[2, 0, 1]])
Exercise
What happens when you define a new matrix using C = A
? Hint: try changing an element in the new matrix and inspect both C
and A
.
Matrix and vector norms
In [25]:
5.196152422706632
Special arrays
In [35]:
Exercise
Create a 10 x 10 matrix with ,
Eigenvalues and vectors
In [48]:
eigenvalues of A: [ 4.0861302 -0.51413693 1.42800673]
first eigenvector of A: [-0.5613869 -0.80731332 -0.18190642]
Exercise
Compute the eigenvalues and vectors of What is special about this matrix?
Sparse matrices
Large matrices that have few non-zero entries are more efficiently stored as sparse matrix:
In [60]:
In [59]:
<matplotlib.lines.Line2D at 0x7f512272fba8>
Exercise
Check what the command diags([1, -2, 1], [-1, 0, 1], shape=(4, 4))
produces
In [0]: