#using both trapezodal and simpsons rule using Lists without
#importing any modules
h=.001
N=1000
x=[h*i for i in range(N)]
y=[1/(1+i) for i in x]
trapezoidal=h/2*(y[0]+y[-1]+2*
print "tapezoidal rule gives%.6f"%trapezoidal
simpsons=(h/3)*(y[0]+y[-1]+4*
print "simpsons rule gives %.6f"%simpsons
by Prof. Ahamed Ashraf
No comments:
Post a Comment