File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,30 @@ GaussEliminate‼ ↚ ∧(
3737MDet ← ◌⍣GaussEliminate‼(⍥¯𝄐𝄐/≠)𝄐𝄐× ⊙0⊙1
3838
3939# Perform Gauss-Jordan elimination
40- Mgje ← ⍣GaussEliminate‼(|)(⍤"Elimination cannot be completed"0)
40+ Mgje ← +0⍥(
41+ ↻₁⍣(⍜⊙⊢÷⟜(-⊞×⊙⊸⊢⊂0÷)°⊂⊸≡⊏⊢)◌⊚≠0⊸⊢
42+ )⊸⧻ ⊏⍏⊸=0
43+ # Mgje ← ⍣GaussEliminate‼(|)(⍤"Elimination cannot be completed"0)
44+
4145# Matrix Inverse
4246MInv ← |1 ⌅(⍜⍉(↘÷2⊸⧻) ⍣Mgje(⍤"Matrix has no inverse"0) ˜≡⊂˙⊞=°⊏|MInv)
4347
4448┌─╴test
4549 ⍤⤙≍ 5 ⁅₃ MDet [1_¯3_¯1 1_¯1_¯2 1_0_0]
4650 ⍤⤙≍ [0_0_1 ¯0.4_0.2_0.2 0.2_¯0.6_0.4] ⁅₃ MInv [1_¯3_¯1 1_¯1_¯2 1_0_0]
4751 ⍤⤙≍ ˙⊞=⇡3 ⁅₃ Mgje [1_¯3_¯1 1_¯1_¯2 1_0_0]
52+
53+ Mgje [1_5_5
54+ 4_5_¯10]
55+ ⍤⤙≍ [1_0_¯5
56+ 0_1_2]
57+
58+ ⁅₉ Mgje [0_0_2_¯4_¯5
59+ 0_1_¯1_1_3
60+ 0_6_0_¯6_5]
61+ ⍤⤙≍ [0_1_0_¯1_0
62+ 0_0_1_¯2_0
63+ 0_0_0_0_1]
4864└─╴
4965
5066MSquarify ↚ ⍜△[.√⊢]
You can’t perform that action at this time.
0 commit comments