Well if you run the program you obtain the following error:
TypeError: ufunc 'bitwise_xor' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
So you know the problem is with the ^ (bitwise xor) in your function. In Python one uses ** to take the exponent.
If one writes:
y = (e**-(a*x))*cos(x)
instead, one gets:
>>> print integral_value
-0.000170200006112
The full program:
from numpy import *
from scipy.integrate import simps
a = 0
x = linspace(0 , 4*pi, 100)
y = (e**-(a*x))*cos(x)
integral_value = simps(y,x)
print integral_value
You can also make explicit use of numpy functions with:
from numpy import *
from scipy.integrate import simps
a = 0
x = linspace(0 , 4*pi, 100)
y = exp(-a*x)*cos(x)
integral_value = simps(y,x)
print integral_value
In order to increase the precision, you can increase the number of points (100 is not that much).