I have the following Python script
def application():
from math import exp
v = lambda t: 3*(t**2)*exp(t**3)
n = int(input('n: '))
numerical = trapezoidal(v, 0, 1, n)
# Compare with exact result
V = lambda t: exp(t**3)
exact = V(1) - V(0)
error = exact - numerical
print("n = %d: estimation = %.16f, error: %g"%(n, numerical, error))
def trapezoidal(f,a,b,n):
h = float(b-a)/n #width
result = 0.5*f(a) + 0.5*f(b)
for i in range(1,n):
result += f(a + i*h)
result *= h
return result
which is named trapezoidal.py. I cannot understand why when I call it from a terminal (python trapezoidal.py) I get nothing.