# L-03 MCS 572 Fri 26 Aug 2016 : simpson4pi1
"""
Script to illustrate the use of the Simpson rule of SciPy
on the approximation of Pi/4 via the area under sqrt(1 - x^2)
above the x-axis, using one process.

If the script is called simpson4py1, 
run it typing at the command prompt $
$ time python simpson4py1.py
"""

from scipy.integrate import simps
from scipy import sqrt, linspace, pi
f = lambda x: sqrt(1-x**2)
x = linspace(0, 1, 20000000)
y = f(x)
I = 4*simps(y, x)
print I, abs(I - pi) 
