You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simplify does not cancel a factor when a numerator's term holds a power of it #2301
On master (c633c41), Simplify() cancels a factor that every term of a numerator shares with the denominator, but not when a term holds a power of it:
Simplify
Should be
(x * (y + 1) + (y + 1)) / (y + 1)^2
(x + 1) / (y + 1)
the same
(x * (y + 1) + (y + 1)^2) / (y + 1)^4
(x * (y + 1) + (y + 1) ^ 2) / (y + 1) ^ 4
(x + y + 1) / (y + 1) ^ 3
(x * (x^2 + 1) + (x^2 + 1)^2) / (x^2 + 1)^4
left as it is
(x ^ 2 + x + 1) / (x ^ 2 + 1) ^ 3
(a * (x^2 + 1) + b * (x^2 + 1)^2) / (x^2 + 1)^3
(a + b * x ^ 2 + b) / (x ^ 4 + 2 * x ^ 2 + 1)
right, but expanded
The values are right; the answer is not as far as it goes.
It is what makes a Taylor expansion of e^x / (1 + x^2) slow after #2291. The quotient rule squares the denominator at each step, and Simplify does not take back the factor the new numerator shares with it. So the simplified derivatives go e ^ x * (1 + x ^ 2 - 2 * x) / (1 + x ^ 2) ^ 2, then (… * (x ^ 2 + 1) * … + e ^ x * (x ^ 2 + 1) ^ 2 * …) / (x ^ 2 + 1) ^ 4, then a 15-term numerator over (x ^ 2 + 1) ^ 8. That is 21, 49 and 149 nodes, then 629 at the fifth and 5,117 at the seventh, and 9 terms take 8 s.
Activity
A Taylor expansion simplifies each derivative before taking the next (#…