Integration in python
Question: The code I have written to integrate is giving wrong results.I get the
c_0,c_1,...c_4 to be zeros! What am I doing wrong? I am using simply 0.7.6 on
a mac.

    
    
    from numpy import *
    from matplotlib.pyplot import *
    from sympy import *
    x = Symbol('x')
    f = 1.0*sin(np.pi * x)
    phi_0 = 1.0
    phi_1 = 1.0*x
    phi_2 = 1./2*(3*x**2-1)
    phi_3 = 1./2*(5*x**3-3*x)
    phi_4 = 1./8*(35*x**4-30*x**2+3)
    c_0 = integrate(f*phi_0, (x, -1.0, 1.0))
    c_1 = integrate(f*phi_1, (x, -1.0, 1.0))
    c_2 = integrate(f*phi_2, (x, -1.0, 1.0))
    c_3 = integrate(f*phi_3, (x, -1.0, 1.0))
    c_4 = integrate(f*phi_4, (x, -1.0, 1.0))
    print c_0
    print c_1
    print c_2
    print c_3
    print c_4
    


Answer: Other than the need to import numpy as np, I don't see any problems in the
most recent version (0.7.6). Some values are zero (as expected due to symmetry
consideration) but others are not:

    
    
    >>> print c_0
    0
    >>> print c_1
    0.636619772367581
    >>> print c_2
    0
    >>> print c_3
    -0.330926260628403
    >>> print c_4
    0
    

