[Scipy-tickets] [SciPy] #1572: Scipy dblquad/tplquad spuriously drops epsilon for inner integration

SciPy Trac scipy-tickets@scipy....
Thu Dec 1 19:40:48 CST 2011


#1572: Scipy dblquad/tplquad spuriously drops epsilon for inner integration
--------------------------------------------------------------------------+-
 Reporter:  trobinso                                                      |       Owner:  somebody   
     Type:  defect                                                        |      Status:  new        
 Priority:  normal                                                        |   Milestone:  Unscheduled
Component:  scipy.integrate                                               |     Version:  devel      
 Keywords:  quadpack, spurious loss of information granulaity, integrate  |  
--------------------------------------------------------------------------+-
 From devel ''scipy/integrate/quadpack.py'', the relative and absolute
 epsilon values appear to be getting dropped on the floor for the inner
 integration step:

 {{{
 def _infunc(x,func,gfun,hfun,more_args):
     a = gfun(x)
     b = hfun(x)
     myargs = (x,) + more_args
     return quad(func,a,b,args=myargs)[0] # <-- Here

 def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8,
 epsrel=1.49e-8):
     ...
     return
 quad(_infunc,a,b,(func,gfun,hfun,args),epsabs=epsabs,epsrel=epsrel)

 def _infunc2(y,x,func,qfun,rfun,more_args):
     a2 = qfun(x,y)
     b2 = rfun(x,y)
     myargs = (y,x) + more_args
     return quad(func,a2,b2,args=myargs)[0] # <-- And here

 def tplquad(func, a, b, gfun, hfun, qfun, rfun, args=(), epsabs=1.49e-8,
             epsrel=1.49e-8):
     ...
     return
 dblquad(_infunc2,a,b,gfun,hfun,(func,qfun,rfun,args),epsabs=epsabs,epsrel=epsrel)
 }}}

 This can be fixed with a quick refactoring of the inner operation. For
 example:
 {{{
 def _infunc(x,func,gfun,hfun,epsabs,epsrel,more_args):
     a = gfun(x)
     b = hfun(x)
     myargs = (x,) + more_args
     return quad(func,a,b,args=myargs,epsabs=epsabs,epsrel=epsrel)[0]

 def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8,
 epsrel=1.49e-8):
     ...
     return
 quad(_infunc,a,b,(func,gfun,hfun,epsabs,epsrel,args),epsabs=epsabs,epsrel=epsrel)
 }}}

 I've made these changes to my local version, since I'm setting a large
 epsilon for a faster approximation.

 Is there a good reason why this information is being removed during the
 handoff?

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1572>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list