# Why the Kernel crashes on these integrals in V12?

Bug introduced in 12.0 and fixed in 12.1 [CASE:4331819]

This is using V12, on windows 10, 64 bit. Note: these integrals work OK on 11.3 on same PC. Any idea why the Kernel now crashes on these types of integrals?

ClearAll[x,a,b,c,e,d,f,g,n];

(*these from file #40,41*)
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];

(*these from file #42*)
Integrate[(a*g - c*g*x^4)/(a + b*x^2 + c*x^4)^(3/2), x];
Integrate[(a*g+e*x-c*g*x^4)/(a+b*x^2+c*x^4)^(3/2),x];
Integrate[(a*g+f*x^3-c*g*x^4)/(a+b*x^2+c*x^4)^(3/2),x];
Integrate[(a*g+e*x+f*x^3-c*g*x^4)/(a+b*x^2+c*x^4)^(3/2),x];

(*these from file #44*)
Integrate[(A+B*x^2)*(d+e*x^2)/(a+b*x^2+c*x^4)^(3/2),x];
Integrate[(A+B*x^2)/(a+b*x^2+c*x^4)^(3/2),x]

(*these from file #49*)
Integrate[(-a*h*x^(n/2 - 1) + c*f*x^(n - 1) + c*g*x^(2*n - 1) +c*h*x^((5*n)/2 - 1))/(a + b*x^n + c*x^(2*n))^(3/2), x];
Integrate[(x^(n/2 - 1)*(-a*h + c*f*x^(n/2) + c*g*x^((3*n)/2)+c*h*x^(2*n)))/(a + b*x^n + c*x^(2*n))^(3/2), x];
Integrate[((d*x)^(n/2-1)*(-a*h+c*f*x^(n/2)+c*g*x^((3*n)/2)+c*h*x^(2*n)))/(a+b*x^n+c*x^(2*n))^(3/2),x];
(*etc..*)   No problem with V 11.3   Does this happen to others and on other systems or just on windows 10?

It looks like it is the same bug that is causing all these crashes, but I can't be sure.

I am finding that V12 kernel crashes more than V 11.3 kernel and also in strange ways. This makes it very hard to run a long script, when kernel keeps crashing.

ps. I think WRI should have been able to detect these before making a release by running regression tests. I am using Rubi integration test files to find these problems.

pps. I hope I do not get downvoted again for asking about a possible problem in Mathematica like in the last post on that bizarre kernel crash.

• This is not an answer at all but using Rubi on v12 all integrals work and all involve the EllipticE and EllipticF functions. Don't know if that might be the common factor. Also, all integrals work on v10.4.
– JimB
Oct 15 '19 at 3:04
• @JimB Yes, using Rubi Int there is no problem. It is when using Mathematica Integrate the kernel crashes. Rubi has it own integration rules and not related to Integrate at all. The above list of integrals is just a small sample. I have found many more integrals that causes Mathematica Integrate to crash the kernel. But I have the feeling they are all related to the same problem, that is why I did not post every such integral. But can't be sure. Oct 15 '19 at 3:13
• ... and you are right, they all seem to involve elliptic functions. Oct 15 '19 at 3:42
• I tried a few and they all caused the kernel to crash on "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)" and "12.1.0 for Mac OS X x86 (64-bit) (July 23, 2019)". Oct 15 '19 at 4:03
• I tried the first integral on V12 Windows 10 and it crashed the first time I executed, but when I re-executed immediately, it worked. The second integral failed to work after several tries. M8 as usual worked like a champ. Oct 15 '19 at 5:53

## 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.

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.

Timings and LeafCounts 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  Timings and LeafCounts 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:

There already was similar (but more subtle) problem with FindMinimum on transition from version 8 to version 9:

• +1 This is a very interesting result. Better less, but better. Oct 15 '19 at 12:26
• @AlexTrounev Actually excepting the last integral the results obtained with version 12 aren't better than of version 11.3, but the corresponding timings are 5 - 20 times larger! An improvement in one case and serious performance degradation in the others. Also I suspect that the problem with performance isn't related to the minor improvement in the algorithm, but reflects some quite general bug of version 12.0. I updated the answer with further discussion. Oct 15 '19 at 15:21
• No crash with versions 12.0 and 11.3 on Windows 7 x64 why do you think it crashes then on windows 10 but not on windows 7 when using V12? I am using windows 10 and do not have windows 7 to try V12 on it. Do they crash for you on windows 10? Thanks. Oct 15 '19 at 15:35
• @Nasser I have no access to a machive with Windows 10 and Mathematica 12 for checking. I can only guess that it may be a hardware issue, not necessarily an OS issue. I have reported the performance issue as [CASE:4332017]. I recommend you reporting the crash too. Oct 15 '19 at 15:55
• @Nasser In V12 same code as the answer above crashes for me both on Windows 10 (Version 1903) as well as Linux x86 (64-bit) Ubuntu 18.04. V 11.3 works just fine. Oct 15 '19 at 16:55

Mma 12.1 completes the above result in 6.59375s on Windows 10 so looks this version offers better performance.

• Could you edit your answer to include the results for a few of the integrals? Mar 23 '20 at 13:01

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.