%. y (Matrix Inverse)
Inverts the matrix y.
y needs to be "non-singular", ie it actually has an exact inverse.
]P=: 0 0 1 , 1 0 0 ,: 0 1 0 NB. permutation matrix 0 0 1 1 0 0 0 1 0 %. P NB. The inverse of P is also a permutation matrix 0 1 0 0 0 1 1 0 0
Common uses
To reverse the effect of a linear transformation.
Given a rotation matrix, to form the matrix that rotates in the opposite direction.
sin=: 1&o.
cos=: 2&o.
angle=: (o.2) % 12 NB. 30 degrees, in radians
] R=: 2 2$ (cos,-@sin,sin,cos) angle NB. R: rotate by (angle)
0.866025 _0.5
0.5 0.866025
] S=: 2 2$ (cos,-@sin,sin,cos) -angle NB. S: rotate by (-angle)
0.866025 0.5
_0.5 0.866025
S -: %.R NB. S is the inverse of R
1
R -: %.S NB. R is the inverse of S
1
See Also
Vocabulary/dot (for matrix-product: +/ . *)
Vocabulary/dotco (for equivalence relation: -:)
Entry in the J Dictionary for %.
x %. y (Matrix Divide)
Solves for Q the matrix equation: P-: X mux R
Viz: X-: P %. R
mux is matrix-multiply, or the inner product of x and y.
sin=: 1&o.
cos=: 2&o.
mux=: +/ . * NB. matrix-multiply
angle=: (o.2) % 12 NB. 30 degrees
]R=: 2 2$ (cos,-@sin,sin,cos) angle NB. rotate by (angle=30 deg)
0.866025 _0.5
0.5 0.866025
angle=: (o.2) % 24 NB. 15 degrees
]Q=: 2 2$ (cos,-@sin,sin,cos) angle NB. rotate by (angle=15 deg)
0.965926 _0.258819
0.258819 0.965926
angle=: (o.2) % 8 NB. 45 degrees
]P=: 2 2$ (cos,-@sin,sin,cos) angle NB. rotate by (angle=45 deg)
0.707107 _0.707107
0.707107 0.707107
Q mux R NB. Rotate successively by 15 deg, then by 30 deg (total=45 deg)
0.707107 _0.707107
0.707107 0.707107
P -: Q mux R NB. Rotation by 45 degrees is the same even if done in 2 steps
1
(P %. R) -: Q NB. Matrix-divide both sides of the equation by R
1
Common uses
To solve a system of linear equations.
To calculate the current flows in a given electrical circuit network.
See Also
Vocabulary/dot (for matrix-product: +/ . *)
Vocabulary/dotco (for equivalence relation: -:)
Entry in the J Dictionary for %.
