The Magic Encyclopedia ™

Basic Rectangle Multiplication
(by Aale de Winkel)

recent discussion with <Gil Lamb> lead me to take a closer peak at my Basic Multiplication. Needing to compare a lot of squares I decided to try to generate names for the obtained squares based on the squares content. I thus figured out that basic multiplication is reversable. ie one can define a division and modulation operators.
The initial part presents the things on rectangles / squares, later to be generalised to the hypercube.

note: (x\r) denotes integer division (= floor(x/r)) and thus needs special concideration!

Rectangle Multiplication
For rectangles i use the notation pRq to stand for a p by q rectangle with the special case pNq
where alll numbers are in sequential order also I assume the multiplier is using the analitic number-range ie:
pNq[x,y] = x + py ; x = 0..p-1 ; y = 0..q-1 the p by q "normal" rectangle
abreviation Np = pNp the order p "normal" square
Basic Formula prTqs[x,y] = (pDq * rMs)[x,y] = rMs[x%r,y%s] + pDq[(x\r),(y\s)] rs ;
x = 0..pr-1 ; y = 0..qs
ie place a copy of M at each position of D augmented by that element
times the amount of numbers in M
divisor '/'
modulator '%'
prTqs = pDq * rMs ==> prTqs / rMs = pDq and prTqs % pDq = rMs
note due to the fact that rMs * pDq <> pDq * rMs the operators are complementry
one might call them 'left-' and 'right-' divisors (which might the the more regular names)
General formula
"Normal Rectangle Product"
Multiplication of normal rectangles can be put in one general formula
which allows to generate "Generating squares" more easily
(i=0n piNqi)[x,y] = i=0n k=0i pkqk {
([x % k=0i pk] \ k=0i-1 pk) + pn ([y % k=0i qk] \ k=0i-1 qk) };
i=0n pi = i=0n qi = m; x,y = 0..m-1
Examples up till 4 rectangles:
(pNq * rNs)[x,y] = (x%r) + r (y%s) + rs [(x\r) + p (y\s)]
(tNu * pNq * rNs)[x,y] = (x%r) + r (y%s) + rs [((x%pr)\r) + p ((y%qs)\s)] +
pqrs [(x\pr) + t (y\qs)]
(vNw * tNu * pNq * rNs)[x,y] = (x%r) + r (y%s) + rs [((x%pr)\r) + p ((y%qs)\s)] +
pqrs [((x%prt)\pr) + t ((y%qsu)\qs)] + pqrstu [(x\prt + v (y\qsu)]
Notable identities 1Np = pN1t (by definition)
1Nq * pN1 = pNq
pN1 * 1Nq = pNqt
pNqt * rNs = pN1 * rNps
pNq * rN1 = prNq
(1Nq * pN1)[x,y] = (x%q) + p(y%1) + p[(x\p) + 1(y\1)] = x + py = pNq[x,y]
(pN1 * 1Nq)[x,y] = (x%1) + 1(y%q) + q[(x\1) + p(y\q)] = y + qx =
qNp[y,x] = (pNq[x,y])t
also: pNqt = (1Nq * pN1)t = 1Nqt * pN1t = qN1 * 1Np = qNp

(pNqt * rNs)[x,y] = qNp[y,x] * rNs[x,y] = (x%r) + r (y%s) + rs [(y\r) + p (x\s)] =
(x%r) + prs (x\s) + r (y%s) + rs (y\r) = (x%r) + prs (x\s) + r (y%ps) =
(pN1 * rNps)[x,y]

(pNq * rN1)[x,y] = (x%r) + pr (x\r) + rpy =
(x%pr) + rpy = x + rpy = rpNq[x,y]

note: things needs verification before Q.E.D.!