[sage-support] Re: apparent numerical integration bug in sage

2014-08-30 Thread John Cremona
Pari's numerical integration does implement some very sophisticated algorithms, as implemented by Henri Cohen, who has given talks about how good they are but which stress how important it is to use the right variant, depending in the analytic properties of the function being integrated. If yo

Re: [sage-support] Re: apparent numerical integration bug in sage

2014-08-30 Thread Harald Schilly
On Sat, Aug 30, 2014 at 12:35 AM, Robert Dodier wrote: >> Harald, thanks. I think now we have six or seven ways to do quadrature in >> Sage! > > Yes, but most of them are QUADPACK, right? The whole idea of mpmath is to be standalone, right? https://github.com/fredrik-johansson/mpmath/blob/maste

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread Peter Bruin
Hello Robert, Hmm, what method does PARI/GP use? The documentation for intnum > doesn't seem to mention any algorithms. ... I just looked at the > source code (intnum.c) and I can't tell what's going on. There is > some code for Romberg's method (intnumromb) but it's not called from > intnum

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread Robert Dodier
On 2014-08-29, kcrisman wrote: > sage: gp.eval('intnum(x=1,1000,1/sqrt(x^4+2))') > '0.88156906043147435374520375967552406680' > sage: gp.eval('intnum(x=1,1,1/sqrt(x^4+2))') > '0.88156906044791138558085421922579474969' Hmm, what method does PARI/GP use? The documentation for i

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread kcrisman
> > Sage punts numerical integrals to QUADPACK or a translation of it, > What does GSL use? I forgot that Scipy also has quadrature, in addition to Maxima... wealth of riches. > right? QUADPACK is based on Gauss-Kronrod rules which are essentially > Gaussian integration + an efficient refi

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread Harald Schilly
On Friday, August 29, 2014 7:15:27 PM UTC+2, Robert Dodier wrote: > > QUADPACK ... > I've tried this in mpmath's quad. I think it works there, but maybe I've overlooked the actual problem. sage: import mpmath as mp sage: f1 = lambda _ : 1. / mp.sqrt(_^3 + 2) sage: f2 = lambda _ : 1. / mp.sqrt

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread Robert Dodier
On 2014-08-29, kcrisman 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: nume

[sage-support] Re: apparent numerical integration bug in sage

2014-08-29 Thread kcrisman
> > f1(x)=1/sqrt(x^3+2) > f2(x)=1/sqrt(x^4+2) > r1=RR(integrate(f1(x),(x,1,10^(10 > r2=RR(integrate(f2(x),(x,1,10^(10 > s1=RR(integrate(f1(x),(x,1,10^(11 > s2=RR(integrate(f2(x),(x,1,10^(11 > Note that probably using something like sage: numerical_integral(f2,1,10^8) (0.881569050