Are user defined functions callable?
<p>I am not a very experience programmer. Please can you tell me why this code gives me the error message:</p>

<p>error: quad: first argument is not callable</p>

<p>code:</p>

<pre><code>from matplotlib import pyplot as plt
import numpy as np
import scipy.integrate as integrate

def parabola(x, a):
    return a+x**2

x=np.arange(-10, 10, 1)

plt.plot(x, parabola(x,2))

plt.show()

int1=integrate.quad(parabola(x,2), -5, 5)
print int1
</code></pre>

<p>Should all user defined functions be callable? </p>

<p>Try:</p>

<pre><code>int1=integrate.quad(parabola, -5, 5, args=(2,))
</code></pre>

<p>The <code>quad</code> signature is:</p>

<pre><code>quad(func, a, b, args=(), ...)
</code></pre>

<p>the function, lower range, upper range, args_to_pass through, etc.</p>

python numpy