Skip to content

Commit

Permalink
Create example.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mhjensen committed Feb 17, 2024
1 parent dace3c4 commit 3854f12
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/src/week6/programs/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import numpy as np

# Solution by brute force inversion
A = np.array([[2,1],[1,20]])
b = np.array([5,3])
invA = np.linalg.inv(A)
x = invA @ b
print(x)
print(np.linalg.eig(A))
# Solution with iterative methods

# Solution with gradient descent and fixed learning rate

0 comments on commit 3854f12

Please sign in to comment.