title: How to use dblquad for double integration?
body: <p>The following example is provided on <code>Scipy</code>'s reference page for <code>integration</code>. </p>
  
  <pre><code>from scipy import integrate
  N = 5
  def f(t, x):
     return np.exp(-x*t) / t**N
  integrate.nquad(f, [[1, np.inf],[0, np.inf]])
  </code></pre>
  
  <p>The following is the error I get from my <code>IPython</code> notebook (on cloud.sagemath.com):
  <img src="https://i.stack.imgur.com/huEpm.png" alt="enter image description here"></p>
  
  <p>It is my guess that <code>cloud.sagemath.com</code> has not upgraded to the latest version of <code>Scipy</code> and therefore it lacks the module for <code>nquad</code>. However, all I need is integration over two variables and therefore wanted to use <code>dblquad</code> which is already available on the cloud.</p>
  
  <p>Therefore, I modified the last line to suit the <code>dblquad</code> syntax as shown below:
  <img src="https://i.stack.imgur.com/J0TYc.png" alt="enter image description here"></p>
  
  <p>But it still pops up the error: <code>TypeError: 'int' object is not callable</code>. What is the error in my script? I have pasted the entire error message below:</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-5-2d0c5cf05694&gt; in &lt;module&gt;()
        4 def f(t, x):
        5     return np.exp(-x*t) / t**N
  ----&gt; 6 integrate.dblquad(f,1, np.inf,0, np.inf)
  
  /usr/local/sage/sage-6.2.rc0/local/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in dblquad(func, a, b, gfun, hfun, args, epsabs, epsrel)
      424 
      425     """
  --&gt; 426     return quad(_infunc,a,b,(func,gfun,hfun,args),epsabs=epsabs,epsrel=epsrel)
      427 
      428 def _infunc2(y,x,func,qfun,rfun,more_args):
  
  /usr/local/sage/sage-6.2.rc0/local/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in quad(func, a, b, args, full_output, epsabs, epsrel, limit, points, weight, wvar, wopts, maxp1, limlst)
      246     if type(args) != type(()): args = (args,)
      247     if (weight is None):
  --&gt; 248         retval = _quad(func,a,b,args,full_output,epsabs,epsrel,limit,points)
      249     else:
      250         retval = _quad_weight(func,a,b,args,full_output,epsabs,epsrel,limlst,limit,maxp1,weight,wvar,wopts)
  
  /usr/local/sage/sage-6.2.rc0/local/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in _quad(func, a, b, args, full_output, epsabs, epsrel, limit, points)
      313             return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
      314         else:
  --&gt; 315             return _quadpack._qagie(func,bound,infbounds,args,full_output,epsabs,epsrel,limit)
      316     else:
      317         if infbounds !=0:
  
  /usr/local/sage/sage-6.2.rc0/local/lib/python2.7/site-packages/scipy/integrate/quadpack.pyc in _infunc(x, func, gfun, hfun, more_args)
      371 
      372 def _infunc(x,func,gfun,hfun,more_args):
  --&gt; 373     a = gfun(x)
      374     b = hfun(x)
      375     myargs = (x,) + more_args
  
  TypeError: 'int' object is not callable
  </code></pre>
  
  <p><strong>Edit 1:</strong> I made a working script using the inputs from the users <code>Weckesser</code> and <code>Chen</code>. Just for the sake of completeness for anyone stumbling upon this question in the future.</p>
  
  <pre><code>import numpy as np
  from scipy import integrate
  N=5
  def f(t, x):
      return np.exp(-x*t) / t**N
  R1=integrate.dblquad(f,0, np.inf,lambda x: 1, lambda x: np.inf)
  print R1
  </code></pre>