- The command canonical rewrites the expression representing the function function in a way such that all polynomial subexpressions (or the whole expression itself, if it is a polynomial) are written in canonical form, i.e. as a sum of monomials in the canonical base. The canonical base is the base of the integer powers of the global free variable. The command canonical does not endanger the safety of computations even in Sollya's floating-point environment: the function returned is mathematically equal to the function function.
- An assignment canonical = activation value, where activation value
is one of on or off, activates respectively deactivates the
automatic printing of polynomial expressions in canonical form,
i.e. as a sum of monomials in the canonical base. If automatic
printing in canonical form is deactivated, automatic printing yields to
displaying polynomial subexpressions in Horner form.

If the assignment canonical = activation value is followed by an exclamation mark, no message indicating the new state is displayed. Otherwise the user is informed of the new state of the global mode by an indication.

1 + x^2 + 3 * x^3

> print(canonical((x + 1)^7));

1 + 7 * x + 21 * x^2 + 35 * x^3 + 35 * x^4 + 21 * x^5 + 7 * x^6 + x^7

exp(1 + 5 * x + 10 * x^2 + 10 * x^3 + 5 * x^4 + x^5) - log(asin(16 + 80 * x + 160 * x^2 + 160 * x^3 + 80 * x^4 + 16 * x^5) + x)

off

> (x + 2)^9;

512 + x * (2304 + x * (4608 + x * (5376 + x * (4032 + x * (2016 + x * (672 + x * (144 + x * (18 + x))))))))

> canonical = on;

Canonical automatic printing output has been activated.

> (x + 2)^9;

512 + 2304 * x + 4608 * x^2 + 5376 * x^3 + 4032 * x^4 + 2016 * x^5 + 672 * x^6 + 144 * x^7 + 18 * x^8 + x^9

> canonical;

on

> canonical = off!;

> (x + 2)^9;

512 + x * (2304 + x * (4608 + x * (5376 + x * (4032 + x * (2016 + x * (672 + x * (144 + x * (18 + x))))))))