Why the Kernel crashes on these integrals in V12?
UPDATE: 24.03.2020
Checked this again on another machine running Windows 10 Pro x64 with Mathematica 12.0 and 12.1 installed. With version 12.0 the code below crashes the Kernel, while version 12.1 quickly returns the following:
{{0.296875, 136}, {0.15625, 158}, {0.15625, 160}, {0.109375, 99}, {0.09375, 99}, {0.03125, 97}, {0.078125, 129}, {0.078125, 124}, {0.0625, 119}, {0.09375, 104}, {0.0625, 99}, {0.46875, 349}, {1.3125, 487}}
So the conclusion is that the bug is fixed in version 12.1.
Original answer
No crash with versions 12.0 and 11.3 on Windows 7 x64. I've tried evaluating the code both in a fresh and non-fresh Kernel - the result is the same. I can only note that version 12.0 takes 68 seconds, while version 11.3 only 18 seconds for evaluating all the integrals. The result returned by version 12 for the last integral is mush shorter than of version 11.3, but for other integrals it has the same complexity. So the slowdown can't be justified by obtaining a simpler expression. I have reported this as a performance issue ([CASE:4332017]). Look at the timings below.
Timing
s and LeafCount
s in a fresh kernel of version 12.0:
$Version
"12.0.0 for Microsoft Windows (64-bit) (April 6, 2019)"
ClearAll[x, a, b, c, e, d, f];
ReleaseHold[Hold[{Integrate[(1 + x^2)^3/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)^2/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)/(1 + x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^3/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^3, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^2, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(7 + 5*x^2)^4/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(4 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(d + e*x^2)*(a + b*x^2 + c*x^4)^(3/2)/(f*x)^(1/2), x]}] /.
i_Integrate :> Timing[LeafCount[i]]]
{{5.55364, 136}, {5.07003, 158}, {4.97643, 160}, {4.94523, 99}, {5.00763, 99}, {2.93282, 97}, {5.00763, 129}, {5.08563, 124}, {5.05443, 119}, {4.99203, 104}, {5.02323, 99}, {6.22444, 349}, {8.72046, 487}}
%[[All, 1]] // Total
68.5936
Timing
s and LeafCount
s in a fresh kernel of version 11.3:
$Version
"11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)"
ClearAll[x, a, b, c, e, d, f];
ReleaseHold[Hold[{Integrate[(1 + x^2)^3/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)^2/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)/(1 + x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^3/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^3, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^2, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(7 + 5*x^2)^4/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(4 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(d + e*x^2)*(a + b*x^2 + c*x^4)^(3/2)/(f*x)^(1/2), x]}] /.
i_Integrate :> Timing[LeafCount[i]]]
{{0.811205, 136}, {0.639604, 158}, {0.546004, 160}, {0.265202, 99}, {0.187201, 99}, {0.156001, 97}, {0.218401, 129}, {0.187201, 124}, {0.171601, 119}, {0.202801, 104}, {0.0780005, 99}, {2.02801, 349}, {12.7765, 3656}}
%[[All, 1]] // Total
18.2677
I suspect that the performance degradation isn't related to the minor improvement in the algorithm of Integrate
, but reflects some quite general bug of version 12.0. For example, FindMinimum
also has twentyfold performance degradation in version 12.0 (in addition to the Kernel hang-up) as compared to 11.3:
- Numerical minimum of a one-valued function
There already was similar (but more subtle) problem with FindMinimum
on transition from version 8 to version 9:
- Performance reduction of FindMinimum in version 10
Mma 12.1 completes the above result in 6.59375s on Windows 10 so looks this version offers better performance.
Too long for a comment, but as a comparison, I ran Alexey Popkov's code on V12.1:
$Version
"12.1.0 for Mac OS X x86 (64-bit) (March 14, 2020)"
ClearAll[x, a, b, c, e, d, f];
ReleaseHold[Hold[{Integrate[(1 + x^2)^3/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)^2/(1 + x^2 + x^4)^(3/2), x],
Integrate[(1 + x^2)/(1 + x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^3/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^3, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2)^2, x],
Integrate[(2 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(7 + 5*x^2)^4/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(7 + 5*x^2)^2/(2 + 3*x^2 + x^4)^(3/2), x],
Integrate[(4 + 3*x^2 + x^4)^(3/2)*(7 + 5*x^2), x],
Integrate[(d + e*x^2)*(a + b*x^2 + c*x^4)^(3/2)/(f*x)^(1/2), x]}] /.
i_Integrate :> Timing[LeafCount[i]]]
{{0.345546, 136}, {0.203154, 158}, {0.152575, 160}, {0.181059, 99}, {0.125542, 99}, {0.108281, 97}, {0.138563, 129}, {0.094992, 124}, {0.079558, 119}, {0.120058, 104}, {0.056913, 99}, {0.486396, 349}, {1.223075, 487}}
%[[All, 1]] // Total
3.31571
Leaf counts are identical to V12, but timings are faster by an order of magnitude.