AngouriMath

Navigation

RationalFunction


← Back to list of classes

Description

Summary

A canonical form for rational functions over Q: two expressions denoting the
same quotient of polynomials become the identical tree, so that deciding whether they
are equal is a structural comparison rather than a search.

Remarks

This is the part of the language where a canonical form is possible. There is
none for the whole of it — zero-equivalence is undecidable once pi, the
exponential, the trigonometric functions and abs are in play (Richardson, 1968)
— so the boundary is in the signature: a refusal means "not a rational function over
Q, and no canonical form is claimed", never a normalisation that resembles one.
Docs/Contributing/CanonicalForm.md is the specification.
#934.
Four steps, and only the first is new. The expression is gathered into a single
quotient — nothing else in the library does that, and without it 1/x + 1/y and
(x + y)/(x*y) could never meet. Then the numerator and denominator are divided
by their multivariate greatest common divisor, which
PolynomialGcd computes and verifies. Then both are scaled so that the
denominator's leading coefficient is one, which is what makes 2x/(4y) and
x/(2y) the same tree. Coefficients are in lowest terms throughout.
The domain is preserved rather than assumed away. Cancelling a common factor
widens the domain — x/x is not 1 — so where a factor of positive degree
is cancelled the answer carries the condition that it is nonzero, which is what the
library already does elsewhere and what keeps "equal trees means equal expressions"
true rather than nearly true. Gathering over a common denominator does not widen
anything: a sum is defined exactly where its terms are, and the product of the
denominators vanishes exactly where one of them does.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online