Skip to content

Commit 9622fc7

Browse files
Add files via upload
1 parent a4d610a commit 9622fc7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

QuickCramers.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#For A[] * x[] = B[] with Delta: ∆j equals det(Bj) where column J is
2+
# replaced by B to solve for 3 unknown variables
3+
import numpy as np
4+
5+
Delta = np.array([[20, 30, 15],
6+
[17, 45, 66],
7+
[17, 28, 59]])
8+
9+
Delta1 = np.array([[21, 30, 15],
10+
[22, 45, 66],
11+
[23, 28, 59]])
12+
13+
Delta2 = np.array([[20, 21, 15],
14+
[17, 22, 66],
15+
[17, 23, 59]])
16+
17+
Delta3 = np.array([[20, 30, 21],
18+
[17, 45, 22],
19+
[17, 28, 23]])
20+
21+
#Final prints contain the round function, set to 2 and the np.linalg.det() function for determinants
22+
#The resulting divison gives each unknown individually
23+
print('\nUnknown 1: [', round((np.linalg.det(Delta1) / np.linalg.det(Delta)), 2), ']')
24+
print('\nUnknown 2: [', round((np.linalg.det(Delta2) / np.linalg.det(Delta)), 2), ']')
25+
print('\nUnknown 3: [', round((np.linalg.det(Delta3) / np.linalg.det(Delta)), 2), ']')

0 commit comments

Comments
 (0)