lunes, 26 de mayo de 2025

USM Transform #3 vs. Mathematica Integrate

Warning: The 19-example table is an eye-catching demo, but it is not large or diverse enough to qualify as a “representative” benchmark in the usual software-testing sense. It convincingly illustrates Transform 3’s strengths on its target family—integrals built from $\tan\bigl(\tfrac12\operatorname{arcsec/arccsc}(\cdots)\bigr)$—yet it is too small for reliable statistics and too narrow to say much about performance outside that niche.

USM Transform 3 is described in the draft paper “A Unified Substitution Method for Integration”.

All raw timings and expression statistics were taken verbatim from the diagnostic printouts in USMvsMMAfinal.pdf and USMvsMMAFinal2.pdf . See also the notebooks here and here

How to read the table

  • MMA time – wall-clock seconds for Integrate[…] on the original integrand (labeled Direct time in the notebook).

  • USM timesingle figure obtained by adding:

    • parameter-extraction time +

    • conversion ( x → t ) time +

    • USM-upper-branch integration time +

    • USM-lower-branch integration time

  • LeafCnt / ByteCnt – Mathematica’s LeafCount and ByteCount of the returned antiderivative.

  • Any USM entry that beats Mathematica (smaller value) is red bold-faced.

$$\begin{array}{r|r|r|r|r|r|r}\# & \text{MMA time (s)} & \text{USM time (s)} & \text{MMA LeafCnt} & \text{USM LeafCnt (lo--up)} & \text{MMA ByteCnt} & \text{USM ByteCnt (lo--up)}\\\hline1 & 0.0031 & 0.0283 & 311 & \mathbf{\color{red}{92\text{--}96}} & 9920 & \mathbf{\color{red}{2840\text{--}2984}}\\2 & 1.1700 & \mathbf{\color{red}{0.0026}} & 295 & \mathbf{\color{red}{76\text{--}84}} & 9208 & \mathbf{\color{red}{2256\text{--}2544}}\\3 & 6.1800 & \mathbf{\color{red}{0.0025}} & 8962 & \mathbf{\color{red}{64\text{--}72}} & 283576 & \mathbf{\color{red}{1928\text{--}2216}}\\4 & 0.2580 & \mathbf{\color{red}{0.0018}} & 85 & \mathbf{\color{red}{66\text{--}74}} & 2768 & \mathbf{\color{red}{1960\text{--}2248}}\\5 & 0.0113 & \mathbf{\color{red}{0.0098}} & 23 & 32\text{--}36 & 680 & 984\text{--}1128\\6 & 0.0268 & \mathbf{\color{red}{0.0225}} & 40 & 62\text{--}66 & 1248 & 1888\text{--}2032\\7 & 0.2130 & \mathbf{\color{red}{0.0015}} & 57 & \mathbf{\color{red}{47\text{--}53}} & 1808 & \mathbf{\color{red}{1416\text{--}1632}}\\8 & 19.2000& \mathbf{\color{red}{8.1960}} & 325 & \mathbf{\color{red}{250\text{--}278}} & 9984 & \mathbf{\color{red}{7368\text{--}8376}}\\9 & 2.1300 & \mathbf{\color{red}{0.0262}} & 193 & \mathbf{\color{red}{63\text{--}71}} & 6216 & \mathbf{\color{red}{1960\text{--}2248}}\\10 & 4.5200 & \mathbf{\color{red}{0.0274}} & 151 & \mathbf{\color{red}{90\text{--}102}} & 4720 & \mathbf{\color{red}{2736\text{--}3168}}\\11 & 0.0120 & \mathbf{\color{red}{0.0015}} & 58 & \mathbf{\color{red}{42\text{--}46}} & 1776 & \mathbf{\color{red}{1288\text{--}1432}}\\12 & 0.0146 & \mathbf{\color{red}{0.0016}} & 158 & \mathbf{\color{red}{49\text{--}53}} & 4880 & \mathbf{\color{red}{1440\text{--}1584}}\\13 & 0.0122 & \mathbf{\color{red}{0.0112}} & 39 & 44\text{--}48 & 1240 & 1360\text{--}1504\\14 & 0.2250 & \mathbf{\color{red}{0.0023}} & 106 & \mathbf{\color{red}{62\text{--}68}} & 3312 & \mathbf{\color{red}{1888\text{--}2104}}\\15 & 0.0154 & \mathbf{\color{red}{0.0018}} & 47 & \mathbf{\color{red}{43\text{--}47}} & 1448 & \mathbf{\color{red}{1312\text{--}1456}}\\16 & 6.0500 & \mathbf{\color{red}{0.0357}} & 456 & \mathbf{\color{red}{332\text{--}360}} & 13976 & \mathbf{\color{red}{9960\text{--}10968}}\\17 & 0.0068 & 0.0220 & 308 & \mathbf{\color{red}{85\text{--}93}} & 9720 & \mathbf{\color{red}{2608\text{--}2896}}\\18 & 1.0500 & \mathbf{\color{red}{0.0041}} & 524 & \mathbf{\color{red}{109\text{--}117}} & 16272 & \mathbf{\color{red}{3232\text{--}3520}}\\19 & 9.3900 & \mathbf{\color{red}{0.0933}} & 19148 & \mathbf{\color{red}{129\text{--}139}} & 600840 & \mathbf{\color{red}{3880\text{--}4240}}\\\end{array}$$

Interpreting the numbers

  • LeafCount (Lower--Upper) counts the total nodes in Mathematica’s expression tree; ByteCount (Lower--Upper) measures the memory footprint in bytes. Both are crude but serviceable proxies for “formula complexity”. Lower values signal more compact, and usually more readable, antiderivatives.

  • USM total time is purposely holistic: the tiny setup overhead (parameter extraction + conversion) is included together with the actual integration of both branches, so a reader sees the real end-to-end cost of calling the transform.

  • Why two branches? Transform 3 generates an “upper” and a “lower” substitution dictated by the radical’s sign conventions; the faster of the two could in principle be chosen automatically, but here both were timed and summed for fairness.

Average speed-up

$$\begin{array}{r|r|r|r}\# & \text{MMA time (s)} & \text{USM time (s)} & \text{Speed-up} \\\hline1 & 0.0031 & 0.0283 & 0.11 \\2 & 1.1700 & \mathbf{\color{red}{0.0026}} & 450 \\3 & 6.1800 & \mathbf{\color{red}{0.0025}} & 2472 \\4 & 0.2580 & \mathbf{\color{red}{0.0018}} & 143 \\5 & 0.0113 & \mathbf{\color{red}{0.0098}} & 1.15 \\6 & 0.0268 & \mathbf{\color{red}{0.0225}} & 1.19 \\7 & 0.2130 & \mathbf{\color{red}{0.0015}} & 142 \\8 & 19.2000& \mathbf{\color{red}{8.1960}} & 2.34 \\9 & 2.1300 & \mathbf{\color{red}{0.0262}} & 81.3 \\10 & 4.5200 & \mathbf{\color{red}{0.0274}} & 165 \\11 & 0.0120 & \mathbf{\color{red}{0.0015}} & 8.0 \\12 & 0.0146 & \mathbf{\color{red}{0.0016}} & 9.13 \\13 & 0.0122 & \mathbf{\color{red}{0.0112}} & 1.09 \\14 & 0.2250 & \mathbf{\color{red}{0.0023}} & 97.8 \\15 & 0.0154 & \mathbf{\color{red}{0.0018}} & 8.56 \\16 & 6.0500 & \mathbf{\color{red}{0.0357}} & 170 \\17 & 0.0068 & 0.0220 & 0.31 \\18 & 1.0500 & \mathbf{\color{red}{0.0041}} & 256 \\19 & 9.3900 & \mathbf{\color{red}{0.0933}} & 101 \\\end{array}$$

Using the arithmetic mean of the 19 speed-up values


$$\text{speed-up}_i \;=\;\frac{\text{MMA time}_i}{\text{USM time}_i},$$

the average speed-up is


$$\boxed{\displaystyle \overline{\text{speed-up}}\;=\;216.3\ (\text{approximately})}.$$

Take-aways

  • Speed advantage – USM outruns built-in Integrate on 17 / 19 examples, sometimes spectacularly (Ex 3 is > 2000× faster). Only the Ex 1 and Ex 17 favour MMA on raw time. However, for these two examples USM gave much simpler antiderivatives.

  • Compact answers – In 16 / 19 cases the USM result is much smaller (LeafCount & ByteCount). The gains are eye-catching for the hardest problems: Ex 3 shrinks from 8 962 leaves to 64--72, and Ex 19 from 19 148 to 129--139.

  • Overhead is negligible – Parameter extraction and x ⁣ ⁣tx\!\to\!t conversion stay in the micro-second realm; almost all of the USM total is the symbolic integration itself, yet seldom exceeds a few hundredths of a second.

Bottom line: On this mixed radical-inverse-trig mini-benchmark, the USM (Transform 3) consistently yields faster and simpler antiderivatives than Mathematica’s built-in integrator.

No hay comentarios:

Publicar un comentario