Domino: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
m (Paul Robinson moved page Symbol Domino to Domino: Page is of sufficient quality to be upgradwd to standalone sympbol name alone)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
<h1> {domino} &mdash; Matrix Inverse or Division &mdash; Keystroke ALT+SHIFT+=  &mdash; Character 9017</h1>
<h1> {domino} &mdash; Matrix Inverse or Division &mdash; Keystroke ALT+SHIFT+=  &mdash; Character 9017 or 0x2339</h1>
Note: The symbol is created by ALT+SHIFT+=; ALT+= will produce [[Symbol Divide|Divide]] <big>(<big>'''{divide}'''</big>)</big>
Note: The symbol is created by ALT+SHIFT+=; ALT+= will produce [[Symbol Divide|Divide]] <big>(<big>'''{divide}'''</big>)</big><br />
'''Caution:''' Be careful not to confuse this symbol, which is <apll>⌹</apll>, with <apll>⍠</apll> which is [[Variant]].


[[File:APLKB-Domino.png]]
[[File:APLKB-Domino.png]]
==Usage==
==Usage==
==Example==


See also '''[[Matrix_Inverse/Divide]]'''.


==Examples==
<big> {domino} Monadic Example - Matrix Inverse for a square matrix:
<pre>
      Z    ⍝Variable and matrix Z has 3 rows and 3 columns of numbers, as follows:
1 2 3
0 1 4
5 6 0
      ⌹Z  ⍝The mathmatical inverse of matrix Z (domino Z) is also a 3-row by 3-col numeric matrix, as follows:
¯24  18  5
20 ¯15 ¯4
¯5  4  1
</pre>
{domino} Dyadic Example - Matrix Division - Least Squares Curve Fitting - Multiple Regression using Non-Square Data Matrix:
<pre>
      ⍴Homes  ⍝Global variable Homes is a 23 row by 8 column matrix:
23 8
      Homes    ⍝The first row of variable/matrix Homes has nested column headers, with 22 data rows:
⍝Col#'s 1    2        3          4          5          6      7              8
Property SqFt #Bedrooms #FullBaths #HalfBaths YrsAgoBuilt  Price Predicted Price    ⍝Note: Predicted Price col(8) is not yet calculated!
A        2149        3          2          1          15 469.9                0
B        2410        4          3          1          13 523.5                0
C        2530        4          3          0          12 535                  0
D        2502        3          2          0          12 569.999              0
E        2600        5          2          1          17 588                  0
F        2586        4          3          1          6 589                  0
G        2836        3          2          1          12 599.9                0
H        3300        4          2          1          10 615                  0
I        3000        4          3          0          11 659                  0
J        2723        3          2          1          12 665                  0
K        2800        4          3          1          18 729                  0
L        3700        5          3          1          4 767                  0
M        3900        4          3          1          19 799.9                0
N        3840        6          4          1          6 945                  0
O        2185        3          2          0          12 515                  0
P        2600        4          3          0          12 579.5                0
Q        4220        5          3          1          18 645.9                0
R        2136        3          2          0          14 505                  0
S        2530        3          2          1          13 539.9                0
T        2724        3          2          0          12 634.9                0
U        2896        4          3          0          7 750                  0
V        3835        3          3          1          6 982.5                0


      ⍝Note just below that because the first row of Homes has column headers(text) - they must be dropped from ⌹'s least-squares data fit.
      RegrCoeffs←(1↓Homes[;7])⌹1,(1 0↓Homes[;2 3 4 5 6])  ⍝Calc regr. coeff's using Home Prices(col 7, dep var Y) vs. all indep vars(X's, cols 2-6)
      ⍴RegrCoeffs    ⍝Note '⌹1,' just above means add extra coeff. for Y-intercept; plus cols(2-6)=5 indep X-type vars; RegrCoeffs has 6 elements.
6
      RegrCoeffs
234.9773005 0.1495539775 ¯41.70990009 80.27420326 16.19671155 ¯7.019567895


{{Article footer}}
      Homes[1+⍳22;8]←(1,Homes[1+⍳22;2 3 4 5 6])+.×RegrCoeffs  ⍝Use inner product +.× to calc predicted prices for 22 data rows, place in col 8.
{{Symbol footer|2|D}}
 
      Homes          ⍝The following is what variable Homes looks like; with Predicted Prices calculated and inserted back into matrix Homes:
Property SqFt #Bedrooms #FullBaths #HalfBaths YrsAgoBuilt  Price Predicted Price
A        2149        3          2          1          15 469.9      502.6906976
B        2410        4          3          1          13 523.5      594.3277247
C        2530        4          3          0          12 535        603.0970583
D        2502        3          2          0          12 569.999    560.3452438
E        2600        5          2          1          17 588        472.6806055
F        2586        4          3          1          6 589        669.7862   
G        2836        3          2          1          12 599.9      626.4929838
H        3300        4          2          1          10 615        668.2152651
I        3000        4          3          0          11 659        680.4069957
J        2723        3          2          1          12 665        609.5933844
K        2800        4          3          1          18 729        617.5559364
L        3700        5          3          1          4 767        808.7185666
M        3900        4          3          1          19 799.9      775.0457438
N        3840        6          4          1          6 945        854.1812909
O        2185        3          2          0          12 515        512.9366329
P        2600        4          3          0          12 579.5      613.5658367
Q        4220        5          3          1          18 645.9      788.2126844
R        2136        3          2          0          14 505        491.5693522
S        2530        3          2          1          13 539.9      573.7098988
T        2724        3          2          0          12 634.9      593.5462268
U        2896        4          3          0          7 750        692.9316536
V        3835        3          3          1          6 982.5      898.289018
</pre>
</big>
 
{{Article footer|2|Domino}}
[[Category:Monadic operators]][[Category:Dyadic operators]]

Latest revision as of 16:50, 16 October 2019

⌹ — Matrix Inverse or Division — Keystroke ALT+SHIFT+= — Character 9017 or 0x2339

Note: The symbol is created by ALT+SHIFT+=; ALT+= will produce Divide (÷)
Caution: Be careful not to confuse this symbol, which is , with which is Variant.

APLKB-Domino.png

Usage

See also Matrix_Inverse/Divide.

Examples

⌹ Monadic Example - Matrix Inverse for a square matrix:

      Z     ⍝Variable and matrix Z has 3 rows and 3 columns of numbers, as follows:
1 2 3
0 1 4
5 6 0
      ⌹Z   ⍝The mathmatical inverse of matrix Z (domino Z) is also a 3-row by 3-col numeric matrix, as follows:
¯24  18  5
 20 ¯15 ¯4
 ¯5   4  1

⌹ Dyadic Example - Matrix Division - Least Squares Curve Fitting - Multiple Regression using Non-Square Data Matrix:

      ⍴Homes   ⍝Global variable Homes is a 23 row by 8 column matrix:
23 8
      Homes    ⍝The first row of variable/matrix Homes has nested column headers, with 22 data rows:
⍝Col#'s 1    2         3          4          5           6       7               8
 Property SqFt #Bedrooms #FullBaths #HalfBaths YrsAgoBuilt   Price Predicted Price    ⍝Note: Predicted Price col(8) is not yet calculated!
 A        2149         3          2          1          15 469.9                 0 
 B        2410         4          3          1          13 523.5                 0 
 C        2530         4          3          0          12 535                   0 
 D        2502         3          2          0          12 569.999               0 
 E        2600         5          2          1          17 588                   0 
 F        2586         4          3          1           6 589                   0 
 G        2836         3          2          1          12 599.9                 0 
 H        3300         4          2          1          10 615                   0 
 I        3000         4          3          0          11 659                   0 
 J        2723         3          2          1          12 665                   0 
 K        2800         4          3          1          18 729                   0 
 L        3700         5          3          1           4 767                   0 
 M        3900         4          3          1          19 799.9                 0 
 N        3840         6          4          1           6 945                   0 
 O        2185         3          2          0          12 515                   0 
 P        2600         4          3          0          12 579.5                 0 
 Q        4220         5          3          1          18 645.9                 0 
 R        2136         3          2          0          14 505                   0 
 S        2530         3          2          1          13 539.9                 0 
 T        2724         3          2          0          12 634.9                 0 
 U        2896         4          3          0           7 750                   0 
 V        3835         3          3          1           6 982.5                 0

      ⍝Note just below that because the first row of Homes has column headers(text) - they must be dropped from ⌹'s least-squares data fit.
      RegrCoeffs←(1↓Homes[;7])⌹1,(1 0↓Homes[;2 3 4 5 6])  ⍝Calc regr. coeff's using Home Prices(col 7, dep var Y) vs. all indep vars(X's, cols 2-6)
      ⍴RegrCoeffs     ⍝Note '⌹1,' just above means add extra coeff. for Y-intercept; plus cols(2-6)=5 indep X-type vars; RegrCoeffs has 6 elements.
6
      RegrCoeffs
234.9773005 0.1495539775 ¯41.70990009 80.27420326 16.19671155 ¯7.019567895

      Homes[1+⍳22;8]←(1,Homes[1+⍳22;2 3 4 5 6])+.×RegrCoeffs   ⍝Use inner product +.× to calc predicted prices for 22 data rows, place in col 8.

      Homes          ⍝The following is what variable Homes looks like; with Predicted Prices calculated and inserted back into matrix Homes:
 Property SqFt #Bedrooms #FullBaths #HalfBaths YrsAgoBuilt   Price Predicted Price 
 A        2149         3          2          1          15 469.9       502.6906976 
 B        2410         4          3          1          13 523.5       594.3277247 
 C        2530         4          3          0          12 535         603.0970583 
 D        2502         3          2          0          12 569.999     560.3452438 
 E        2600         5          2          1          17 588         472.6806055 
 F        2586         4          3          1           6 589         669.7862    
 G        2836         3          2          1          12 599.9       626.4929838 
 H        3300         4          2          1          10 615         668.2152651 
 I        3000         4          3          0          11 659         680.4069957 
 J        2723         3          2          1          12 665         609.5933844 
 K        2800         4          3          1          18 729         617.5559364 
 L        3700         5          3          1           4 767         808.7185666 
 M        3900         4          3          1          19 799.9       775.0457438 
 N        3840         6          4          1           6 945         854.1812909 
 O        2185         3          2          0          12 515         512.9366329 
 P        2600         4          3          0          12 579.5       613.5658367 
 Q        4220         5          3          1          18 645.9       788.2126844 
 R        2136         3          2          0          14 505         491.5693522 
 S        2530         3          2          1          13 539.9       573.7098988 
 T        2724         3          2          0          12 634.9       593.5462268 
 U        2896         4          3          0           7 750         692.9316536 
 V        3835         3          3          1           6 982.5       898.289018 


See Also
System Commands System Variables and Functions Operators


Keyboard
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? § π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S
Alt
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S χ
Alt
Sh 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