AngouriMath

Navigation

← Back to list of members

PolynomialLongDivision​(AngouriMath.​Entity,​AngouriMath.​Entity,​System.​Boolean,​AngouriMath.​Entity.​Variable)

 Method (no overloads)

Summary

Divides one polynomial over another one:
https://en.wikipedia.org/wiki/Polynomial_long_division

Remarks

As written first, and only then with the variables replaced. The replacement
exists for a base that is not a variable — sin(x)^2 / sin(x), where the thing
the division is in is sin(x) — and it works by swapping each variable's
smallest enclosing subtree for a fresh symbol. With one variable that is harmless,
because nothing in the pair contains the whole expression. With two it is
destructive: for x / (a + b x) the smallest subtree holding a is
a + b x, so the divisor is replaced wholesale by one opaque symbol, the
dividend keeps its x, and the two no longer share a variable to divide in.
The division then reports that it cannot be done.
What that cost: int x/(a + b x) dx was unanswered while
int x/(2 + 3 x) dx came out, and the same for every improper fraction with a
symbolic coefficient — including the one int x ln(b + a x) dx is left with
after integration by parts. A numeric coefficient hid the defect, which is the usual
way this one hides.
https://github.com/asc-community/AngouriMath/issues/718
Trying the unreplaced form first keeps both: a pair that divides as written divides
the same way it always did, and one that does not falls through to the replacement,
which is the only thing that ever answered sin(x)^2 / sin(x).
genericCase says which of two callers is asking. Dividing by
the divisor's leading coefficient loses the value of the parameter that makes it zero:
x / (a + b x) divided out is undefined at b = 0, where the quotient is
x / a and perfectly ordinary. For the simplifier that is a rewrite which is not
an equivalence, so it is declined; for the integrator it is the answer every
neighbouring rule already gives, since int 1/(a x + b) dx is
ln(a x + b) / a and loses a = 0 on every call. The default is the
simplifier's, and nothing about the general pass changes by adding this.

























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