On 2014-08-29, kcrisman <kcris...@gmail.com> wrote: > sage: numerical_integral(f2,1,10^8) > (0.8815690504421161, 3.309409685784312e-09) > sage: numerical_integral(f2,1,10^9) > (0.8815690594421439, 2.7280605832086615e-08) > sage: numerical_integral(f2,1,10^10) > (0.8815690603426408, 6.194229607849825e-07) > sage: numerical_integral(f2,1,4.5*10^10) > (0.8815690604198958, 2.5079492928729825e-11) > sage: numerical_integral(f2,1,10^11) > (2.3214916598860602e-07, 4.5569931705290324e-07)
> This uses the Gnu Scientific Library. Perhaps this is a limitation of how > it is constructed. But I have a feeling someone else who knows more about > the internals of quadrature methods will have more info, so for now I've > opened http://trac.sagemath.org/ticket/16905 for this bug. Thank you! Sage punts numerical integrals to QUADPACK or a translation of it, right? QUADPACK is based on Gauss-Kronrod rules which are essentially Gaussian integration + an efficient refinement scheme. To determine whether to refine the estimate, the integrand is evaluated at some points. The difficulty with 1/sqrt(x^4 + 2) is that it is nearly zero for much of the interval (1, 10^11). If it is close enough to zero at the evaluation points, the refinement heuristic can be fooled. Probably other quadrature methods can be fooled in a similar way. I guess this is a bug in the sense that the result is far from correct even though the code is a correct implementation of the method. I wonder what other heuristic could be invented -- maybe since we can see that integrals on shorter intervals are much larger and the integrand is nonnegative, the integral on the whole interval must be at least that large -- perhaps that can be formalized. I am trying the examples with QUADPACK functions in Maxima -- I find that quad_qags(f2, x, 1, 10^11) fails (with error=5, "integral is probably divergent or slowly convergent") but quad_qag(f2, x, 1, 10^11, 4) succeeds, likewise quad_qagi(f2, x, 1, inf) succeeds. If Sage is indeed calling QUADPACK, perhaps at least the error number can be reported? For what it's worth, Robert Dodier -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.