Message Boards Message Boards

NIntegrate failed to converge

Hello,

I'm trying to use Mathematica to get some estimates on temperature changes caused by a heating sphere, but I'm having trouble getting my integrals to work out. On one I receive an error stating

"NIntegrate failed to converge to prescribed accuracy after 9 \ recursive bisections in y near {y} = {0.}. NIntegrate obtained \ 2.1733836446519685*^12 and 2.1623442093769382*^12 for the integral \ and error estimates. "

On another is says

NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option. >>

I'm rather new to Mathematica, and I'm not sure how to approach problem solving this. Can anyone give some suggestions?

I've attached the relevant notebook file,

Attachments:
POSTED BY: Scott Shaw
Posted 10 years ago
  1. If you are trying to ensure that r and y do not have a previously assigned value before attempting an integral then use Clear[ r ] instead of r=r.

  2. You have combinations of extremely large and extremely small numbers, compounded by E^(-15500000000 y^2) inside your integral over y from 0 to Infinity. With that exponential inside your integral I suspect you can integrate over a far far smaller range and get almost exactly the same value. Without checking in detail I integrated from 0 to 1 and suspect even that is far wider than need be. You might think through your integrand and estimate how small a range could be used. Doing that should help speed it up and minimize some of the accuracy issues.

  3. Mathematica, unlike FORTRAN, keeps track of the number of digits before and after the decimal point to know the accuracy and precision of your values. You have several constants with only one or two known good digits. Every step of any calculation then usually nibbles away at whatever accuracy remains. Since you are seeing warnings about inadequate accuracy you can sometimes overcome some of those by turning your constants into exact fractions with no decimal points. Mathematica then interprets those as having "infinite accuracy."

  4. After having done all that there were still warnings about accuracy and convergence. As an experiment I tried things like this for your two plots

    ListPlot[Table[{r, N[T1, 128]}, {r, -75, -15, 10}], Joined -> True]

where the N[ T1, 128 ] was calculating your integral with roughly 128 digits of precision. Even that was not sufficient to eliminate all the warnings about insufficient precision go match your desired degree of final precision.

Hopefully something in this will give you enough ideas to look for and find a satisfactory solution.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract