Rule-based integration of the apostol problems in test/problems_apostol.jl: RUBISymbolicIntegration with three term types, SymEngine, SimpleExpressions and SymbolicUtils, and the rule-based method of SymbolicIntegration.jl with Symbolics terms. Each answer was also checked by comparing a numerical derivative of the answer with the integrand.
Select a problem number or a cell to see the integrand and each method's answer.
RUBISymbolicIntegration with SimpleExpressions solves the most, 133, and every one of its answers checks out. Its special functions are those of SpecialFunctions.jl (expinti, gamma), PolyLog.jl (reli) and HypergeometricFunctions.jl (_₂F₁), so the answers evaluate numerically. It is also the slowest, and most of its time is compiling: SimpleExpressions encodes each expression's structure in its type, so code that specializes on the type compiles anew for each new shape; rerun in the same session, problems take a fraction of a second. The matcher, now in AssociativeCommutativePatternMatching, does not specialize on the subject's type and compiles each rule's pattern once; with these, this row's integration time came down from 456 s to 237 s, with no effect on the answers.
With SymEngine and SymbolicUtils it solves 128 each. With SymbolicUtils 125 are verified; the other 3 have an incomplete gamma function, which stays unevaluated, or sqrt(-1) as a constant. With SymEngine 115 are verified: the special functions (Expinti, reli, Gamma, _₂F₁) stay unevaluated, so 13 answers can not be checked.
SymbolicIntegration's rule-based method solves 124, 117 verified, and gives wrong answers for ∫ x² sin x, ∫ x³ cos x and ∫ x³ sin x (problems 23–25): 2(−cos x + x sin x) − x² cos x has the sign of 2 cos x reversed. The cause is rule 4_1_10_1_1, a hand-written rule for (c + dx)ᵐ cos(e + fx) that adds the remaining integral where it should subtract it. RUBISymbolicIntegration had the same rule and it is fixed there; SymbolicIntegration.jl 3.8.1 still has it.
The same rules give different results on different term types, because each type stores expressions its own way: SymbolicUtils keeps 1/(x log x) as a quotient, SimpleExpressions keeps 1/√u as u^(-1/2), and simplifying or expanding gives different forms. CommutativePatternMatching matches quotients and products of powers against rules written either way, ext_expand keeps a rational integrand factored for the partial-fraction rules, and when no rule applies the frontend tries both the simplified and the fully expanded integral.
Solved means the method returned a result with no unevaluated ∫. An answer is verified when the central difference of the answer, at x = 0.31 and x = 0.57 with every parameter given a fixed value, matches the integrand to 1e-4. Answers that contain functions the term type cannot evaluate numerically are counted as solved but not checked; such an answer may still be wrong.
Each method ran in its own Julia process, one after another, with a limit of s per problem; after a timeout the process was restarted at the next problem. Integration time is the sum of the per-problem times from a cold start, so it includes compiling. Load time is the time to load the packages.