Difference between revisions of "Matrix Divide"

From APL Wiki
Jump to navigation Jump to search
m
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com")
 
Line 73: Line 73:
 
=== Documentation ===
 
=== Documentation ===
  
* [http://help.dyalog.com/latest/#Language/Primitive%20Functions/Matrix%20Divide.htm Dyalog]
+
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Matrix%20Divide.htm Dyalog]
 
* [http://microapl.com/apl_help/ch_020_020_280.htm APLX]
 
* [http://microapl.com/apl_help/ch_020_020_280.htm APLX]
 
* [http://wiki.nars2000.org/index.php/Matrix_Inverse/Divide NARS2000]
 
* [http://wiki.nars2000.org/index.php/Matrix_Inverse/Divide NARS2000]

Latest revision as of 14:40, 14 July 2020

Matrix Divide () is a dyadic function that performs matrix division between two arguments of rank 2 or less. Some dialects automatically apply it to rank-2 subarrays of higher-rank arguments. It shares the glyph Quad Divide (often called Domino) with the monadic function Matrix Inverse.

Examples

The result of XY is equal to (Y)+.×X, which is analogous to X÷Y being equal to (÷Y)×X. As a consequence, XY+.×XY is true for square matrices.

      X2 21 2 3 4
1 2
3 4
      Y2 25 6 7 8
5 6
7 8
      XY
 5  4
¯4 ¯3
      (Y)+.×X
 5  4
¯4 ¯3
      XY+.×XY
1

Applications

From the properties of Moore-Penrose inverse (which Matrix Inverse uses), Matrix Divide can not only be used to solve a system of linear equations, but also to find the linear least squares solution to an overdetermined system.

The following example solves the system of equations . The answer is .

      X2 21 2 2 ¯1
1  2
2 ¯1
      Y5 8
      YX
4.2 0.4

The following example solves the linear least squares over the five points . The answer is .

      X1,⍪⍳5
1 1
1 2
1 3
1 4
1 5
      Y5 1 4 2 8
      YX
1.9 0.7

When used with real vectors as both arguments, Y×XY gives the projection of X onto a basis vector Y. The remaining component of X, namely RX-Y×XY, is orthogonal to Y (R+.×Y is zero).

      (X Y)(2 7)(3 1)
      XY
1.3
      Y×XY  ⍝ Projection of X onto Y
3.9 1.3
      X-Y×XY  ⍝ The remaining component in X
¯1.9 5.7
      ⎕CT>|Y+.×X-Y×XY  ⍝ ∧ is orthogonal to Y (with negligible error)
1

External links

Lesson

Documentation


APL built-ins [edit]
Primitive functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-beamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Case convertUnicode convert
Operators SearchReplace