# "Simple" integral with very long, complicated value

Part of the value of symbol-manipulation programs such as Mathematica is that even extremely complicated problems—ones beyond computation "by hand"—can be addressed.

I'm seeking some examples (from integration) where a short (or "simple") indefinite integration problem leads to a "very long and complicated" result. One useful surrogate measure for the complexity of a problem and its solution are the number of bytes in its expression. Another is the LeafCount. (Use whichever you prefer.)

So what problem/solution pair has the greatest ratio of the number of such bytes?

The best I've found is:

Integrate[(x^2 ArcTan[x^2])/(1+x^2),x] //FullSimplify


which has a LeafCount = 17 and the solution a LeafCount = 1088.

Are there any more-extreme examples?

(x - ArcTan[x])*ArcTan[x^2] + (2*Sqrt[2]*ArcTan[1 - Sqrt[2]*x] -
Pi*ArcTan[1 - Sqrt[2]*x] - 2*Sqrt[2]*ArcTan[1 + Sqrt[2]*x] -
Pi*ArcTan[1 + Sqrt[2]*x] + 2*ArcCos[-Sqrt[2]]*
ArcTan[(-1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] -
2*ArcCos[Sqrt[2]]*ArcTan[(1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] -
(Pi - 4*ArcTan[x])*ArcTan[(-1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]] +
(Pi - 4*ArcTan[x])*ArcTan[(1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]] -
Sqrt[2]*Log[1 - Sqrt[2]*x + x^2] + Sqrt[2]*Log[1 + Sqrt[2]*x + x^2] +
I*(ArcCos[Sqrt[2]] - 2*ArcTan[(1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]])*
Log[(Sqrt[2]*(1 - I*Cot[Pi/4 + ArcTan[x]]))/(-1 + Sqrt[2] +
I*Cot[Pi/4 + ArcTan[x]])] -
I*(ArcCos[-Sqrt[2]] + 2*ArcTan[(-1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]])*
Log[(Sqrt[2]*(1 + I*Cot[Pi/4 + ArcTan[x]]))/(1 + Sqrt[2] +
I*Cot[Pi/4 + ArcTan[x]])] +
I*(ArcCos[Sqrt[2]] + 2*ArcTan[(1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]])*
Log[((-I)*(-2 + Sqrt[2])*(-I + Cot[Pi/4 + ArcTan[x]]))/
(-1 + Sqrt[2] + I*Cot[Pi/4 + ArcTan[x]])] -
I*(ArcCos[-Sqrt[2]] - 2*ArcTan[(-1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]])*
Log[(I*(2 + Sqrt[2])*(I + Cot[Pi/4 + ArcTan[x]]))/(1 + Sqrt[2] +
I*Cot[Pi/4 + ArcTan[x]])] -
I*(ArcCos[Sqrt[2]] + 2*ArcTan[(1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] +
2*ArcTan[(-1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]])*
Log[(1/2 + I/2)/(E^(I*ArcTan[x])*Sqrt[Sqrt[2] - Sin[2*ArcTan[x]]])] -
I*(ArcCos[Sqrt[2]] - 2*ArcTan[(1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] -
2*ArcTan[(-1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]])*
Log[((1/2 - I/2)*E^(I*ArcTan[x]))/Sqrt[Sqrt[2] - Sin[2*ArcTan[x]]]] +
I*(ArcCos[-Sqrt[2]] + 2*ArcTan[(-1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] +
2*ArcTan[(1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]])*
Log[(-1/2 + I/2)/(E^(I*ArcTan[x])*Sqrt[Sqrt[2] + Sin[2*ArcTan[x]]])] +
I*(ArcCos[-Sqrt[2]] - 2*ArcTan[(-1 + Sqrt[2])*Cot[Pi/4 + ArcTan[x]]] -
2*ArcTan[(1 + Sqrt[2])*Tan[Pi/4 + ArcTan[x]]])*
Log[((1/2 + I/2)*E^(I*ArcTan[x]))/Sqrt[Sqrt[2] + Sin[2*ArcTan[x]]]] -
PolyLog[2, -(((-1 + Sqrt[2])*(-1 + Sqrt[2] - I*Cot[Pi/4 + ArcTan[x]]))/
(-1 + Sqrt[2] + I*Cot[Pi/4 + ArcTan[x]]))] +
PolyLog[2, -(((1 + Sqrt[2])*(-1 + Sqrt[2] - I*Cot[Pi/4 + ArcTan[x]]))/
(-1 + Sqrt[2] + I*Cot[Pi/4 + ArcTan[x]]))] +
PolyLog[2, ((-1 + Sqrt[2])*(1 + Sqrt[2] - I*Cot[Pi/4 + ArcTan[x]]))/
(1 + Sqrt[2] + I*Cot[Pi/4 + ArcTan[x]])] -
PolyLog[2, ((1 + Sqrt[2])*(1 + Sqrt[2] - I*Cot[Pi/4 + ArcTan[x]]))/
(1 + Sqrt[2] + I*Cot[Pi/4 + ArcTan[x]])])/4

• A useful surrogate measure for the complexity of a problem and its solution are the number of bytes in its expression actually LeafCount is the recommended way to measure size of expression. That is also what is used by Simplify as default. Nov 20, 2022 at 5:39
• Sure.... I like that too and will update my posting. Nov 20, 2022 at 6:05
• With Rubi and FullSimplify I have LeafCount with about 461. Nov 20, 2022 at 9:47

From your example, the leafCount of the integrand is 15 and that for the anti is 1088. So that is ratio of 72.

Using my integrals database, I issued SQL to find these integrals which Mathematica 13.1 generated anti-derivative/integrand ratio > 70.

There are 1,289 such integrals. Since this list is too large to post here, I changed the factor to 100 and that reduces it to 889. This is still too large to post here. So I changed the factor to 200 and that reduced the number of integrals to 474. This is still too large to post here. So I changed the factor to 500, and now the number went down to 182. That is still too large.

Finally I changed it to factor of 1000, this gives 132 integrals. Here they are.

In each of these, the anti-derivative is over 1,000 larger than the integrand. This table gives the integrand and the ratio. This is sorted now. This shows that largest one is

Integrate[((c + d*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e +
f*x]^2))/(a + b*Tan[e + f*x])^(9/2),x]


Which generated anti-derivative 55,498 as large !

Note that no simplification is made on results. (this is how the tests I run are all done)

## List of integrals

First entry in each line is the magnification ratio, second is the type of integral, and the third is the integral itself.

{1014.76, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(3/2),x]}
{1055.1081081081081, "Trig_functions/Secant", Integrate[Sec[e + f*x]^2/(Sqrt[a + b*Sec[e + f*x]]*Sqrt[c + d*Sec[e + f*x]]),x]}
{1064.6285714285714, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(3/2)*Sqrt[a + b*Sec[c + d*x]]),x]}
{1065.8, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{1070.2571428571428, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]^3/Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{1089.1935483870968, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[(Sqrt[f + g*x]*Sqrt[a + b*x + c*x^2])/(d + e*x)^3,x]}
{1136.9354838709678, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[(Sqrt[f + g*x]*Sqrt[a + b*x + c*x^2])/(d + e*x),x]}
{1169.3333333333333, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Sqrt[Cos[c + d*x]]*Sqrt[a + b*Sec[c + d*x]]),x]}
{1181.1935483870968, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[Sqrt[a + b*x + c*x^2]/((d + e*x)^3*Sqrt[f + g*x]),x]}
{1181.741935483871, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[Sqrt[f + g*x]/((d + e*x)^3*Sqrt[a + b*x + c*x^2]),x]}
{1197.967741935484, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[(f + g*x)^(5/2)/((d + e*x)*Sqrt[a + b*x + c*x^2]),x]}
{1219.8695652173913, "Trig_functions/Secant", Integrate[Sec[c + d*x]^4*(a + b*Sec[c + d*x])^(5/3),x]}
{1226.6521739130435, "Trig_functions/Sine", Integrate[(d*Csc[e + f*x])^n*(a + a*Sin[e + f*x])^3,x]}
{1239.4761904761904, "Trig_functions/Sine", Integrate[Sec[c + d*x]^5*(a + a*Sin[c + d*x])^m,x]}
{1251.5777777777778, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{1263.3142857142857, "Trig_functions/Secant", Integrate[(Sec[e + f*x]*Sqrt[a + b*Sec[e + f*x]])/Sqrt[c + d*Sec[e + f*x]],x]}
{1303.0967741935483, "Algebraic_functions/Trinomial_products/Quadratic", Integrate[1/((d + e*x)^3*Sqrt[f + g*x]*Sqrt[a + b*x + c*x^2]),x]}
{1307.4, "Trig_functions/Tangent/", Integrate[1/(Tan[c + d*x]^(1/3)*Sqrt[a + b*Tan[c + d*x]]),x]}
{1313.0857142857142, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x]),x]}
{1344.2727272727273, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]/Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{1354.2380952380952, "Trig_functions/Sine", Integrate[Sin[c + d*x]^2*(a + a*Sin[c + d*x])^n,x]}
{1373.04, "Trig_functions/Secant", Integrate[1/(Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{1376.7241379310344, "Trig_functions/Secant", Integrate[Sqrt[a + b*Sec[e + f*x]]*Sqrt[c + d*Sec[e + f*x]],x]}
{1405.4666666666667, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(3/2)),x]}
{1417.4, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x]),x]}
{1436.5333333333333, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*Sqrt[a + b*Sec[c + d*x]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{1441.7333333333333, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(7/2)*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{1454.88, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(5/2),x]}
{1469.48, "Trig_functions/Secant", Integrate[(a + b*Sec[c + d*x])^(3/2)/Cos[c + d*x]^(3/2),x]}
{1477.76, "Trig_functions/Secant", Integrate[1/(Cos[c + d*x]^(7/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{1502.942857142857, "Trig_functions/Secant", Integrate[(Sqrt[a + b*Sec[c + d*x]]*(A + B*Sec[c + d*x]))/Sqrt[Cos[c + d*x]],x]}
{1520.225806451613, "Logarithms", Integrate[Log[e*(f*(a + b*x)^p*(c + d*x)^q)^r]^2/(g + h*x)^4,x]}
{1645.6285714285714, "Trig_functions/Tangent", Integrate[Tan[d + e*x]^5/(a + b*Tan[d + e*x]^2 + c*Tan[d + e*x]^4)^(3/2),x]}
{1674.423076923077, "Algebraic_functions/Trinomial_products", Integrate[1/((d + e*x^n)*(a + b*x^n + c*x^(2*n))^3),x]}
{1776.8444444444444, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{1820.7058823529412, "Trig_functions/Miscellaneous", Integrate[1/Sqrt[-Sqrt[b^2 + c^2] + b*Cos[d + e*x] + c*Sin[d + e*x]],x]}
{1845.0857142857142, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]^3/Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{1878.892857142857, "Hyperbolic_functions/Miscellaneous", Integrate[1/Sqrt[-Sqrt[b^2 - c^2] + b*Cosh[x] + c*Sinh[x]],x]}
{1889.84, "Trig_functions/Sine", Integrate[Sin[c + d*x]^5/Sqrt[a + b*Sin[c + d*x]^4],x]}
{1902.3142857142857, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x]),x]}
{1923.1555555555556, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{1977., "Trig_functions/Miscellaneous", Integrate[1/Sqrt[Sqrt[b^2 + c^2] + b*Cos[d + e*x] + c*Sin[d + e*x]],x]}
{2052.92, "Trig_functions/Secant", Integrate[1/(Cos[c + d*x]^(7/2)*Sqrt[a + b*Sec[c + d*x]]),x]}
{2054., "Trig_functions/Sine", Integrate[Sin[c + d*x]*Sqrt[a + b*Sin[c + d*x]^4],x]}
{2084.548387096774, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]/Sqrt[a + b*Cot[d + e*x] + c*Cot[d + e*x]^2],x]}
{2095.2, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x]),x]}
{2115.52, "Trig_functions/Secant", Integrate[(a + b*Sec[c + d*x])^(5/2)/Sqrt[Cos[c + d*x]],x]}
{2175.6153846153848, "Algebraic_functions/Trinomial_products", Integrate[1/((d + e*x^n)^2*(a + b*x^n + c*x^(2*n))^3),x]}
{2196.222222222222, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Cos[c + d*x]^(3/2)*Sqrt[a + b*Sec[c + d*x]]),x]}
{2225.114285714286, "Trig_functions/Secant", Integrate[(Sqrt[a + b*Sec[c + d*x]]*(A + B*Sec[c + d*x]))/Cos[c + d*x]^(3/2),x]}
{2225.9714285714285, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(5/2)*Sqrt[a + b*Sec[c + d*x]]),x]}
{2228.133333333333, "Trig_functions/Secant", Integrate[(Sqrt[a + b*Sec[c + d*x]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Sqrt[Cos[c + d*x]],x]}
{2267.8571428571427, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x]))/Sqrt[Cos[c + d*x]],x]}
{2477.9777777777776, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{2479.16, "Trig_functions/Secant", Integrate[(a + b*Sec[c + d*x])^(5/2)/Cos[c + d*x]^(3/2),x]}
{2663.5777777777776, "Trig_functions", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(5/2)),x]}
{2682.9333333333334, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{2734.114285714286, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{2751.3478260869565, "Trig_functions/Sine", Integrate[Csc[c + d*x]/Sqrt[a + b*Sin[c + d*x]^4],x]}
{2777.3714285714286, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x]),x]}
{2786.5142857142855, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(5/2)),x]}
{2854.3333333333335, "Trig_functions/Sine", Integrate[Sin[c + d*x]^3*(a + a*Sin[c + d*x])^n,x]}
{2874.511111111111, "Trig_functions/Secant", Integrate[Cos[c + d*x]^(3/2)*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{2916.6444444444446, "Trig_functions/Secant", Integrate[(Sqrt[a + b*Sec[c + d*x]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Cos[c + d*x]^(3/2),x]}
{2951.9777777777776, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Sqrt[Cos[c + d*x]],x]}
{2991.885714285714, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x]))/Cos[c + d*x]^(3/2),x]}
{3034.2571428571428, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x]))/Sqrt[Cos[c + d*x]],x]}
{3112.448275862069, "Trig_functions/Sine", Integrate[1/((a + b*Sin[e + f*x])^(3/2)*Sqrt[c + d*Sin[e + f*x]]),x]}
{3112.448275862069, "Trig_functions/Sine", Integrate[1/(Sqrt[a + b*Sin[e + f*x]]*(c + d*Sin[e + f*x])^(3/2)),x]}
{3259.7714285714287, "Trig_functions/Tangent", Integrate[Cot[c + d*x]^(3/2)*(a + b*Tan[c + d*x])^(3/2)*(A + B*Tan[c + d*x]),x]}
{3404.3076923076924, "Trig_functions/Sine", Integrate[(a + a*Sin[e + f*x])^m*(c - c*Sin[e + f*x])^2,x]}
{3480.0857142857144, "Trig_functions/Tangent", Integrate[((a + b*Tan[c + d*x])^(3/2)*(A + B*Tan[c + d*x]))/Tan[c + d*x]^(3/2),x]}
{3509.4666666666667, "Trig_functions/Secant", Integrate[Sqrt[Cos[c + d*x]]*(a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]}
{3574.96, "Trig_functions/Sine", Integrate[Sin[c + d*x]^3/Sqrt[a + b*Sin[c + d*x]^4],x]}
{3685.12, "Trig_functions/Secant", Integrate[1/(Cos[c + d*x]^(7/2)*(a + b*Sec[c + d*x])^(5/2)),x]}
{3731.6, "Trig_functions/Tangent", Integrate[Cot[c + d*x]^(5/2)*(a + b*Tan[c + d*x])^(5/2)*(A + B*Tan[c + d*x]),x]}
{3758.657142857143, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x]))/Cos[c + d*x]^(3/2),x]}
{3984.288888888889, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(3/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Cos[c + d*x]^(3/2),x]}
{3989.6, "Trig_functions/Tangent", Integrate[((a + b*Tan[c + d*x])^(5/2)*(A + B*Tan[c + d*x]))/Tan[c + d*x]^(5/2),x]}
{4000.7714285714287, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(7/2)*(a + b*Sec[c + d*x])^(3/2)),x]}
{4017.5333333333333, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Sqrt[Cos[c + d*x]],x]}
{4088.090909090909, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]^3/Sqrt[a + b*Cot[d + e*x] + c*Cot[d + e*x]^2],x]}
{4707.644444444444, "Trig_functions/Secant", Integrate[((a + b*Sec[c + d*x])^(5/2)*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/Cos[c + d*x]^(3/2),x]}
{4766.84, "Trig_functions/Sine", Integrate[Csc[c + d*x]^3/Sqrt[a + b*Sin[c + d*x]^4],x]}
{4782.114285714286, "Trig_functions/Tangent", Integrate[(A + B*Tan[c + d*x])/(Cot[c + d*x]^(3/2)*(a + b*Tan[c + d*x])^(3/2)),x]}
{4797.022222222222, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2)/(Cos[c + d*x]^(5/2)*(a + b*Sec[c + d*x])^(5/2)),x]}
{5078.6, "Trig_functions/Tangent", Integrate[(Tan[c + d*x]^(3/2)*(A + B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^(3/2),x]}
{5140.142857142857, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]^5/Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{5170.086956521739, "Trig_functions/Sine", Integrate[Csc[c + d*x]*Sqrt[a + b*Sin[c + d*x]^4],x]}
{5220.714285714285, "Trig_functions/Tangent", Integrate[Tan[d + e*x]^7/(a + b*Tan[d + e*x]^2 + c*Tan[d + e*x]^4)^(3/2),x]}
{5267.971428571429, "Trig_functions/Secant", Integrate[(A + B*Sec[c + d*x])/(Cos[c + d*x]^(7/2)*(a + b*Sec[c + d*x])^(5/2)),x]}
{5487.212121212121, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]/(a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4)^(3/2),x]}
{5620.257142857143, "Trig_functions/Tangent", Integrate[Cot[c + d*x]^(3/2)*(a + b*Tan[c + d*x])^(5/2)*(A + B*Tan[c + d*x]),x]}
{5632.540540540541, "Trig_functions/Sine", Integrate[Cos[e + f*x]^2/((a + a*Sin[e + f*x])^(3/2)*Sqrt[c + d*Sin[e + f*x]]),x]}
{5979.942857142857, "Trig_functions/Tangent", Integrate[((a + b*Tan[c + d*x])^(5/2)*(A + B*Tan[c + d*x]))/Tan[c + d*x]^(3/2),x]}
{6146.6, "Trig_functions/Cotangent", Integrate[Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4]*Tan[d + e*x]^3,x]}
{6939.848484848485, "Trig_functions/Secant", Integrate[Sec[e + f*x]/(Sqrt[a + a*Sec[e + f*x]]*(c + d*Sec[e + f*x])),x]}
{6957.714285714285, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]^7/(a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4)^(3/2),x]}
{7149.5142857142855, "Trig_functions/Tangent", Integrate[(A + B*Tan[c + d*x])/(Cot[c + d*x]^(5/2)*(a + b*Tan[c + d*x])^(5/2)),x]}
{7587.142857142857, "Trig_functions/Tangent", Integrate[(Tan[c + d*x]^(5/2)*(A + B*Tan[c + d*x]))/(a + b*Tan[c + d*x])^(5/2),x]}
{7688.379310344828, "Trig_functions/Sine", Integrate[(a + b*Sin[e + f*x])^(3/2)/Sqrt[c + d*Sin[e + f*x]],x]}
{7688.379310344828, "Trig_functions/Sine", Integrate[(c + d*Sin[e + f*x])^(3/2)/Sqrt[a + b*Sin[e + f*x]],x]}
{7875.586206896552, "Trig_functions/Sine", Integrate[Sqrt[a + b*Sin[e + f*x]]*Sqrt[c + d*Sin[e + f*x]],x]}
{8396.828571428572, "Trig_functions/Cotangentt", Integrate[Tan[d + e*x]^3/(a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4)^(3/2),x]}
{8674.60606060606, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]*Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{8848.371428571429, "Trig_functions/Sine", Integrate[Csc[e + f*x]/(Sqrt[a + a*Sin[e + f*x]]*Sqrt[c + d*Sin[e + f*x]]),x]}
{11783.828571428572, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]^3*Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{12674.65306122449, "Trig_functions/Tangent", Integrate[(Sqrt[c + d*Tan[e + f*x]]*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(3/2),x]}
{12675.183673469388, "Trig_functions/Tangent", Integrate[(Sqrt[a + b*Tan[e + f*x]]*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^(3/2),x]}
{14032.037037037036, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(3/2)*(c + d*Sec[e + f*x])),x]}
{14112.757575757576, "Trig_functions/Cotangent", Integrate[Sqrt[a + b*Cot[d + e*x] + c*Cot[d + e*x]^2]*Tan[d + e*x]^3,x]}
{15408.342857142858, "Trig_functions/Cotangent", Integrate[Cot[d + e*x]^5*Sqrt[a + b*Cot[d + e*x]^2 + c*Cot[d + e*x]^4],x]}
{15999.25925925926, "Trig_functions/Secant", Integrate[1/(Sqrt[a + a*Sec[e + f*x]]*(c + d*Sec[e + f*x])),x]}
{17532.777777777777, "Trig_functions/Secant", Integrate[1/(Sqrt[a + a*Sec[e + f*x]]*(c + d*Sec[e + f*x])^2),x]}
{18005.74074074074, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(5/2)*(c + d*Sec[e + f*x])),x]}
{18031., "Trig_functions/Cotangent", Integrate[Tan[d + e*x]/(a + b*Cot[d + e*x] + c*Cot[d + e*x]^2)^(3/2),x]}
{21578.51851851852, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(3/2)*(c + d*Sec[e + f*x])^2),x]}
{21908.14285714286, "Trig_functions/Tangent", Integrate[((a + b*Tan[e + f*x])^(3/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^(3/2),x]}
{21910.79591836735, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(3/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(3/2),x]}
{24235.48148148148, "Trig_functions/Secant", Integrate[1/(Sqrt[a + a*Sec[e + f*x]]*(c + d*Sec[e + f*x])^3),x]}
{25484.444444444445, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(5/2)*(c + d*Sec[e + f*x])^2),x]}
{27491.122448979593, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(3/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(5/2),x]}
{27492.183673469386, "Trig_functions/Tangent", Integrate[((a + b*Tan[e + f*x])^(3/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^(5/2),x]}
{28210.696969696968, "Trig_functions/Cotangent", Integrate[Tan[d + e*x]^3/(a + b*Cot[d + e*x] + c*Cot[d + e*x]^2)^(3/2),x]}
{28748.962962962964, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(3/2)*(c + d*Sec[e + f*x])^3),x]}
{33100.51851851852, "Trig_functions/Secant", Integrate[1/((a + a*Sec[e + f*x])^(5/2)*(c + d*Sec[e + f*x])^3),x]}
{33754.26530612245, "Trig_functions/Tangent", Integrate[((a + b*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^(3/2),x]}
{33760.102040816324, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(3/2),x]}
{41196.795918367345, "Trig_functions/Tangent", Integrate[((a + b*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^(5/2),x]}
{41197.32653061225, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(5/2),x]}
{47867.73469387755, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(7/2),x]}
{55498.795918367345, "Trig_functions/Tangent", Integrate[((c + d*Tan[e + f*x])^(5/2)*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(a + b*Tan[e + f*x])^(9/2),x]}


Here is a screen shot of the above table if it makes it easier to see

Note that these integrals are mostly from Rubi input files and few are from other sources and are stored in sqlite database I created. So other stats can be easily found if needed.

What were the classes of integrals considered ? They all seem to have trigonometric functions like Cos and Tan

CAS integration tests uses Rubi input files suite and other files from Fricas CAS. The integrals are broken into these general types

The ones listed above were picked because they had ratio of over 1000 magnification.

I've update the list above to also indicate (in second column) from which type these came from. Looking at the result, yes, the majority come from the Trig_functions category and few from the Algebraic ones and some from the Hyperbolic_functions.

Update

For comment that integrals should not have parameters. This is how the Rubi input files are. But the Fricas input file is all numeric and has no parameters in the integrand. This below were taken only from that file magnification ratio > 30.

It found 8 integrals. Here they are

{31.709302325581394, Integrate[((-2 + 2*E^100*x^2)*Log[(1 + E^100*(27*x + x^2))/(E^100*x)] + (1 + E^100*(27*x + x^2))*Log[(1 + E^100*(27*x + x^2))/(E^100*x)]^2)/(1 + E^100*(27*x + x^2)),x]}
{34.003407155025556, Integrate[(-12*x^3 + 60*x^4 - 108*x^5 + 84*x^6 - 24*x^7 + (-144*x^2 + 384*x^3 - 576*x^5 + 336*x^6)*Log[2] + (-576*x + 2304*x^3 - 1728*x^5)*Log[2]^2 + (-768 - 3072*x + 6144*x^3 + 3840*x^4)*Log[2]^3 + (-3072 - 9216*x - 9216*x^2 - 3072*x^3)*Log[2]^4)/(1 - 2*x^4 + 8*x^5 - 12*x^6 + 8*x^7 - x^8 - 8*x^9 + 28*x^10 - 56*x^11 + 70*x^12 - 56*x^13 + 28*x^14 - 8*x^15 + x^16 + (-32*x^3 + 64*x^4 - 64*x^6 + 64*x^7 - 192*x^8 + 448*x^9 - 448*x^10 + 448*x^12 - 448*x^13 + 192*x^14 - 32*x^15)*Log[2] + (-192*x^2 + 384*x^4 + 256*x^6 - 1792*x^7 + 1792*x^8 + 1792*x^9 - 4480*x^10 + 1792*x^11 + 1792*x^12 - 1792*x^13 + 448*x^14)*Log[2]^2 + (-512*x - 1024*x^2 + 1024*x^4 + 4096*x^5 - 7168*x^6 - 7168*x^7 + 21504*x^8 - 21504*x^10 + 7168*x^11 + 7168*x^12 - 3584*x^13)*Log[2]^3 + (-512 - 2048*x - 3072*x^2 - 2048*x^3 + 17408*x^4 - 71680*x^6 + 107520*x^8 - 71680*x^10 + 17920*x^12)*Log[2]^4 + (57344*x^3 + 114688*x^4 - 114688*x^5 - 344064*x^6 + 344064*x^8 + 114688*x^9 - 114688*x^10 - 57344*x^11)*Log[2]^5 + (114688*x^2 + 458752*x^3 + 458752*x^4 - 458752*x^5 - 1146880*x^6 - 458752*x^7 + 458752*x^8 + 458752*x^9 + 114688*x^10)*Log[2]^6 + (131072*x + 786432*x^2 + 1835008*x^3 + 1835008*x^4 - 1835008*x^6 - 1835008*x^7 - 786432*x^8 - 131072*x^9)*Log[2]^7 + (65536 + 524288*x + 1835008*x^2 + 3670016*x^3 + 4587520*x^4 + 3670016*x^5 + 1835008*x^6 + 524288*x^7 + 65536*x^8)*Log[2]^8),x]}
{44.01434159061278, Integrate[(-4096 - 9984*x - 9600*x^2 - 4544*x^3 - 864*x^4 + 432*x^5 + 568*x^6 + 300*x^7 + 78*x^8 + 8*x^9 + (1024 + 2560*x + 2560*x^2 + 1280*x^3 + 256*x^4 - 128*x^5 - 160*x^6 - 80*x^7 - 20*x^8 - 2*x^9)*Log[2] + (-6144*x - 8832*x^2 - 6208*x^3 - 1664*x^4 + 832*x^5 + 776*x^6 + 276*x^7 + 48*x^8 + (1536*x + 2304*x^2 + 1664*x^3 + 448*x^4 - 224*x^5 - 208*x^6 - 72*x^7 - 12*x^8)*Log[2])*Log[5] + (-3072 - 5440*x - 7648*x^2 - 4128*x^3 - 528*x^4 + 444*x^5 + 402*x^6 + 120*x^7 + (768 + 1408*x + 1984*x^2 + 1120*x^3 + 144*x^4 - 120*x^5 - 108*x^6 - 30*x^7)*Log[2])*Log[5]^2 + (-3072*x - 2880*x^2 - 1728*x^3 - 352*x^4 + 344*x^5 + 160*x^6 + (768*x + 768*x^2 + 448*x^3 + 96*x^4 - 96*x^5 - 40*x^6)*Log[2])*Log[5]^3 + (-768 - 848*x - 1256*x^2 - 460*x^3 + 210*x^4 + 120*x^5 + (192 + 224*x + 320*x^2 + 128*x^3 - 60*x^4 - 30*x^5)*Log[2])*Log[5]^4 + (-384*x - 168*x^2 + 84*x^3 + 48*x^4 + (96*x + 48*x^2 - 24*x^3 - 12*x^4)*Log[2])*Log[5]^5 + (-64 - 28*x + 14*x^2 + 8*x^3 + (16 + 8*x - 4*x^2 - 2*x^3)*Log[2])*Log[5]^6)/(2048 + 5120*x + 6656*x^2 + 6400*x^3 + 4864*x^4 + 2944*x^5 + 1472*x^6 + 608*x^7 + 200*x^8 + 52*x^9 + 10*x^10 + x^11 + (3072*x + 7680*x^2 + 9216*x^3 + 7680*x^4 + 4992*x^5 + 2496*x^6 + 960*x^7 + 288*x^8 + 60*x^9 + 6*x^10)*Log[5] + (1536 + 3840*x + 6144*x^2 + 7680*x^3 + 6720*x^4 + 4128*x^5 + 1920*x^6 + 672*x^7 + 150*x^8 + 15*x^9)*Log[5]^2 + (1536*x + 3840*x^2 + 4480*x^3 + 3520*x^4 + 2080*x^5 + 848*x^6 + 200*x^7 + 20*x^8)*Log[5]^3 + (384 + 960*x + 1440*x^2 + 1680*x^3 + 1320*x^4 + 612*x^5 + 150*x^6 + 15*x^7)*Log[5]^4 + (192*x + 480*x^2 + 480*x^3 + 240*x^4 + 60*x^5 + 6*x^6)*Log[5]^5 + (32 + 80*x + 80*x^2 + 40*x^3 + 10*x^4 + x^5)*Log[5]^6),x]}
{76.4392523364486, Integrate[(1740*x^5 - 2388*x^6 + 1143*x^7 - 222*x^8 + 15*x^9 + (-64*x + 32*x^2)*Log[(-29 + 5*x)/(-5 + x)] + (4640 - 4628*x + 1240*x^2 - 100*x^3)*Log[(-29 + 5*x)/(-5 + x)]^2)/(1740*x^5 - 2388*x^6 + 1143*x^7 - 222*x^8 + 15*x^9),x]}
{83.05050505050505, Integrate[(84 + 198*x + 152*x^2 + 60*x^3 + 10*x^4 + (72 + 132*x + 96*x^2 + 32*x^3 + 4*x^4)*Log[(12 + 12*x + 4*x^2)/(12 + 16*x + 7*x^2 + x^3)])/(18 - 3*x - 24*x^2 - 7*x^3 + 9*x^4 + 6*x^5 + x^6),x]}
{102.97520661157024, Integrate[(-8750 + 5250*x - 1050*x^2 + 1820*x^3 - 1050*x^4 + 210*x^5 - 14*x^6 + (-50 + 10*x - 20*x^3 + 4*x^4)*Log[(5 - x^3)/x] + (25 + 5*x - 5*x^3 - x^4)*Log[(5 - x^3)/x]^2)/(7500 - 4500*x + 900*x^2 - 1560*x^3 + 900*x^4 - 180*x^5 + 12*x^6),x]}
{111.52173913043478, Integrate[((160 + 40*x + (64*x^3 + 16*x^4)*Log[4]^2)*Log[(5 - x^3*Log[4]^2)/x] + (-80 - 40*x + (16*x^3 + 8*x^4)*Log[4]^2)*Log[(5 - x^3*Log[4]^2)/x]^2)/(-5 + x^3*Log[4]^2),x]}
{241.2058823529412, Integrate[((4*x^6 + 8*x^3*Log[4])*Log[(121*x^4 - 110*x^5 + 25*x^6 + (110*x^2 - 50*x^3)*Log[4] + 25*Log[4]^2)/(4*x^4 - 4*x^5 + x^6 + (4*x^2 - 2*x^3)*Log[4] + Log[4]^2)] + (44*x^5 - 42*x^6 + 10*x^7 + (42*x^3 - 20*x^4)*Log[4] + 10*x*Log[4]^2)*Log[(121*x^4 - 110*x^5 + 25*x^6 + (110*x^2 - 50*x^3)*Log[4] + 25*Log[4]^2)/(4*x^4 - 4*x^5 + x^6 + (4*x^2 - 2*x^3)*Log[4] + Log[4]^2)]^2)/(22*x^4 - 21*x^5 + 5*x^6 + (21*x^2 - 10*x^3)*Log[4] + 5*Log[4]^2),x]}


Screen shot

For example, the last integral above:

• What were the classes of integrals considered ? They all seem to have trigonometric functions like Cos and Tan. Nov 20, 2022 at 8:59
• @userrandrand i've updated to try to answer your comment. Nov 20, 2022 at 9:48
• Thanks it seems the tested data set has a bias towards trigonometric functions which might partly explain why most of the integrals in the list have trig functions. Still maybe there is a conclusion to draw that integrands with trig functions lead to the most complicated integrals. Would be interesting to know if neural network transformer models have more or less trouble integrating such functions. Nov 20, 2022 at 10:02
• You should not compare integrals that contain symbolic parameters with those that contain only numeric parameters regarding their complexity. I can put lots of unnecessary symbols inside the expression to be integrated and surely this does increase the complexity of solution to the integral much more then the complexity of the integrand itself. Nov 20, 2022 at 11:48
• @azerbajdzan comment is quite important. I checked the top ranked integral given with random integer values (I had to rename C because it is not a valid variable). For integers between 3 and 10, the leaf count seems to be typically around the interval 800-1100. With one example the integral to integrand complexity ratio was 896/49 which is about 3.5 times smaller than OP's example. Nov 20, 2022 at 12:13

Here is a family of integrands of constant leaf count but the leaf count of the integrals seem unbounded.

Mathematica seems to be unable to compute the following integral for generic r :

Integrate[1/(1 + Tan[x]^r), x]


I tried True and False for GenerateConditions and Assumptions-> r ∈ Integers none of those options worked. However, Mathematica can compute the integral for an explicit integer r. Here are a few examples:

Table[Integrate[1/(1 + Tan[x]^r), x], {r, 5}] //
FullSimplify[#, x > 0] &


$$\left\{\frac{1}{2} (x+\log (\sin (x)+\cos (x))),\frac{1}{2} (x+\sin (x) \cos (x)),\frac{1}{12} \left(6 \tan ^{-1}(\tan (x))+2 \log (\tan (x)+1)+3 \log \left(\sec ^2(x)\right)-4 \log \left(\sec ^2(x)-\tan (x)\right)\right),\frac{1}{4} \left(2 x+\sqrt{2} \coth ^{-1}\left(\sqrt{2} \csc (2 x)\right)\right),\frac{1}{20} \left(10 \tan ^{-1}(\tan (x))-5 \log \left(\sec ^2(x)\right)+2 \left(\log (\tan (x)+1)-\left(\sqrt{5}-1\right) \log \left(\sqrt{5} \tan (x)+\tan (x)-2 \sec ^2(x)\right)+\left(\sqrt{5}+1\right) \log \left(\left(\sqrt{5}-1\right) \tan (x)+2 \sec ^2(x)\right)\right)\right)\right\}$$

For r=10 there is even a root sum solution. The leaf count of these integrals seem to increase without bound even after symplifying and applying N to remove some of the complexity of analytical constants (although root or rootsum defined constants are probably still present in the expression).

A graph of the increasing leaf count:

Table[LeafCount@N@Integrate[1/(1 + Tan[x]^r), x], {r, 20}] // ListPlot


Leaf count of integral as a function of r

• Interesting set of cases.... thanks! ($+1$). Dec 5, 2022 at 22:25