lunes, 24 de noviembre de 2025

Benchmarking USM Transform #3 vs. Mathematica’s Integrate - Part 2

In these tables we benchmark the Unified Substitution Method (USM) change of variables that this arXiv draft calls Transformation 3 (this is the “Transform 1” used in the Mathematica code: see this notebook): a half-angle substitution that converts integrals built from tan(½ csc⁻¹((x+b)/a)) and tan(½ sec⁻¹((x+b)/a)) into a rational integrand in a new variable t. The general transformation formula is

$$\int f\!\left[x,\,\tan\left(\tfrac12\csc^{-1}\left(\frac{x+b}{a}\right)\right),\,
\tan\left(\tfrac12\sec^{-1}\left(\frac{x+b}{a}\right)\right)\right]\,dx=
\int f\!\left(a\,\frac{t^{2}+1}{2t} - b,\, t,\, \frac{1-t}{1+t}
\right)\, a\,\frac{t^{2}-1}{2t^{2}}\,dt.\tag{1}$$


For each integrand in the 10 datasets, we compare Transform 1 + back-substitution against Mathematica’s Integrate by timing both methods (total t-USM time, split into the y≥1 and y≤−1 branches, versus Integrate time) and by measuring the structural size of the resulting antiderivatives (LeafCnt and ByteCnt for USM and for Integrate). The integrands are systematically built from tan(½ arccsc(…)) and tan(½ arcsec(…)), with powers, factors of x, x², x³, and rational combinations such as 1/(1+tan²(…)) and products of the two half-angle tangents, so the benchmark probes exactly the niche Transform 1 is designed for, from simple to highly intricate cases. Overall, the data show that on many of the “hard” mixed cases USM is much faster (often by an order of magnitude) while producing antiderivatives of comparable or smaller complexity; on very simple, pattern-friendly integrands Integrate can be faster because USM has a fixed overhead; and across the full test family USM timings are more predictable, with the y≥1 / y≤−1 branch split adding only modest extra cost. In short, Transform 1 is a robust, domain-specific integrator for these arccsc/arcsec tan-half-angle families: it typically yields simpler or similar antiderivatives and large speedups on difficult examples, at the price of some overhead on the easy ones. 

Conclusions from the benchmark

1. On many “hard” mixed cases, Transform 1 is much faster than Integrate.

In datasets like 3, 5, 7, and 8 (the ones with products and rational combinations of both arccsc and arcsec half-angle tangents), Integrate often takes from a few tenths of a second up to several seconds, while t-USM usually stays in the tens to low hundreds of milliseconds.

In some individual examples we get around one order of magnitude speedup: Integrate is in the 1–10 second range while t-USM is still below about 0.2 seconds.

⇒ For structurally complicated expressions in this class, the Transform 1 route is clearly advantageous.

2. On simple or pattern-friendly cases, Integrate can be faster than Transform 1.

In datasets like 1, 4, 9, and 10, several examples have Integrate times of just a few milliseconds, while t-USM has a relatively fixed overhead (often between about 0.02 and 0.06 seconds).

In those cases, Mathematica recognizes a very simple pattern (such as standard tan or rational trig identities) and wins on raw speed.

⇒ Our transform has a nontrivial constant overhead. It shines when the problem is hard for Integrate, but cannot beat Mathematica’s near-instant pattern match on the easy ones.

3. Runtime variability vs. predictability

Integrate is highly variable: sometimes extremely fast, sometimes very slow, even for similar-looking integrands in the same dataset.

t-USM is more stable: most examples sit in a narrow time band, with far fewer extreme slowdowns.

⇒ Transform 1 gives more predictable performance over this whole integrand family, whereas Integrate is opportunistically very fast but with occasional expensive spikes.

4. Result size and complexity stay comparable and reasonable.

The leaf and byte counts show that:

USM antiderivatives are usually similar or somewhat larger in size compared to Integrate’s results, reflecting the mechanical tan-substitution and back-substitution.

There is no systematic explosion in size: the USM expressions stay in the same general range as the ones produced by Integrate.

⇒ From a “how big and messy is the final formula?” standpoint, Transform 1 is competitive and practical, even if it does not always find the most compact form that Integrate sometimes can.

5. The y >= 1 / y <= -1 split is reasonable and not a major cost.

The USM y>=1 and USM y<=-1 times are usually of the same order, with the y >= 1 branch often a bit slower but not dramatically.

Summing them to get t–USM total time roughly doubles the branch time, but that combined cost is still modest compared with the multi-second peaks seen in Integrate.

⇒ The branch-based back-substitution strategy works well in practice and does not dominate the runtime.

Some more specific details
  • USM total time was faster than Integrate in 82 cases.
  • USM produced a simpler antiderivative (smaller ByteCnt) than Integrate in exactly 50 cases.
  • “Monster” antiderivatives (ByteCnt >= 10,000) occurred 5 times for USM and 24 times for Integrate.
  • The largest ByteCnt observed for a USM antiderivative was 19,840, compared with 150,360 for Integrate.

No hay comentarios:

Publicar un comentario