In [25]:
import diffeq_midpoint as p1
In [26]:
function_call = p1.vector_midpoint(p1.np.sin, 0, p1.np.pi, 10000)
print function_call[1][-1]
Observe the close adherance to the actual value of this cannonical value.
We can also call it at a different value of x. Let's look at the value of this integral from 0 to pi over 2. Again, the result will have strikingly close adherance to the analytical value of this integral.
In [28]:
print function_call[1][5000]