MaxRecursion(/WorkingPrecision?) Error in Mathematica 8

In summary, the MaxRecursion Error in Mathematica 8 is an error message that occurs when a recursive function or algorithm reaches its maximum number of iterations. It is caused by a recursive function or algorithm that continues to call itself without ever reaching a base case or termination condition. To fix this error, you can increase the maximum number of allowed iterations or modify the recursive function to include a termination condition. The WorkingPrecision Error in Mathematica 8, on the other hand, occurs when a calculation or evaluation exceeds the specified precision or accuracy. To avoid this error, you can increase the specified precision or accuracy or use higher precision data types or functions.
  • #1
muppet
608
1
I'm getting an error message that suggests my attempts to increase the variable MaxRecursion in NIntegrate aren't working.

I define
f[n_,b_]:=NIntegrate[q*BesselJ[0,q*b]*(-(2/(n (2+n) q^4))+(1-q^2)^(n/2) HeavisideTheta[1-q^2] ((2+n q^2)/(n (2+n) q^4)-Hypergeometric2F1[1,n/2,1+n/2,1-1/q^2]/(n q^2))),{q,0,Infinity},Method->"DoubleExponentialOscillatory",MaxRecursion->50,WorkingPrecision->30]

and upon trying to evaluate f[3,4] I get the message
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in q near {q} = {1.00125749138406369739184946806}. NIntegrate obtained 0.0302818978835504820230915378392`30. and 1.04354107472455181267006501674`30.*^-16 for the integral and error estimates. >>
9 being the default value of MaxRecursion.

Does anyone have any ideas why?
I'm also finding that when I try and

Plot[f[3,b],{b,0,1},WorkingPrecision->30]

I'm getting the message
NIntegrate::precw: The precision of the argument function (q BesselJ[0,0.0000204286 q] (-(2/(15 q^4))+(1-q^2)^(3/2) ((2+3 Power[<<2>>])/(15 q^4)-(-1+1/q^2+Power[<<2>>] ArcTanh[<<1>>])/((1+Times[<<2>>])^2 q^2)) HeavisideTheta[1-q^2])) is less than WorkingPrecision (30.`). >>

How do I fix this?

Thanks in advance.
 
Physics news on Phys.org
  • #2


it is important to troubleshoot and solve any issues that arise in our experiments or calculations. In this case, it seems like there may be some issue with the integration method and the precision settings.

Firstly, it is worth checking if the function being integrated is well-behaved and if the integration limits are appropriate. This could cause convergence issues and could be the reason for the error message.

Another potential solution could be to try different integration methods, such as the "GlobalAdaptive" or "MonteCarlo" methods. Sometimes, different methods can give better results for certain integrals.

It is also important to note that increasing the MaxRecursion value may not always improve the accuracy of the integral. In some cases, it may lead to an infinite loop or take a very long time to compute.

Regarding the second issue with the precision, it may be helpful to try increasing the WorkingPrecision value to see if that resolves the issue. It could also be worth checking if there are any issues with the function being plotted or the range of values being used.

In summary, troubleshooting integration errors can be a trial-and-error process, and it may require trying different methods and adjusting precision settings. It is also helpful to carefully check the input function and integration limits to ensure they are appropriate for the problem at hand.
 

What is the MaxRecursion Error in Mathematica 8?

The MaxRecursion Error in Mathematica 8 is an error message that occurs when a recursive function or algorithm reaches its maximum number of iterations.

What causes the MaxRecursion Error in Mathematica 8?

The MaxRecursion Error in Mathematica 8 is caused by a recursive function or algorithm that continues to call itself without ever reaching a base case or termination condition. This can lead to an infinite loop and cause the program to run out of memory or reach the maximum number of allowed iterations.

How can I fix the MaxRecursion Error in Mathematica 8?

To fix the MaxRecursion Error in Mathematica 8, you can increase the maximum number of allowed iterations using the MaxRecursion option or by explicitly specifying the desired number of iterations in your code. Alternatively, you can modify your recursive function or algorithm to include a termination condition that will prevent infinite looping.

What is the WorkingPrecision Error in Mathematica 8?

The WorkingPrecision Error in Mathematica 8 is an error message that occurs when a calculation or evaluation exceeds the specified precision or accuracy.

How can I avoid the WorkingPrecision Error in Mathematica 8?

To avoid the WorkingPrecision Error in Mathematica 8, you can increase the specified precision or accuracy using the WorkingPrecision option or by explicitly specifying the desired precision in your code. You can also use higher precision data types or functions, such as the arbitrary-precision functions in Mathematica, to ensure more accurate calculations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
34
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
544
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Back
Top