Matrix Inverse/Divide: Difference between revisions

From NARS2000
Jump to navigationJump to search
(add toolbar footer)
No edit summary
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
'''Caution:''' Be careful not to confuse this symbol, which is <apll>⌹</apll>, with <apll>⍠</apll> which is [[Variant]].
<hr /><table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
   <td>
   <td>
Line 13: Line 14:
</tr>
</tr>
<tr>
<tr>
   <td><apll>R</apll> is a numeric scalar, vector or matrix; otherwise signal a <apll>RANK ERROR</apll>.  If <apll>R</apll> is a matrix, <apll>≥/⍴R</apll> must be true; otherwise signal a <apll>LENGTH ERROR</apll>.</td>
   <td><apll>R</apll> is a numeric scalar, vector or matrix; otherwise signal a <apll>RANK ERROR</apll>.</td>
</tr>
</tr>
<tr>
<tr>
Line 20: Line 21:
</table>
</table>
<br />
<br />
<p>This feature implements matrix inversion using [http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.html Singular Value Decomposition].  In particular, this means that any numeric array meeting the rank and shape requirements above is invertible.</p>
<p>This feature implements matrix inversion on '''Boolean''', '''integer''', or '''floating point''' arguments using [http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.html Singular Value Decomposition].  In particular, this means that any numeric array meeting the rank and shape requirements above is invertible.</p>
 
<p>Matrix inverse (<apll>⌹R</apll>) and matrix division (<apll>L⌹R</apll>) on '''Rational''', '''VFP''', or '''Ball''' arguments each have two limitations above and beyond that of normal conformability:</p>
    <ul>
      <li><p>for a '''square''' (<apll>=/⍴R</apll>) right argument that it be non-singular, and</p></li>
      <li><p>for an '''overdetermined''' (<apll>&gt;/⍴R</apll>) or '''underdetermined''' (<apll>&lt;/⍴R</apll>) right argument that the symmetric matrix <apll>(⍉R)+.×R</apll> be non-singular.</p></li>
    </ul>
    <p>These limitations are due to the algorithm ([http://en.wikipedia.org/wiki/Gauss%E2%80%93Jordan_elimination Gauss-Jordan Elimination]) used to implement Matrix Inverse/Divide on Rational and VFP numbers.</p>
 
<p>Overdetermined matrices are evaluated equivalently to the expression <apll>(⌹(⍉R)+.×R)+.×⍉R</apll>.</p>
<p>Underdetermined matrices are evaluated equivalently to the expression <apll>(⍉R)+.×⌹R+.×⍉R</apll>.</p>


<p>For example,</p>
<p>For example,</p>


<apll>
<apll><pre>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⌹3 3{rho}0<br />
      ⌹3 3{rho}0
&nbsp;0 0 0<br />
0 0 0
&nbsp;0 0 0<br />
0 0 0
&nbsp;0 0 0</apll><br />
0 0 0
<br />
      ⌹3 3⍴1 2 3 4
<br />
¯0.1944444444  0.2777777778  0.02777777778
0.05555555556 ¯0.2222222222  0.2777777778
0.3611111111  0.05555555556 ¯0.1944444444
      ⌹3 3⍴1 2 3 4<pn>x</pn>
¯7<pn>r</pn>36  5<pn>r</pn>18  1<pn>r</pn>36
1<pn>r</pn>18 ¯2<pn>r</pn>9  5<pn>r</pn>18
13<pn>r</pn>36  1<pn>r</pn>18 ¯7<pn>r</pn>36
</pre></apll>
 
<h2>Variations On Matrix Divide</h2>
 
<p>For variations on this function, see the [[Variant#Eigenvalues_and_Eigenvectors|Variant Operator]].</p>
 
 
 
 
 
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
Line 58: Line 85:
</table>
</table>
<br />
<br />
<p>This feature implements matrix division using [http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.html Singular Value Decomposition].  In particular, this means that any two numeric arrays meeting the rank and shape requirements above are divisible.</p>
<p>This feature implements matrix division on '''Boolean''', '''integer''' and '''floating point''' arguments using [http://www.gnu.org/software/gsl/manual/html_node/Singular-Value-Decomposition.html Singular Value Decomposition].  In particular, this means that any two numeric arrays meeting the rank and shape requirements above are divisible.</p>
 
<p>As noted above, Matrix Division on '''Rational''', '''VFP''', or '''Ball''' arguments uses a different algorithm and has slightly more restrictive conformability requirements.</p>
    <ul>
      <li><p>for a '''square''' (<apll>=/⍴R</apll>) right argument that it be non-singular, and</p></li>
      <li><p>for an '''overdetermined''' (<apll>&gt;/⍴R</apll>) or '''underdetermined''' (<apll>&lt;/⍴R</apll>) right argument that the symmetric matrix <apll>(⍉R)+.×R</apll> be non-singular.</p></li>
    </ul>
 
<p>Overdetermined matrices are evaluated equivalently to the expression <apll>(⌹(⍉R)+.×R)+.×(⍉R)+.×L</apll>.</p>
<p>Underdetermined matrices are evaluated equivalently to the expression <apll>(⍉R)+.×⌹R+.×(⍉R)+.×L</apll>.</p>


<p>For example,</p>
<p>For example,</p>


<apll>
<apll><pre>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a←3 3⍴0<br />
      a←3 3⍴0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a⌹a<br />
      a⌹a
&nbsp;0 0 0<br />
0 0 0
&nbsp;0 0 0<br />
0 0 0
&nbsp;0 0 0</apll>
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 4<pn>x</pn>
4<pn>r</pn>9 4<pn>r</pn>9 ¯1<pn>r</pn>9</pre></apll>
 
<hr width=35%><br>
 
<big>For several more everyday problem-solving examples using Matrix Inverse see also '''[[Symbol_Domino|Domino Symbol ⌹]]'''.</big>


<br><hr width=35%>


{{Language Toolbar}}
{{Article footer|2|Matrix}}

Latest revision as of 09:58, 8 October 2023

Caution: Be careful not to confuse this symbol, which is , with which is Variant.


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


This feature implements matrix inversion on Boolean, 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, VFP, or Ball arguments each have two limitations above and beyond that of normal conformability:

  • for a square (=/⍴R) right argument that it be non-singular, and

  • for an overdetermined (>/⍴R) or underdetermined (</⍴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.

Overdetermined matrices are evaluated equivalently to the expression (⌹(⍉R)+.×R)+.×⍉R.

Underdetermined matrices are evaluated equivalently to the expression (⍉R)+.×⌹R+.×⍉R.

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

Variations On Matrix Divide

For variations on this function, see the Variant Operator.



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 Boolean, integer 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, VFP, or Ball arguments uses a different algorithm and has slightly more restrictive conformability requirements.

  • for a square (=/⍴R) right argument that it be non-singular, and

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

Overdetermined matrices are evaluated equivalently to the expression (⌹(⍉R)+.×R)+.×(⍉R)+.×L.

Underdetermined matrices are evaluated equivalently to the expression (⍉R)+.×⌹R+.×(⍉R)+.×L.

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 ⌹.




See Also
System Commands System Variables and Functions Operators


Keyboard
Alt+Shift
Alt ¨ ¯ < > × ÷
Shift ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
Alt+Shift
Alt ? § π
Shift Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
Alt+Shift
Alt
Shift A S D F G H J K L : "
Key a s d f g h j k l ; '
Alt+Shift χ
Alt
Shift Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
< = >
~ § π .. ,
/ \ ¨ .
_ ¯
Second Row i j k i j k l g p r v x