AngouriMath

Navigation

← Back to list of members

CanonicalizeAsRationalFunction

 Method (no overloads)

Summary

A canonical form for rational functions over Q, or null where this is not one.

Remarks

Two rational functions are equal exactly when this form is identical, so on
that sublanguage equality is decided by comparing nodes rather than by searching —
which is what (a - b).Simplify() against zero can never be.
It answers only where it can, and says so by answering nothing. Anything that
is not a rational function over Q in its free variables gets
null, because a form whose whole value is that equal trees mean
equal expressions must not hand back a normalisation that merely resembles one.
Cancelling a common factor widens the domain, so where one comes out the answer
carries the condition that it is nonzero: x/x is 1 provided not x = 0 and not 1, and (x^2 - 1)/(x + 1) is not the same function as
x - 1.

Example

using AngouriMath;
using static System.Console;
            
WriteLine("1/x + 1/y".ToEntity().CanonicalizeAsRationalFunction());
WriteLine("(x + y) / (x * y)".ToEntity().CanonicalizeAsRationalFunction());
WriteLine("sin(x) / x".ToEntity().CanonicalizeAsRationalFunction() is null);

Prints
(x + y) / (x * y)
(x + y) / (x * y)
True

























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