Parallel Integration over Simple Radical Extensions
in Mixed Towers: Charlwood’s Integrals
Abstract
Charlwood’s 2008 paper Integration on computer algebra systems lists fifty indefinite integrals of real elementary functions — ten worked in detail and forty in an appendix — chosen to defeat Maple, Mathematica and the TI-89 of the day: products of inverse functions, arcsines and logarithms of algebraic functions, radicals over trigonometric functions. We run all fifty through the SymPy implementation of the parallel (Risch–Norman) method of Part II of this series, in the form in which they are written, with the tower of the integrand built automatically, and verify every answer by differentiation. The method returns 49 verified integrals of the and no wrong answer; the one it does not return, , is not elementary — the holomorphic-remainder certificate of Part II shows this after one integration by parts — and in its own tower, a curve of genus three, the implementation withholds the certificate because the one hypothesis it cannot verify there is the completeness of the -units over a special prime of the curve variable. The degree bounds of Part II at every place — the exponents of the special primes and the degrees in the variables below the top — are proved on every rung for thirty-eight of the fifty integrals and cut the ansätze to a third of the size the classical guess gives them, without changing a result or the running time. The residues at a prime of degree eight that one of the integrals needs are computed in the residue field, by the residue polynomial of Rothstein and Trager inside Algorithm 2 of Part II, and each residue class is realised from its sheet polynomial by Hensel lifting and linear algebra. We give the solutions in the coordinates of the towers, where the mechanisms of Part II — -units over the special primes, Pell units of conics and of a genus-two curve, torsion on elliptic curves, a Risch differential equation over a curve — are visible, and we compare, on the same machine with the same time limit and the same verification, with the Risch–Trager–Bronstein integrator of FriCAS (49 of , typically in a tenth of a second) and of AXIOM (35 of , with three wrong answers). The comparison is an assessment of a prototype against a mature implementation: the parallel method is slower by a factor of six on the median integral and by more than an order of magnitude on the worst cases, and the profile shows exactly where — in the nonlinear norm search for the -units, in the primitive elements of nested number fields and in the retry ladder of guessed inputs, everything else having been moved into one number field per tower — and what to change. Nothing in the integrator is tuned to the suite: every step it takes is a step of Part II, and every failure is reported as such.
1 Introduction
In 2008 Charlwood published a short paper [4] whose subject is the gap between what a student can integrate by hand and what a computer algebra system integrates unaided. Ten indefinite integrals of real elementary functions are worked in detail — a product of two inverse functions, an arcsine of a difference of square roots, a logarithm of an algebraic function, trigonometric integrands whose rationalisation is far from obvious — and forty more are listed in an appendix. Maple 11, Mathematica 6.0.2 and the TI-89 were tested on the ten; the score-card in the paper is four, seven and four successes respectively, several of the “successes” being answers in terms of elliptic integrals or complex-valued expressions that a calculus student could not use. Charlwood’s point was pedagogical: when a system fails, a substitution or an integration by parts found by hand produces a new integral the system can handle. The paper has since become a standard small benchmark for integration software.
Part II of this series [7] developed the parallel (Risch–Norman) method for towers containing one simple radical anywhere in the tower, and Charlwood’s integrals are exactly the kind of input that theory was written for: the derivative of introduces the curve below the primitive ; is a logarithm of an element of the function field of ; is a radical over the hypertangent . The present paper is a companion to Part II, with four aims.
- 1.
To run all fifty of Charlwood’s integrals through the SymPy implementation of Part II, in the form in which a user would type them: the tower is built automatically from the surface expression by the rules of Section 2, the integral is computed by the pipeline of Part II, and every returned integral is verified by differentiation.
- 2.
To give the solutions the method finds, in the coordinates of the tower where that is more illuminating than the surface form, and for every failure to say exactly which step of the pipeline is responsible and why.
- 3.
- 4.
To assess the state of the implementation: which steps of the published algorithm it covers, where its limits are, where its time goes, and what the next pieces of work are. Every failure is reported with the step of the pipeline responsible, every choice of policy in the retry ladder is stated as such, and nothing in the integrator is tuned to the suite.
The outcome is summarised in Table 1. The parallel method returns 49 verified integrals of the fifty, in 68 seconds in all; FriCAS returns 49 (and leaves the one non-elementary integral unevaluated), AXIOM 35. The one integral the parallel method does not return, A39, is not elementary, and its certificate is the one the implementation cannot yet produce inside the tower.
Related work. The benchmark itself is [4]; parts of it reappear in the test suites of Rubi [8] and in Parisse’s comparison of Giac with other systems. The theory is Parts I and II of this series [6, 7], whose notation we use without further comment: with , the working ring , the denominator divisor , the valuation shift at normal primes, special primes, the residues and canonical residues , -units and the realisation of residue divisors, and the three exits of the algorithm — an integral, a certificate of non-elementarity, or “failed”.
2 The implementation under test
2.1 From a surface expression to a tower
Part II works with an integrand given as a coordinate pair over an explicitly described tower. A benchmark of fifty integrals written the way Charlwood wrote them needs the tower to be built automatically; the module build_tower.py does this by a small set of rules applied innermost first, until the integrand is a rational function of the generators and . The rules are the obvious ones, but the order and the normalisations matter — a sign decided at the wrong place, or a root flattened over a coefficient that is not constant, changes the tower and with it the integral — so we state them.
- (R1)
Trigonometric functions of one argument are handled as a family through a tangent, never through an exponential. If the integrand is odd in (resp. ) and is the integration variable, the variable is changed to (resp. ); if it is even in , the generator is with ; otherwise . Radicands and the arguments of opaque functions such as are examined by the same parity rules through placeholders.
- (R2)
, , become primitives with rational derivatives; , , become hyperexponential and hypertangent monomials. , , , , , … become primitives whose derivative goes through the radical (or ), which becomes the radical of the tower if none exists.
- (R3)
A root whose base is , with a generator, a constant and free of and of , is flattened (Lemma 3.2 of Part II): . Every other root with is the radical , after has been normalised to a squarefree polynomial by and , the signs , being decided at a rational sample point of the real domain of the integrand. A factor of the squarefree radicand that is itself a generator , positive at the sample point, is split off as the pure root , which then flattens: in A27, in Problem 9.
- (R4)
If a second, unflattenable radical is demanded and the existing one is a conic , the conic is parametrised: by Euler’s substitution when is a square, else through a rational point found by a small search, ; the parameter is oriented so that at the sample point. The tower is then transcendental over and the new radical takes its place.
2.2 The integrator
The integrator (parallel_mixed.py) runs Algorithm 4 of Part II with its retry ladder: the base run with the tower specials over , the special exponents and degree bounds proved by Algorithm 6 of Part II where its criteria apply and, where they do not, guessed and raised in turn, as (I5) below describes; for a conic radicand, the parametrisation (R4) before any work over ; the specials split over ; and for a quartic radicand with a square leading coefficient, the change to the cubic model. Before the ladder, a tower that has become a single generator over the curve with — a flattened root or the parameter of (R4) — is rescaled to (Lemma 3.4 of Part II), so that it is the setting of Part I, exact bounds and certificate included; in the suite this concerns Problem 7 alone. Each rung is a guessed input or a change of model in the sense of Remark 9.1 of Part II. Five points of the implementation bear directly on the results below; the third and the fifth are Algorithms 5 and 6 of Part II, the others are not spelled out there.
- (I1)
Canonical residues in mixed towers. At a normal prime of Hermite order the residue is the canonical residue of Proposition 7.6 of Part II, computed by the local reduction of Algorithm 2 — , a lift of , — in which is a function of the upper generators and is the derivation of the whole tower: when a primitive sits above the curve, does not act trivially on the coefficients of the completion, and the reduction of the one-generator case, a Laurent expansion with constant coefficients, does not apply. The loop is implemented (_canonical_residues) at unramified normal primes with and constant coordinates, the leading class being read from the local expansion of about the place; a transcendental tower ( absent) realises a residue divisor over such a prime by the principal primes .
- (I2)
Realisation over several primes. A residue divisor may be supported over several irreducible and be realised by a function whose norm is not a power of any one of them. Algorithm 3 is therefore run over the product of the primes carrying the divisor (_realise_joint) before the “needs torsion” exit; the coefficients are checked to be constant on the hits and to cover every place with a nonzero residue. On a cubic model the torsion step (Algorithm 3(d)) likewise acts on the whole leftover divisor — its places summed by the group law, the order of the sum being the order of the class — rather than on the classes of the single places, which need not be torsion when the divisor is.
- (I3)
Assembly and solution of the linear system over one number field. The system is linear in the unknown coefficients, and every constant that enters it — the coefficients of the , of and of the residual, the norms of the -units, the roots of a special split over — is carried as an element of one number field whose primitive element is computed once per system (Algorithm 5 of Part II). With the least common multiple of the denominators of the , every column and , a monomial, is a pair of polynomials of over the one denominator , computed by the product rule in the sparse polynomial ring with no cancellation; the few remaining columns (units, -units, specials) are cancelled once; each coordinate is brought over the least common multiple of its denominators, which is exact in whatever the constants; the coefficient of each monomial is a row of a sparse matrix over , the matrix is reduced to row echelon form, the solution with the free unknowns set to zero is checked on the matrix, and the rational part of the answer is cancelled in and written back in the radicals of . No cancellation or simplification touches an expression that contains an unknown, and the field is never re-derived. The equations are those of Part II up to a polynomial factor per coordinate, and the assembly and the solve are together a small fraction of the running time (Section 5); in the first version of the implementation, which formed the columns as expressions and checked the solution by substitution and simplification, they were three quarters of it. The same field is the field of the tower (Remark 9.6 of Part II): the coordinate arithmetic of the pairs, the realisation of residue classes (I4) and the torsion arithmetic of Algorithm 3(d) run in it, with exact zero tests; and the once-per-integrand part of Algorithm 4 — classification, residues and their realisation, tower specials, units and -units, the residual — is computed once and reused by every rung of the retry ladder, which re-enters at the ansatz.
- (I4)
Residues at primes of any degree. At a prime of degree more than four in the curve variable — where explicit roots would carry nested radicals of high degree — the residues are computed in the residue field without roots. With written as a pair and reduced modulo , the residues on the two sheets over a root are , and their minimal polynomial over ,
the residue polynomial of Rothstein and Trager, gives the residue values and the fields through its irreducible factors; constancy is the statement that are free of the other generators. The places with residue lie over on the sheet , a polynomial with , so a residue class is a pair (prime, sheet polynomial) rather than a list of points; where vanishes both sheets carry and the divisor over that factor is principal. The class is realised by linear algebra over : is lifted by Hensel’s iteration to with , the condition that vanish to order along the class is the linear condition , and the pole orders at the two places at infinity are fixed in turn, so that has degree exactly and is a constant times ; the least with a solution gives the logand, with coefficient (_residue_classes, _realise_class). Classes of equal value over several primes are realised jointly, as in (I2). The bound on is a guessed input in the sense of Remark 9.1; a class of larger order is a torsion question for the division polynomials of Parts I and III.
- (I5)
Degree bounds at every place, and the certificate. The exponent of every special prime and the degree bound in every generator are computed by Algorithm 6 of Part II from the shift of the derivation at the places over the special and over (Theorem 8.7 and Corollary 8.9 of Part II), and each is recorded as proved when one of the criteria (K1)–(K4) of Proposition 8.11 applies at every place over it, or as a guess — the classical bound of [3, §10.3], raised by the retry count — when none does (_place_bounds; the verbose trace prints the criterion at every place). The retry over the special exponents runs only while a guess is in play: a rung on which every bound is proved is tried once. One kind of place is left to the guess by the implementation although the theory decides it: a special prime over the curve variable that is a branch prime, or at which the two coordinates of a derivative have equal valuation, so that the Gauss valuation on the pair is only a lower bound and the expansions of Part I, §6.1 would be needed. The criterion (K1) is applied in its extended form, with attaining hyperexponential generators: the kernel degrees vanish unless is a -linear combination of their constants , which the implementation decides, when and the are numbers, by linear algebra over in a common number field (_in_qspan); Problem 10 is the one integral of the suite where this arises. The certificate of Proposition 9.2(b) is issued exactly when every bound in force is proved, the unit group is known, the specials are irreducible over (split, or nothing to split), no special lies over the curve variable — there the -units come from the bounded norm search of (L2) and are not known to be complete — and the residual is verified residue-free by re-running the residue analysis on it; in every other case the exit is “failed”. On the suite, thirty-eight integrals are computed with every bound proved on every rung and twelve with a guess in play; against the classical guess with the same ladder, the ansätze summed over the rungs shrink from unknowns to and the rungs from to , with no change in any result and none in the running time, the linear algebra being about a second of the 68 s (Section 5).
2.3 Protocol
All fifty integrals were run with the script charlwood.py accompanying this paper. Each integral is given at most seconds of wall-clock time; timings are for a single core of a 16-core Apple workstation, SymPy 1.14 under Python 3.11. A returned integral is accepted only if evaluates to less than at three rational points of the real domain of at digits; a status tuple is recorded verbatim. The same integrals were given to FriCAS 1.3.6 and AXIOM (August 2014) in one fresh process each, with the same limit (cas_compare.py); the answer was captured in input form and re-verified by the same test in SymPy, so that all three systems are judged by one criterion, independent of their own numerical evaluators (which matters: FriCAS’s own complexNumeric evaluates its answer to Problem 8 incorrectly, although the answer is right). The times reported for FriCAS and AXIOM are those printed by )set messages time on for the integrate call alone; the times for the parallel method include the construction of the tower.
| integrand | PM | FriCAS | AXIOM | ||||
|---|---|---|---|---|---|---|---|
| P1 | 0.5 | 0.1 | 0.2 | ||||
| P2 | 0.2 | 0.1 | 0.1 | ||||
| P3 | 2.0 | 52.8 | E | – | |||
| P4 | 6.2 | 0.1 | 0.1 | ||||
| P5 | 2.6 | 0.2 | 0.5 | ||||
| P6 | 0.6 | 0.2 | 0.5 | ||||
| P7 | 0.2 | 0.2 | 0.4 | ||||
| P8 | 7.0 | 0.7 | 12.2 | ||||
| P9 | 0.5 | 0.1 | E | – | |||
| P10 | 0.5 | 0.1 | 0.1 | ||||
| A1 | 1.3 | 0.1 | 0.1 | ||||
| A2 | 3.6 | 0.1 | W | 0.2 | |||
| A3 | 3.1 | 0.1 | W | 0.2 | |||
| A4 | 0.7 | 0.1 | 0.1 | ||||
| A5 | 1.1 | 0.1 | E | – | |||
| A6 | 1.7 | 0.1 | E | – | |||
| A7 | 1.1 | 0.1 | E | – | |||
| A8 | 0.3 | 0.1 | 0.1 | ||||
| A9 | 0.2 | 0.1 | 0.1 | ||||
| A10 | 0.1 | 0.1 | 0.1 | ||||
| A11 | 1.3 | 0.1 | E | – | |||
| A12 | 1.6 | 0.1 | E | – | |||
| A13 | 0.4 | 0.1 | 0.1 | ||||
| A14 | 0.3 | 0.1 | 0.1 | ||||
| A15 | 0.1 | 0.1 | 0.1 | ||||
| A16 | 1.4 | 0.1 | 0.1 | ||||
| A17 | 0.3 | 0.1 | 0.1 | ||||
| A18 | 0.2 | 0.1 | 0.1 | ||||
| A19 | 1.1 | 0.1 | 0.2 | ||||
| A20 | 0.6 | 0.1 | 0.1 | ||||
| A21 | 0.7 | 0.1 | 0.2 | ||||
| A22 | 0.4 | 0.1 | 0.1 | ||||
| A23 | 0.3 | 0.1 | 0.1 | ||||
| A24 | 0.2 | 0.1 | 0.1 | ||||
| A25 | 0.3 | 0.1 | E | – | |||
| A26 | 0.2 | 0.1 | 0.1 | ||||
| A27 | 4.2 | 0.1 | E | – | |||
| A28 | 3.7 | 0.1 | 0.1 | ||||
| A29 | 2.9 | 0.1 | 0.1 | ||||
| A30 | 0.5 | 0.1 | 0.2 | ||||
| A31 | 0.9 | 0.1 | E | – | |||
| A32 | 0.6 | 0.2 | W | 0.2 | |||
| A33 | 0.5 | 0.1 | 0.4 | ||||
| A34 | 0.7 | 0.2 | 0.3 | ||||
| A35 | 4.1 | 7.7 | E | – | |||
| A36 | 0.1 | 0.1 | 0.1 | ||||
| A37 | 2.1 | 0.1 | 0.1 | ||||
| A38 | 0.4 | 0.1 | 0.1 | ||||
| A39 | F | 1.6 | U | 0.1 | E | – | |
| A40 | 2.8 | 0.2 | 0.2 | ||||
| verified integrals | 49 | 49 | 35 | ||||
| F “failed” | 1 | 0 | 0 | ||||
| T time limit reached | 0 | 0 | 0 | ||||
| W wrong answers | 0 | 0 | 3 | ||||
| U unevaluated integrals | 0 | 1 | 0 | ||||
| E errors | 0 | 0 | 12 | ||||
| total time (s) | 68.2 | 66.6 | 18.3 | ||||
| mean time (s) | 1.4 | 1.3 | 0.5 | ||||
| median time (s) | 0.6 | 0.1 | 0.1 | ||||
3 The ten problems
For each problem we give the tower built by (R1)–(R4), the mechanism of Part II that carries the integral, the solution in the coordinates of the tower (with the substitutions that return it to ), the time, and Charlwood’s own answer where it differs in form. Every displayed formula is checked by differentiation by the script charlwood_paper_check.py.
Problem 1:
Tower , , over , with and ; integrand . The prime is special (the argument of a logarithm), and the -units over it found by the norm search are (norm ) and (norm ). Every bound is proved — the exponent of the special and the degree in by (K1), the degrees in and by (K2) — and the ansatz, of unknowns, is solved at the first attempt, in 0.5 s:
i.e. Charlwood’s . The logarithm that every system has to find is here an -unit of the curve over the special prime : its divisor is supported at the two places over and at infinity, and it is invisible to every residue — exactly the situation of Remark 7.8 of Part II. Maple 11 could not do the original integral in 2008 (Maple 8 could not even do the second integral after the parts step); FriCAS returns the same answer with in place of our (the two differ by const).
Problem 2:
Tower , over ; the integrand is . Both branch primes carry a pole of order , which is sub-critical (), so there are no residues and no Hermite part, and the ansatz ( unknowns) returns in 0.2 s. This is the archetype Charlwood describes — “an inverse trigonometric function that we would differentiate in the parts process” — and in the parallel method there is no parts step: the -linear block of the system is the integration by parts.
Problem 3:
This is the nested-radical example, and the tower construction is the whole story. is a pure root and flattens to (R3); is a conic with square leading coefficient, and when the arcsine demands a further radical the conic is parametrised by Euler’s substitution (R4). In the parameter, , so is a primitive whose derivative needs : the final tower is , over the conic , with and , and the integrand is . The prime is special (it divides the moving denominator), with -units (norm ); its exponent and the degree in are proved by (K1) and the degree in by (K2), so the system ( unknowns) is solved at the first attempt, in 2.0 s in all, two thirds of which is the verification of the nested-radical answer by differentiation:
Since , the coefficient of the arcsine is , which is Charlwood’s; his algebraic part is the first term above (both are ). Charlwood’s solution needed two rationalising substitutions and an integration by parts found by a student; Mathematica 6 gave a complex-domain answer and the TI-89 nothing. FriCAS finds the same answer, but in 52.8 s: the two square roots are handled there as an algebraic extension of degree four, whereas flattening and the Euler parametrisation reduce the problem to genus zero before the integrator starts.
Problem 4:
Tower , over , integrand . The norm of the logand is , so the moving denominator of is , , and this quartic is the special prime. The -units over it have coefficients in . The exponent of the quartic is a guess in the -tower — the two coordinates of have equal valuation there, the case (I5) leaves to the guess — and with the exponents the base run fails three times (, , unknowns); the conic is then parametrised by , the specials in the -tower are and the quartic , every bound there is proved by (K1) and (K2) — exponent at , at the quartic, degree in and in — so the tower is tried once ( unknowns), and only after the quartic is split over into its four linear factors is the system solved ( unknowns; 6.2 s in all). The answer, in Charlwood’s own notation — his is our Euler parameter , his —
is what the pipeline returns once its conjugate complex logarithms are paired. Two remarks. The needed logands are the linear factors of the split quartic, which the theory offers only after the specials are split over (Theorem 6.1 of Part II); in the original -tower the same logands would be -units over the four factors of the quartic, which the search bounded to norms with does not produce. And the order of the ladder — parametrise before splitting — is a policy, discussed in Section 5. FriCAS (0.1 s) returns an answer of the same shape with the same constants ; Charlwood reports that Mathematica 6 needed and Maple 11 gave a more complicated result.
Problem 5:
Even in , so (R1), and the radicand becomes : the tower is , over the quartic , of genus one, and the integrand is . Charlwood remarks that “it might appear at first that this is an elliptic integral”; it is an integral on an elliptic curve, and the mechanism that makes it elementary is torsion. The branch primes are sub-critical, there are no residues, and the only special is the hypertangent’s ; the -units over it (norms and ) do not suffice, nor do those over ; every bound is proved on both rungs — the exponent of the special and the degree in by (K1), the degree in by (K2) — so each is tried once ( and unknowns), and after the two failures the ladder changes the model: with the curve becomes , the specials are and , and the -units over them are the Miller functions of the torsion classes of order at and of order at . The system ( unknowns) is solved, 2.6 s in all, and the answer in the original variables is
which differs from Charlwood’s by a constant on each interval. Mathematica 6 and Maple 11 answered in elliptic and ; FriCAS returns, in 0.2 s,
Problem 6:
Tower , over (genus one), integrand . The special has the -units and , of norms ; with them and the unit (norm ) the first attempt succeeds ( unknowns, 0.6 s):
Charlwood’s answer with and regrouped. Mathematica 6 answered in elliptic functions.
Problem 7:
The integrand is odd in , so the variable is changed to ; then , whose normalisation demands — a pure root, flattened to with — and the remaining radical is : a curve of genus two. The tower is the single generator over the curve, and the integrator rescales it to (Lemma 3.4 of Part II): the integrand becomes , both branch primes are sub-critical, and the whole integral is carried by the fundamental unit () found by the continued fraction of :
in 0.2 s. It is the same mechanism as Cohen’s and Schultz’s integrals in Part II, on a hyperelliptic curve, with the trigonometric substitution done by the parity rule rather than by Charlwood’s “multiply and divide by ”.
Problem 8:
Tower , over the conic , integrand . The special has -units with coefficients in — norms and — and the first attempt ( unknowns) succeeds; the 7.0 s are, in three nearly equal parts, the norm search — a nonlinear solve over —, the construction of three fields of degree sixteen — primitive elements over nested radicals, one for each set of constants that the -units and their logarithms bring in — and the columns and the system over them. The answer is plus four logarithms with complex coefficients that pair into Charlwood’s two arctangents with and his logarithm with coefficient . Charlwood solved it by hand through the substitution with and a partial-fraction decomposition of a quartic; FriCAS’s answer (0.7 s) is three thousand characters long and contains and , and FriCAS’s own numerical evaluation of it is wrong although the expression is a correct antiderivative (Section 2.3); AXIOM returns a list of two candidate answers, of which the second is correct.
Problem 9:
Odd in : , and demands , flattened to , leaving the conic and the primitive with . The integrand is ; there are no poles at all, and the ansatz ( unknowns) gives, in 0.5 s,
Charlwood’s answer with . Maple 11 gave nothing here.
Problem 10:
Tower , , over : a hyperexponential whose derivative goes through the curve — the setting of Bronstein’s Risch differential equation on an algebraic curve and of §10.14 of Part II. The integrand is ; the branch poles are sub-critical, the only special is , and the -linear block of the system ( unknowns) is the Risch equation, solved in 0.5 s. Every bound is proved, one of them by the extended form of (K1): at the arcsine and the exponential above it both attain the shift of the derivation, with at the two places and , and since is not a rational multiple of the kernel degrees vanish and the degree in is (the classical guess is ); the exponent of and the degrees in , are proved by (K2). The answer
is exactly Charlwood’s form. Neither Maple 11 nor the TI-89 could do this integral, nor the simpler .
4 The forty integrals of the appendix
We group the appendix integrals by the mechanism they exercise. The status and time of each is in Table 1; the solutions are in the file charlwood_results.json produced by the run (surface form, tower form, and the full trace of the pipeline).
Inverse functions times algebraic functions: A8, A10, A14–A18, A20, A23–A26
These are the textbook integration-by-parts integrals,
and all but A16 are solved at the first attempt in under a second, with every bound proved, by the same pattern as Problems 1 and 2: sub-critical branch poles, one special (the argument of the logarithm or arctangent, or the hypertangent’s ), and the -units over it. Two are worth a comment. In A16, , the special is and the answer needs the logands and in the Euler parameter, which the ladder reaches only after the conic parametrisation and the -split (1.4 s). In A18, , the logand that the answer requires is invisible to every residue (it is the Pell unit of the conic, of norm ) and enters as the unit candidate of Remark 7.8 of Part II.
Hermite-order poles under a primitive: A4, A19, A21, A22
, , have a pole of order at the normal prime under a primitive . The Hermite part is ; the residues at the two places over are canonical residues at a pole of Hermite order (Proposition 7.6 of Part II), and must be computed by the local reduction with a function of , since does not act trivially on the coefficients of the completion (the remark following that proposition; this is the loop (I1) of Section 2.2). The residues at are , the logands (A21: of norm ) are realised by the norm search, and the three integrals are solved in about a second each; for instance
A4 goes through the conic parametrisation instead, where the pole is at the transcendental prime and the logand is a special.
Two conics, and elliptic quartics from the Euler parameter: A5, A6, A7, A11, A12
and its relatives contain two radicals. The first — from the logarithm or the arcsine — is a conic, parametrised by (R4); the second, or , becomes a quartic in the parameter, or , of genus one, with a pole of order at its branch primes (a Hermite part at a branch prime, ). The specials are or from the moving denominator, with -units such as (norm ) and ; every bound is proved — the exponent of the special (, or at in A12 and at in A11) and the degree in by (K1), the degree in by (K2) — and the systems, of – unknowns, are solved at the first attempt, in 1.1, 1.7, 1.1, 1.3 and 1.6 s. The answers are naturally expressed in ; A11 for instance is
where and , so that the algebraic part is ; the pipeline’s answer is the formula in .
Products of transcendentals: A1, A13, A36
and have three generators over and ansätze of unknowns; A36, , is purely transcendental ( unknowns, every bound proved). A13 and A36 are solved at the first attempt (0.4 and 0.1 s); A1 takes 1.3 s and five attempts, for the same reason as Problem 4: its answer needs , i.e. the special split over , and the ladder reaches the split only after three failed attempts in the -tower, where the exponent of is a guess raised from to , and one in the -tower, where every bound is proved, with systems of up to unknowns and equations on the way. Given the split at the outset it is solved in the original tower in less time (Section 5).
Curve integrals: A9, A28, A29
These have no transcendental generator and are integrals of algebraic functions in the sense of Parts I and III. A9, , has residues at on , realised by the Miller functions of the -torsion classes (certified by the division polynomial ): . A29, , has residues at the four places over on , realised by the -split of norm . A28, , has residues at and at : the divisor is supported over two primes of , and the logand realising it, , has norm , supported on both. The norm search over either prime alone does not find it; the joint search (I2) over the product does, and the answer is returned in 3.7 s. The joint search is three quarters of that time, as the search over is nine tenths of A29’s 2.9 s: in both curve integrals the cost is the norm search, and the system, of three unknowns with its one bound proved, is solved at once.
Trigonometric integrands: A27, A30–A35
A32, , is odd in and becomes with ; A34, , is odd in and becomes an integral on , , with residues at realised by the norm factors ; A33, , is even and is the companion of Problem 6. All three are solved in under a second. A30 and A31, and , and A35, , exercise the tower construction more than the integrator: the parity rules of (R1) have to see through and through a radical nested inside another, which is what the placeholders are for. A30 and A31 go through the half-angle with the logarithm on top, A31 over the conic , and are solved in 0.5 and 0.9 s. A35 is the most intricate tower of the suite: the half-angle substitution turns into , the outer square root demands a second radical over the conic , which is parametrised through its rational point — both sign decisions of (R3) and (R4) are exercised here, the denominator of the radicand and the natural parameter of the conic being negative on the domain; the new radicand is then , a pure root of , and flattens: the whole integrand is a rational function of one generator with , a transcendental tower with the specials , and the answer is a sum of eight logarithms with coefficients in , found in 4.1 s (FriCAS: 7.7 s; AXIOM: “implementation incomplete”). A27, , is the integral of the suite whose residues sit at a prime of high degree. The half-angle substitution and the flattening (R3) give the curve and the integrand , whose residues live at the sixteen places over , irreducible over and of degree in the only generator; the splitting field of has degree eight, and it is never needed. In the residue field (I4) the residue polynomial is : the residues are and the constant field grows by alone. The class lies over on the sheet , and the linear realisation finds it at , with pole orders at the two places at infinity:
and its images under and under complex conjugation realise the other three classes. The integral is , and in the original variable the four logarithms pair into
FriCAS’s answer in another arrangement, in 4.2 s against FriCAS’s 0.1 s; AXIOM reports “implementation incomplete (residue poly has multiple non-linear factors)”, the same residue polynomial met in the recursive algorithm.
Inverse functions of algebraic arguments: A2, A3, A37–A40
and (A2, A3) have with , and makes the quartic the special prime; as in Problem 4 the needed logands appear only after the parametrisation and the -split, and the times (3.6, 3.1 s) are those of the ladder. AXIOM’s answers to both are wrong by a branch of the arctangent (their derivatives differ from the integrand by and by ). (A37, A40) and (A38) are solved at the first attempt, A37 and A40 in 2.1 and 2.8 s, which are the norm searches over their specials (two quadratics for A37, the quartic for A40) and the columns over the fields of the -units found — the first two items of the profile of Problem 4 in Section 5, without the ladder; A38 flattens and the arctangent becomes a primitive over the conic with the answer , in 0.4 s. A39, , is the one integral of the suite that is not elementary. The pipeline reports “failed”, and the trace says why. The tower has the primitive over the curve obtained by parametrising and adjoining , which in the parameter is , of genus three; the special prime is , the denominator of . Every bound in force is proved — the exponent of the special and the degree in by (K1), the degree in by (K2) — so the tower is tried once ( unknowns), the special is split into and the tower tried once more ( unknowns), and both systems are inconsistent. Of the hypotheses of Proposition 9.2(b) of Part II one is then unverified: the -units over — the norm search finds , of norm — come from the bounded search of (L2), and a special over the curve variable is exactly where the implementation does not know them to be complete (I5); so it claims nothing. The certificate is nevertheless obtained by the theory of Part II by hand: , and , which under is , a differential on the genus-one curve with no finite poles. The pipeline, given this curve integrand, finds the fundamental unit (norm ), verifies that the integrand is residue-free, solves the exact system of Part I — there are no specials, and the one bound is proved — and reports not elementary (holomorphic remainder) in s; since elementary integrability descends along the algebraic extension , A39 has no elementary integral. FriCAS agrees, returning the integral unevaluated; AXIOM reports “cannot handle that integrand”. Charlwood lists A39 among the integrals “tested” without further comment.
5 Assessment of the implementation
The suite returned 49 verified integrals, one failure, and no wrong answer. An assessment is only useful if it separates a limitation of the implementation from a limitation of the theory and from a choice of policy, so we take the three in turn: the failure and the bounds behind the searches, the retry ladder, and the profile of a slow case.
Limitations
- (L1)
Completeness of the -units over a special of the curve variable (A39). The holomorphic-remainder certificate of Proposition 9.2(b) of Part II is implemented for every tower on which every bound in force is proved (I5) — for this is automatic, and the nested radical , not in the suite, is certified this way after the rescaling of Lemma 3.4 in Section 10.17 of Part II — but it also requires the logand candidates to be complete, and over a special prime of the curve variable the -units are produced by the bounded search of (L2), so the implementation withholds the certificate there. A39 is exactly this case, with every bound proved; on the curve, after the integration by parts of Section 4, there is no special and the unit group is known, which is why the certificate is available there. Deciding the -unit group over a finite set of places of the curve — a question on the Jacobian, of a genus-three curve in A39 — or automating the reduction to the curve for a primitive top generator would turn A39’s “failed” into a certificate.
- (L2)
The search bounds. The norm search over a special is bounded to , and four generators per special; the joint search to , ; the realisation of a residue class in the residue field (I4) to . These are the guessed inputs of the -unit computation, with the same status as the special exponents and degree bounds at the places Algorithm 6 of Part II leaves undecided — in the suite, a special over the curve variable in twelve integrals (I5). Problem 4 shows a case where the units over do not suffice but the units over the splitting field of the special do.
The retry ladder and the cost of the conic cases
Five integrals of the suite — P4, the slowest with Problem 8, then A2, A3, A1 and A16 — are conic towers whose answer needs the specials split over , and in every one of them the rungs after the first are two fifths to a half of the time: two more attempts over in the -tower, where the exponent of the special over the curve variable is a guess and is raised, the parametrisation, one attempt in the -tower, where every bound is proved, and only then the split. The policy “parametrise a conic before doing anything over ” was chosen in Part II so that genus-zero problems are solved as transcendental ones. The obvious alternative is to allow the split in the base run, and the code has it as an experiment (split_first, off by default). Measured on the same machine, it is not an improvement:
| A1 | P4 | A2 | A3 | A16 | |
|---|---|---|---|---|---|
| default ladder (s) | 1.3 | 6.2 | 3.6 | 3.1 | 1.4 |
| split first (s) | 1.1 | 23.9 | 10.6 | 10.4 | 2.1 |
A1 is solved in the original tower in less time, with better logands ( and in place of with ), and A16 in the original tower too, but more slowly, the eight norm searches over costing twice as much as the parametrisation and the two rungs in the -tower they replace; and for P4, A2 and A3 the split specials are the linear factors of a quartic, the -unit search over each of them runs over or , and the sixteen norm searches alone (eight seconds) cost more than the whole default ladder on P4 and two to three times as much as it on A2 and A3; on P4 the sixteen -unit columns over the splitting field, two fields of degree sixteen among them, then cost half as much again as the searches. The parametrisation is doing real work in those cases: over the same logands are with no -unit search at all. We therefore leave the default as it is. What the experiment shows is that the cost is in the norm search — the one nonlinear step, and the one still done in the generic expression layer — and in the arithmetic over the splitting field that the split forces, and that a reordering of the ladder is not the remedy.
Where the time goes
The first version of the implementation spent three quarters of its time in the linear system: the columns were formed as expressions, the equations were read off by constructing a polynomial whose coefficients were linear forms in the unknowns, the solution was checked by substituting it into every equation and simplifying, and the rational part was cancelled as an expression; with algebraic constants every one of these operations re-derived the number field or ran the simplifier’s assumption queries on nested radicals, and the suite took s, A1 alone s. Moving the system into one number field (I3) brought the suite to s without changing a result; computing the once-per-integrand analysis of Algorithm 4 once instead of once per rung, and moving the tower arithmetic, the realisation of residue classes and the torsion arithmetic into the same field, brought it to 68 s, with a median of 0.6 s, more than half of the integrals under a second, and Günther’s integral of Part II — six residue classes of order six on a CM curve, whose Miller functions had cost s of zero tests by simplification — in five seconds. The degree bounds at every place (I5) then cut the ansätze to less than a third of their size — unknowns over the suite in place of , and rungs in place of — without moving the total: the row reductions had already become about a second of it, and what the shorter ladders save on the conic towers is spent on the analysis of the places.
What remains is best seen on Problem 4 (6.2 s). A fifth of the time is the -unit search over the quartic special — a nonlinear solve for over , now done once; another fifth is the first attempt in the -tower, where the four columns with coefficients in are computed and the field is built; the two further attempts with the raised exponent cost four tenths of a second together, since they reuse everything but the system, the parametrisation and the analysis of the places of the -tower half a second, and the one attempt in the -tower a tenth; a quarter is the split rung — the field of degree sixteen, the six special columns over it, and a row reduction of half a second; and the verification by differentiation is the rest. Problem 8, as slow as Problem 4, is the norm search over , the construction of three nested fields of degree sixteen and the columns over them, in three nearly equal parts; A35 is the two fields of degree sixteen and the eight special columns of its split rung, and a second of verification; A27 spends two and a half of its seconds on the four residue-class realisations, six tenths each, and one on the residue classes themselves; of the remaining slow integrals, A28, A29 and A37 are the norm search again — the joint search over , the search over , the searches over two quadratics — for three quarters to nine tenths of their time, and A40 is the first two items of Problem 4 without the ladder. The costs are therefore, in order: the norm search, the last operation of the implementation in SymPy’s generic expression layer and a nonlinear one; the primitive element of a nested field, which SymPy computes once per field; and the ladder itself, the open question of the guessed inputs, which the theory does not settle. None of these is a heuristic, and none is in the present code.
6 Comparison with the Risch–Trager–Bronstein integrator
FriCAS and AXIOM share the integrator written by Bronstein for AXIOM in the late 1980s — the recursive algorithm of [2] for mixed towers, with Trager’s algorithm for the algebraic layers — but not the same version of it: in FriCAS the implementation of the Risch–Trager–Bronstein algorithms has been substantially improved by Waldek Hebisch [5], and the AXIOM build of 2014 is the code without that work. The difference between the two columns of Table 1 — twelve errors and three wrong answers against none — is a measure of it. The comparison is therefore between a design thirty-five years old, continuously developed in FriCAS, and a prototype of the parallel method written to accompany a theory paper. Three things are being compared: the answers, the reach, and the time.
Answers. Every FriCAS answer to an integral it evaluated passes the differentiation test, in SymPy, at the same points and precision as ours (Section 2.3); its own numerical evaluator does not (Problem 8), which is a reminder that “verified by the system” and “verified” are different things. AXIOM’s 2014 build returns three wrong answers (A2, A3, A32) — two by a branch of the arctangent, whose derivatives differ from the integrand by and by on the real domain, and one (A32) by an error that no branch choice repairs — and two (Problem 7, A34) that are correct only after the sign of an algebraic kernel is flipped, i.e. under the opposite branch of the square root from the one the expression displays. The parallel method returned no wrong answer; this is not a virtue of the method but of the protocol — every returned integral is differentiated and checked before it is returned, and the price is paid in seconds (Section 5). In form, FriCAS’s answers are sometimes the most compact of the three (Problem 5: a single arctangent; Problem 7: a single logarithm) and sometimes enormous (Problem 8, three thousand characters with nested radicals of ; A35 likewise); the parallel method’s answers are compact in the tower coordinates and inherit the artefacts of the Euler parametrisation when returned to .
Reach. FriCAS evaluates 49 of the fifty and returns A39 unevaluated, which is correct, since A39 is not elementary; FriCAS does not, in its output, distinguish a proof of non-elementarity from a case its implementation does not cover, and the certificate for A39 in Section 4 is, to our knowledge, the first explicit one. AXIOM evaluates 35; it reports “cannot handle that integrand” on ten (P3, P9, A5–A7, A11, A12, A25, A31, A39) and “implementation incomplete (residue poly has multiple non-linear factors)” on A27 and A35 — the residue polynomial of the recursive algorithm is the one of (I4), and a residue polynomial with several non-linear factors is exactly a residue divisor over primes of high degree; FriCAS has closed both gaps since 2014. The parallel method evaluates 49: everything FriCAS evaluates, and it certifies nothing FriCAS does not.
Time. FriCAS needs about a tenth of a second per integral — its median is 0.1 s — with two exceptions: Problem 3 (52.8 s), where the two square roots and form an algebraic extension of degree four that Trager’s algorithm handles as such, and A35 (7.7 s); the two are most of its total of 67 s and lift its mean to 1.3 s. The parallel method needs 68 s for the suite; the median is 0.6 s, more than half of the fifty take under a second, the mean of 1.4 s is dominated by the norm searches and the conic ladders discussed in Section 5, and the slowest, P4 and P8, take 6.2 and 7.0 s. On the two integrals that are slow for FriCAS the comparison inverts: Problem 3 is 2.0 s for the parallel method — two thirds of it the verification of the answer by differentiation — because flattening and the Euler parametrisation remove both radicals before the integrator starts, and A35 is 4.1 s against 7.7 s. AXIOM’s times are close to FriCAS’s where it succeeds, and it spends 173.7 s on Problem 3 before failing.
The comparison should not be read as a race. FriCAS’s integrator is complete for the class it implements, and its speed comes from Hermite reduction, resultants and integral bases in a compiled language; the parallel method has no integral bases, no Puiseux expansions and no recursion, and its cost is concentrated in the nonlinear norm search and in the arithmetic of the number fields, not in the linear system, whose size is set by degree bounds proved at every place on most of the suite. What the suite establishes is that the mechanisms of Part II — the classification of primes, the -units over the specials, the units of the curve, torsion, the canonical residues — are the right primitives for this class of integrals: every integral in Charlwood’s list that has an elementary integral is reached by them, and the one that has none is certified by them.
7 Conclusion
Charlwood’s fifty integrals were assembled to embarrass computer algebra systems, and in 2008 they did; today FriCAS does all but the non-elementary one in a few seconds, and the parallel method of Part II, in a SymPy prototype, does all but the non-elementary one, in a little over a minute in all, with certificates where the theory has them. The suite was more useful as an audit than as a contest. It shows the mechanisms of Part II — the -units over the specials, the units of the curve, torsion, the canonical residues at Hermite-order poles, the joint realisation of a residue divisor, the residue classes of a prime of degree eight — reaching every elementary integral in the list; it shows the degree bounds of Part II at every place proved on every rung for thirty-eight of the fifty, cutting the ansätze to a third of the size the classical guess gives them and the ladders to what the guesses that remain require; it identifies, once the arithmetic had been moved into one number field per tower and the once-per-integrand analysis computed once, the norm search for the -units, the primitive elements of nested number fields and the retry ladder itself as the sources of most of the remaining running time, with an experiment that shows what a reordering of the ladder buys and why the policy stands; and it leaves one well-defined piece of work — the completeness of the -units over a special prime of the curve variable, which alone separates A39’s “failed” from a certificate — as the next milestone. It also produced, as a by-product, the observation that a benchmark answer is only as good as the verification behind it: one of the three systems compared returned wrong answers on three of the fifty, and another’s own numerical evaluation of a correct answer was wrong.
Data availability
The scripts charlwood.py (the suite), cas_compare.py and cas_verify.py (FriCAS and AXIOM), charlwood_report.py (the table), charlwood_paper_check.py (every formula displayed above) and the result files (charlwood_results.json, charlwood_fricas.json, charlwood_axiom.json, and charlwood_results_splitfirst.json for the experiment of Section 5) are provided with the paper, together with parallel_mixed.py and build_tower.py and with weier.py of Part III, which the division-polynomial torsion orders import; the suite of Part II (examples.py) passes with these modules. All of these files are available in the repository https://github.com/stblake/parallel_integrate_mixed.
References
- [1] AXIOM: The Scientific Computation System, http://axiom-developer.org; version of August 2014.
- [2] M. Bronstein, Integration of elementary functions, J. Symbolic Comput. 9 (1990) 117–173.
- [3] M. Bronstein, Symbolic Integration I: Transcendental Functions, 2nd ed., Springer, 2005.
- [4] K. Charlwood, Integration on computer algebra systems, Electronic Journal of Mathematics and Technology 2 (2008), no. 3, 291–301.
- [5] FriCAS Computer Algebra System, https://fricas.github.io; version 1.3.6.
- [6] S. Blake, Parallel integration over simple radical extensions, https://arxiv.org/abs/2608.29482.
- [7] S. Blake, Parallel integration over simple radical extensions II: mixed towers, https://arxiv.org/abs/2609.13643.
- [8] A. D. Rich, P. Scheibe, N. Abbasi, Rule-based integration: an extensive system of symbolic integration rules, J. Open Source Software 3 (2018) 1073.