Q:

Are user defined functions callable?

I am not a very experience programmer. Please can you tell me why this code gives me the error message:
error: quad: first argument is not callable
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

Should all user defined functions be callable? 

A:

There are two problems in your code:
1) you call the function parabola(). Instead, pass it as an argument to integrate.
2) parabola() is a two argument function. integrate expects a single-argument function.
To solve the second problem, you need to convert the two-argument function to a single-argument function. This is a general technique known as partial application of functions.
Try this:
def parabola1(x): return parabola(x, 2)

int1 = integrate.quad(parabola1, -5, 5)
print int1

