Private Sub Command1_Click()
'PROGRAM D3R1
'Driver for routine TRAPZD
NMAX = 14
PIO2 = 1.5707963
A = 0#
B = PIO2
Print
Print Tab(5); "Integral of FUNC with 2^(n-1) points"
Print Tab(5); "Actual value of integral is: ";
Print Tab(35); Format$((FINT(B) - FINT(A)), "0.####00")
Print
Print Tab(5); " n Approx.Integral"
For I = 1 To NMAX
Call TRAPZD(A, B, S, I)
Print Tab(10); Format$(I, "##");
Print Tab(17); Format$(S, "0.####00")
Next I
End Sub
Function FUNC(X)
FUNC = (X ^ 2) * (X ^ 2 - 2#) * Sin(X)
End Function
Function FINT(X)
'Integral of FUNC
AAA = 4# * X * (X ^ 2 - 7#) * Sin(X)
FINT = AAA - (X ^ 4 - 14# * X ^ 2 + 28#) * Cos(X)
End Function