Skip to main content

4. Multivariate: Base Multinumbers

To go beyond one variable, Wildberger introduces base multinumbers — a family of primitive elements, one for each natural number index:

e0,  e1,  e2,  e3,  e_0,\; e_1,\; e_2,\; e_3,\;\ldots

Each ene_n is just a tag — a box holding the natural number nn. Polynomials in multiple variables are formed by taking products and sums of these tags with natural number coefficients. So where ordinary algebra writes xx and yy, box arithmetic writes e0e_0 and e1e_1 (or any two distinct indices).

A polynumber term in several variables is a product of base multinumbers:

e12e3=e1e1e3e_1^2 \cdot e_3 = e_1 e_1 e_3

In boxmath, exponents[i] is the power of eie_i:

PolynumberExponent vector
11 (constant)[]
e1e_1[0, 1]
e12e_1^2[0, 2]
e2e4e_2 e_4[0, 0, 1, 0, 1]
e12e3e_1^2 e_3[0, 2, 0, 1]
Coefficients are just the natural number scalar

new Polynumber(2n, [0,0,0,1]) is 2e32e_3 — the exponent vector says which variables appear and at what power; the first argument is the natural number coefficient. So 1+2e3+e2e41 + 2e_3 + e_2 e_4 encodes as:

new Multinumber([
new Polynumber(1n, []), // 1
new Polynumber(2n, [0,0,0,1]), // 2e₃
new Polynumber(1n, [0,0,1,0,1]), // e₂e₄
]);
Trailing zeros can always be dropped

Wildberger states explicitly: "adding or removing final 0 entries does not change the representation." The reason is that ei0=1e_i^0 = 1 for any ii — an exponent of zero contributes nothing to the product. So [0,0,0,1] and [0,0,0,1,0] are the same polynumber term (e3e_3). The library respects this: Polynumber.evaluate only multiplies when exponents[i] > 0, and Polynumber.extent finds the last nonzero index and ignores everything after it.

Wildberger's worked example (PDF §3.5)

"If B=1+e3+e2e4B = 1 + e_3 + e_2 e_4 and C=e12+e2e4C = e_1^2 + e_2 e_4 then BC=e12+e2e4+e12e3+e2e3e4+e12e2e4+e22e42B \cdot C = e_1^2 + e_2 e_4 + e_1^2 e_3 + e_2 e_3 e_4 + e_1^2 e_2 e_4 + e_2^2 e_4^2."

The product is every pairwise combination of a term from BB with a term from CC3×2=63 \times 2 = 6 terms total:

import { Polynumber, Multinumber } from 'boxmath';

const B = new Multinumber([
new Polynumber(1n, []), // 1
new Polynumber(1n, [0,0,0,1]), // e₃
new Polynumber(1n, [0,0,1,0,1]), // e₂e₄
]);

const C = new Multinumber([
new Polynumber(1n, [0,2]), // e₁²
new Polynumber(1n, [0,0,1,0,1]), // e₂e₄
]);

const BC = B.multiply(C);
BC.terms.length; // 6

BC.terms.map(t => t.toString(['e0','e1','e2','e3','e4']));
// ['e1^2', 'e2e4', 'e1^2e3', 'e2e3e4', 'e1^2e2e4', 'e2^2e4^2']

The exponent vectors add component-wise under multiply — the box product rule.