Here's an example code for creating a function to perform repeated Simpsons rule for numerical integration:
main.m574 chars25 lines
f
is the function to be integrated, a
and b
are the limits of the integration interval, n
is the number of intervals to be used. The function checks if n
is an even number, and then applies repeated Simpson's rule using the input parameters.
Note that repeated_simpsons_rule
is the name of the function, and can be changed to any desired name when used in the main code.
gistlibby LogSnag