AngouriMath

Navigation

SingleQuotient


← Back to list of classes

Description

Summary

Writes an expression as one quotient: a numerator and a denominator with no division
anywhere inside either.

Remarks

This is what other systems call together or ratsimp, and it is deliberately
not part of Simplify(System.Int32). Putting a sum over a common
denominator makes some expressions worse — 1/x + 1/y is easier to read than
(x + y)/(x*y) — which is why every system that has it keeps it as an operation you
ask for. Simplify here combines nothing: a + b/c comes back as a + b/c.
https://github.com/asc-community/AngouriMath/issues/1239
What it is for. Everything that takes a rational function apart —
PartialFractions and the integrator's rational path — wants its input as a
single Divf of two polynomials, and declines anything else. So a rewrite that
produces a correct but nested answer is thrown away one step short of being usable. The
half-angle substitution is the case that exposed it: 1/(1 - sin(x)) rewrites to
2/((t^2 + 1)(1 + (-2)t/(t^2 + 1))), which is 2/(t^2 - 2t + 1) after one
distribution and is integrated at once, and was declined for want of it.
No cancellation. The two halves are returned as built, with no common factor taken
out: x/x comes back as (x, x) and not as (1, 1). Cancelling needs a
gcd, which needs to know what the expression is a polynomial in, and this runs
before anything has decided that. The callers here divide out afterwards anyway, and a
caller that wants the tidy form asks the simplifier for it.
It always terminates and never grows without bound, because it recurses only into
the operands of the node it is given and each recursion is on a strictly smaller tree. What
it can do is make the tree bigger — combining a sum of n quotients multiplies the
denominators — so Of(AngouriMath.Entity) is a transformation to ask for rather than one to apply
on the way past.

Members

























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