# Problem with quad from SciPy

I have a simple code that seems to work fine (*although I cannot be sure when there are several constants like a13 that seem to be integration constants while the integrals are all definite?*), at least runs with no error, when the symbolic "integral" function is used instead of "quad", but now using "quad" the code runs into error. This is an example code:

```
reset()
forget()
from scipy.integrate import quad
var('y')
var('kx')
alpha1=var('a11,a12,a13')
phi11(y)=y*(y-1); phi12(y)=y*(y-1)*(y+1); phi13(y)=y*(y-1)*(y^2+1)
phi1=[phi11,phi12,phi13]
U1(y)=sum(alpha1[j]*phi1[j](y) for j in range(3))
eq1=[
quad(U1.diff(y,y)*phi1[j],0.0,1.0)[0]
-kx*quad(y*U1*phi1[j],0.0,1.0)[0]
-kx^2*quad(U1*phi1[j],0.0,1.0)[0]
for j in range(3)]
print eq1
```

The error is:

```
quadpack.error: Supplied function does not return a valid float.
```

Any idea how to resolve it? I have tested many different usages of the functions inside the argument of quad, using lambda, explicitly specifying (y) as the argument of the functions, defining a function Y(y)=y so to use Y instead of y in writing the expression "y*U1*phi1[j]", and etc but all with no success. Searching the web also didn't help much. Please bare with me I am not an expert.