FNSimpsonestimates the integral of the function named inF$between the pointsaandbwhere N is the number of divisions between a and b. The estimate is exact for functions that can be represented as polynomials of degree 2 or less.
F$should contain the name of an HTBasic subroutine. The subroutine should take two REAL parameters. It should evaluate the function to be integrated at the second parameter and return its value in the first parameter. For example, ifF$= "Test", then the subroutineTestshould begin with the definition line
SUB Test(REAL Y,X)
whereXandYmay be replaced by the names of any REAL parameters. The subroutineTestwould evaluate the desired function at the valueXand return the value inY.
Errors
FNSimpsoncauses an HTBasic error if the subroutine named inF$is undefined. The subroutine named inF$may also cause HTBasic Errorswhen it is evaluated.