evaluates the definite integral using Simpson's 1/3rd Method
integral = simpson(a,b,n,f)
lower limit of integration
upper limit of integration
an even no. (denotes the no. of sub-intervals. Higher the value of n better the result.)
The function that is to be integrated
returns the definite integral using Simpson's 1/3rd Method
deff('a=f(x)','a=x*x') // define a function f which returns x^2 integral = simpson(0,2,600,f) // evaluates the integral of x^2 from 0 to 2 | ![]() | ![]() |
http://www.phy.davidson.edu/FacHome/dmb/py200/Simpson.htm