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. The expression is written as a single fraction, by the step
AsSingleFraction takes -- 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 — and so does dividing by a quotient,
which moves its denominator into the numerator: 1/(1/x) is not x. So the
answer carries the condition that neither vanishes, which is what the library already
does elsewhere and what keeps "equal trees means equal expressions" true rather than
nearly true; the condition is written canonically too, square-free and without what
the denominator already excludes. A sum is defined exactly where its terms are, and the
common denominator vanishes exactly where one of theirs does, so gathering one widens
nothing. #1618

Members

























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