Professional Documents
Culture Documents
NSM Tra Com Shetye
NSM Tra Com Shetye
import math
def f(x):
return(math.exp(x))
x0= float(input("Enter the lower limit:"))
xn= float(input("Enter the upper limit:"))
n= int(input("Enter number of iterations:"))
h= ((xn-x0)/n)
summ=0
for i in range (n):
summ=summ+f(x0)+f(x0+h)
x0=x0+h
Area= h/2*summ
print("Area by using trapezoidal rule is{}".format(Area))
Output of Program: