#10550: integration not working
------------------------+---------------------------------------------------
   Reporter:  mariah    |       Owner:  burcin    
       Type:  defect    |      Status:  new       
   Priority:  minor     |   Milestone:  sage-4.6.2
  Component:  calculus  |    Keywords:            
     Author:            |    Upstream:  N/A       
   Reviewer:            |      Merged:            
Work_issues:            |  
------------------------+---------------------------------------------------

Comment(by gbe):

 Getting this right will be tricky. While simply changing from a blind
 application of gsl's numerical_integral() to mpmath's quad() may be often
 be an improvement, in this situation it makes things worse:

 {{{
 sage: f = abs(x^2-1)^(-2/3)
 sage: g = fast_callable(f, RealField(100), [x])
 sage: import mpmath as mp
 sage: mp.mp.prec = 100

 sage: for i in [mp.quad(g, [-10^i, 10^1]) for i in range(15)]:
 ....:     print i
 ....:
 +inf
 8.8396932208278888892057527426
 8.3969760821447628003659891605
 9.7953936385023669571121865442
 9.2339519516756815076612878988
 8.2441701346282922281629165563
 8.044969834509411578891250552
 11.635099287297832304011545535
 11.084646393563409097851890886
 7.5468622876138167706495612921
 7.0790386862087011969090472793
 8.4443867135724817987750671703
 10.690050592136777734927819129
 32.336415464969432639295368434
 10.533897172238729354640752465

 sage: mp.quad(g, [mp.mpf('-inf'),mp.mpf('+inf')])
 mpf('+inf')
 }}}

 Switching from tanh-sinh quadrature to Gauss-Legendre gives
 {{{
 sage: for i in [mp.quadgl(g, [-10^i, 10^1]) for i in range(15)]:
 ....:     print i
 ....:
 6.3780650727028379121031555789
 7.9564100202151404330674115745
 8.3052587750738550159021915092
 11.156320092824073496435254839
 9.5630214580799381652111853848
 2.8857506804320681789970931663
 1.7298436143374586397937735747
 0.63762636717628812549878116562
 0.29045600775700733200460854022
 0.13456948161705169202354793393
 0.062450129901992433601218328054
 0.02898624937362903007167714756
 0.013454200394425034174020875196
 0.0062448854829133373771884652354
 0.002898619019151035832588794256

 sage: mp.quadgl(g, [mp.mpf('-inf'),mp.mpf('+inf')])
 mpf('11.350773575585495163385287559838')
 }}}

 Hand-tuning with Gauss-Legendre:
 {{{
 sage: mp.quadgl(g, [mp.mpf('-inf'),-1,1,mp.mpf('+inf')])
 mpf('12.350413467045610425723223632513')

 sage: mp.quadgl(g, [mp.mpf('-inf'),-1,1,mp.mpf('+inf')], maxdegree=12)
 mpf('12.592883474959440301710672862944')
 }}}

 And with tanh-sinh:
 {{{
 sage: mp.quad(g, [mp.mpf('-inf'),-1,1,mp.mpf('+inf')])
 mpf('+inf')
 sage: mp.quad(g, [mp.mpf('-inf'),-1,1,mp.mpf('+inf')], maxdegree=12)
 mpf('+inf')
 }}}

 It seems this integral ''requires'' at least some hand tuning to be
 reasonable.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10550#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to