# Difference between revisions of "Matrix Inverse/Divide"

 Z←⌹R returns the inverse of the right argument.
R is a numeric scalar, vector or matrix; otherwise signal a RANK ERROR. If R is a matrix, ≥/⍴R must be true; otherwise signal a LENGTH ERROR.
Z is a numeric array of rank ⍴⍴R, and shape ⌽⍴R.

This feature implements matrix inversion on integer or floating point arguments using Singular Value Decomposition. In particular, this means that any numeric array meeting the rank and shape requirements above is invertible.

Matrix inverse (⌹R) and matrix division (L⌹R) on Rational or VFP arguments each have two limitations above and beyond that of normal conformability:

• for a square right argument that it be non-singular, and

• for an overdetermined (>/⍴R) right argument that the symmetric matrix (⍉R)+.×R be non-singular.

These limitations are due to the algorithm (Gauss-Jordan Elimination) used to implement Matrix Inverse/Divide on Rational and VFP numbers.

For example,

⌹3 3⍴0
0 0 0
0 0 0
0 0 0
⌹3 3⍴1 2 3 4
¯0.1944444444   0.2777777778   0.02777777778
0.05555555556 ¯0.2222222222   0.2777777778
0.3611111111   0.05555555556 ¯0.1944444444
⌹3 3⍴1 2 3 4x
¯7r36  5r18  1r36
1r18 ¯2r9   5r18
13r36  1r18 ¯7r36

 Z←L⌹R returns the quotient of the left and right arguments. This quotient can be interpreted in various ways, such as the least squares solution of the system of linear equations determined by arguments.
L is a numeric scalar, vector or matrix; otherwise signal a RANK ERROR.
R is a numeric scalar, vector or matrix; otherwise signal a RANK ERROR.
If either L or R is a scalar or vector, it is coerced to a matrix by (L R)←⍪¨L R. After this coercion, if the two matrices have a different number of rows, signal a LENGTH ERROR.
Z is a numeric array. Before the above coercion of L and R, the rank of Z is ¯2+2⌈(⍴⍴L)+⍴⍴R, and the shape is (1↓⍴R),1↓⍴L.

This feature implements matrix division on integers and floating point arguments using Singular Value Decomposition. In particular, this means that any two numeric arrays meeting the rank and shape requirements above are divisible.

As noted above, Matrix Division on Rational or VFP arguments uses a different algorithm and has slightly more restrictive conformability requirements.

For example,

a←3 3⍴0
a⌹a
0 0 0
0 0 0
0 0 0
1 2 3⌹3 3⍴1 2 3 4
0.4444444444 0.4444444444 ¯0.1111111111
1 2 3⌹3 3⍴1 2 3 4x
4r9 4r9 ¯1r9

For several more everyday problem-solving examples using Matrix Inverse see also Domino Symbol ⌹.

 NARS 2000 LangToolBar ← → + - × ÷ * ⍟ ⌹ ○ ! ? √ | ⌈ ⌊ ⊥ ⊤ ⊣ ⊢ ≡ ≢ < ≤ = ≥ > ≠ ∨ ∧ ⍱ ⍲ ↑ ↓ ⊂ ⊃ ⌷ ⍋ ⍒ ⍳ ∊ ⍸ ⍷ ∪ ∩ ⊆ ⊇ ~ § π .. , ⍪ ⍴ ⌽ ⊖ ⍉ / \ ⌿ ⍀ ⊙ ¨ ⍨ ⍤ ⍣ ⍡ ⍥ ⍦ ⍥ . ∘ ⍠ ‼ ⌻ ∂ ⍞ ⎕ ⍎ ⍕ ⋄ ⍝ ∇ ∆ ⍙ _ ⍺ ⍵ ¯ ⍬ ∞ ∅ Second Row i j k i j k l g p r v x