Skip to content

Integrating e^(2x) x^(-1) runs out of memory: integration by parts reads x^(-1) as a polynomial #1646

Description

@Rafael-SOWNet

(e^(2*x) * x^(-1)).Integrate(x) passes 2 GB within seconds and does not finish. e^(2*x)/x is Ei(2*x) in milliseconds.

Measured on master at 492afc2, with one integral per process, killed at 2 GB or 60 s:

integrand master
e^(2*x)*x^(-1) out of memory
e^(a*x)*x^(-1) out of memory
(x + x^(-1))*e^x out of memory
2^x*x^(-1) out of memory
e^x*sin(x)*x^(-1) out of memory
e^x*cos(x)*x^(-2) out of memory
e^x*x^(-2) past 60 s
x^(-3)*e^x past 60 s
x^(-2)*e^(3*x) past 60 s

MathS.TryPolynomial reads x^(-1) as a monomial of degree -1. Two rules differentiate what it reads until it reaches 0, which a negative power never does:

  • tabular integration by parts, IntegrateByPartsPolynomial, capped at 2000 rounds;
  • the loop for a polynomial times an exponential and a sine or a cosine, capped at 64.

Each derivative is larger than the one before.

The power is not an unusual spelling. The integrator writes a quotient this way itself once a constant factor is out. #1645 ran into it through its substitution t = ln(c x^n).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions