Skip to content

Commit 1811082

Browse files
committed
docstring for quick_cancel [ci skip]
1 parent 919f19e commit 1811082

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/polyform.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,15 @@ _gcd(x::MaybeGcd, y::MaybeGcd) = (coefftype(x) <: Complex || coefftype(y) <: Com
304304
_gcd(x, y) = 1
305305

306306

307+
"""
308+
quick_cancel(d::Div)
309+
310+
Cancel out matching factors from numerator and denominator.
311+
This is not as effective as `simplify_fractions`, for example,
312+
it wouldn't simplify `(x^2 + 15 - 8x) / (x - 5)` to `(x - 3)`.
313+
But it will simplify `(x - 5)^2*(x - 3) / (x - 5)` to `(x - 5)*(x - 3)`.
314+
Has optimized processes for `Mul` and `Pow` terms.
315+
"""
307316
quick_cancel(d::Div) = Div{symtype(d)}(quick_cancel(d.num, d.den)...)
308317

309318
quick_cancel(x) = x

0 commit comments

Comments
 (0)