I have the following code but when it is run, it gives 0.0
It should return a value of 2 since I am attempting to integrate sin(x) in the interval [0, pi].
Please advise.
from math import sin, pi
def Rsum(a,b):
for i in range(1001):
s = 0
delx = float((b-a)/1000)
g = i*delx
h = (i+1)*delx
y_i = float(sin(a+g))
y_ii = float(sin(a+h))
s += 1/2 * (y_i + y_ii) * delx
return s
print Rsum(0,pi)