matrix/README.md

139 lines
3.2 KiB
Markdown
Raw Normal View History

2023-01-15 21:00:04 -05:00
current version's usage example (only the first line is user-input):
```
2023-05-11 10:39:15 -04:00
User input: [[3 1 1 2] [1 -2 1 4] [-1 1 0 4]]
┏ ┓
┃ 3 1 1 │ 2 ┃
┃ 1 -2 1 │ 4 ┃
┃ -1 1 0 │ 4 ┃
┗ ┛
1/3R₀
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 1 -2 1 │ 4 ┃
┃ -1 1 0 │ 4 ┃
┗ ┛
-1R₀ + R₁
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 0 -7/3 2/3 │ 10/3 ┃
┃ -1 1 0 │ 4 ┃
┗ ┛
R₀ + R₂
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 0 -7/3 2/3 │ 10/3 ┃
┃ 0 4/3 1/3 │ 14/3 ┃
┗ ┛
-3/7R₁
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 0 1 -2/7 │ -10/7 ┃
┃ 0 4/3 1/3 │ 14/3 ┃
┗ ┛
-4/3R₁ + R₂
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 0 1 -2/7 │ -10/7 ┃
┃ 0 0 5/7 │ 46/7 ┃
┗ ┛
7/5R₂
┏ ┓
┃ 1 1/3 1/3 │ 2/3 ┃
┃ 0 1 -2/7 │ -10/7 ┃
┃ 0 0 1 │ 46/5 ┃
┗ ┛
-1/3R₂ + R₀
┏ ┓
┃ 1 1/3 0 │ -12/5 ┃
┃ 0 1 -2/7 │ -10/7 ┃
┃ 0 0 1 │ 46/5 ┃
┗ ┛
2/7R₂ + R₁
┏ ┓
┃ 1 1/3 0 │ -12/5 ┃
┃ 0 1 0 │ 6/5 ┃
┃ 0 0 1 │ 46/5 ┃
┗ ┛
-1/3R₁ + R₀
┏ ┓
┃ 1 0 0 │ -14/5 ┃
┃ 0 1 0 │ 6/5 ┃
┃ 0 0 1 │ 46/5 ┃
┗ ┛
x = -14/5
y = 6/5
z = 46/5
2023-01-15 21:00:04 -05:00
```
OLD \*actual\* usage example:
```
matrix.core=> (matrix-repl [[1 1 -1 -5] [5 -1 1 -1] [-1 3 -2 1]] :yeah)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 5 -1 1 │ -1 ┃
┃ -1 3 -2 │ 1 ┃
┗ ┛
(add-mul 5 2 1)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 -9 │ 4 ┃
┃ -1 3 -2 │ 1 ┃
┗ ┛
(add 0 2)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 -9 │ 4 ┃
┃ 0 4 -3 │ -4 ┃
┗ ┛
(add-mul -4/14 1 2)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 -9 │ 4 ┃
┃ 0 0 -3/7 │ -36/7 ┃
┗ ┛
(mul 7 2)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 -9 │ 4 ┃
┃ 0 0 -3 │ -36 ┃
┗ ┛
(mul -1/3 2)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 -9 │ 4 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛
(add-mul 9 2 1)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 14 0 │ 112 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛
(mul 1/14 1)
┏ ┓
┃ 1 1 -1 │ -5 ┃
┃ 0 1 0 │ 8 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛
(add 2 0)
┏ ┓
┃ 1 1 0 │ 7 ┃
┃ 0 1 0 │ 8 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛
(add-mul -1 1 0)
┏ ┓
┃ 1 0 0 │ -1 ┃
┃ 0 1 0 │ 8 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛
print-equations
x = -1
y = 8
z = 12
┏ ┓
┃ 1 0 0 │ -1 ┃
┃ 0 1 0 │ 8 ┃
┃ 0 0 1 │ 12 ┃
┗ ┛