Commit f77adb99 authored by Kittisak Maneewong's avatar Kittisak Maneewong

Edit Inte

parent ba49eec6
......@@ -2,4 +2,4 @@ def f(x):
return 3*x**2+9*x+2
def trapezoidf4(a=0,b=3,n=100):
h=(b-a)/n
return sum([(f(a+i*h)+f(a+(i+1)*h))*h/2 for i in range(n)])
print(sum([(f(a+i*h)+f(a+(i+1)*h))*h/2 for i in range(n)]))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment