Report to WRI [CASE:5169570]
May be someone with better debugging skills than me in Mathematica internals could figure what causes this. This integral worked OK in V 14.0 but now in V 14.1 it gives
SystemException[MemoryAllocationFailure]
With message in console saying
Throw::sysexc: Uncaught SystemException returned to top level. Can be caught with Catch[\[Ellipsis], _SystemException].
Clearly this is some kind of regression ( I will report to WRI). BUt may be someone here can figure what causes it or if there is something a user can do to fix it using some option setting?
Does it happen on Linux or the mac? I am using windows 10. I have 128 GB RAM. So memory should not an issue.
ClearAll["Global`*"];
integrand = (a + a*Sec[e + f*x])^m*(d*Sec[e + f*x])^(1/2);
Integrate[integrand, x]
Screen shots
To answer comment about if V 14.0 result was correct or not. I could not verify it. So it looks not correct.
(* V 14 on windows *)
ClearAll["Global`*"];
integrand = (a + a*Sec[e + f*x])^m*(d*Sec[e + f*x])^(1/2)
anti = Integrate[integrand, x];
PossibleZeroQ[RootReduce[Cancel[Together[D[anti,x]-integrand]]]]
(* False *)
Tried few other attempts, but can't verify it.
Update
I found second one
integrand = Cos[e + f*x]^5*(a + b*Sec[e + f*x]^2)^p;
Integrate[integrand, x]
(*SystemException["MemoryAllocationFailure"]*)
But thanks to suggestion below by Carl, changing "IntegrateOptions"
now the internal error is gone:
$HistoryLength = 5
when I start the kernel, I can see if$HistoryLength
is 5 or infinity. That's how I tell. The reason your loop stopped is that an uncaughtThrow[]
returns all the way to the top level, effectively aborting the evaluation. When there's an operating system error or "exception" that Mathematica has no control over, like needing too much memory, the user canCatch
aSystemException
and respond as they see fit.... $\endgroup$Catch[Integrate[ ...], _SystemException, $Failed &]
orCatch[Integrate[integrand, x], _SystemException, Failure[#2, <|"value" -> #1|>] &]
$\endgroup$SetSystemOptions[ "IntegrateOptions" -> "IntegrateAlgebraicTimeConstraint" -> 100]
$\endgroup$