镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Simplify does not cancel a factor when a numerator's term holds a power of it #2301

Closed

Description

@Rafael-SOWNet

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.

Part of #2133.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions