I am trying to calculate a definite integral. I write:
NIntegrate[expression, {x, 0, 1}, WorkingPrecision -> 100]
“expression” is described below. The WorkingPrecision was added in to help with another error.
I get an error:
“NIntegrate::ncvb: NIntegrate failed to converge to prescribed
accuracy after 9 recursive bisections in x near {x} = {<<156>>}.
NIntegrate obtained <<157>> and <<160>> for the integral and error
estimates. >>”
Why am I getting this error for near{x} = {<<156>>} when I am only looking at 0<x<1? And what do the double pointy brackets around the number mean?
The expression is really long, so I think it would be more meaningful to show how I generate it.This is a basic version (some of the exponents I need to be variables, but these are the lowest values, and I still get the error).
F[n_] := (1 - (1 - F[n-1])^2)^2;
F[0] = x;
Expr[n_]:= (1/(1-F[n]))Integrate[D[F[n],x]*x,{x,x,1}];
I get the error when I integrate Expr[3] or higher. Oddly, when I use regular Integrate and then //N at the end, I get a complex number for n=2.
The
<<156>>does not mean that the integral is being evaluated atx=156.<<>>is calledSkeletonand is used to indicate that a large output was suppressed. From the documentation:Coming to your integral, here’s the error that I get:
So you can see that this long number was suppressed in your case (depending on your preferences). The last
>>is a link that takes you to the corresponding error message in the documentation.If you try the advice in the document, which is to increase
MaxRecursion, you’ll eventually get a new error::slwconSo this now tells you that either your
WorkingPrecisionis too small or that you have a singularity (which is brought on by a small working precision). IncreasingWorkingPrecisionto200gives the following output:You can look a little further into the nature of your expressions.
So beyond 0.7ish, your expression has the potential for serious stability issues, resulting in singularities. It is the numerator rather than the denominator, that requires high precision to converge to the right value.
You can see here the difference between the numerator and denominator when you don’t have sufficient precision, causing a near singularity.