Visual Basic 常用数学算法集书中收录了所有代码
源代码在线查看: d3r4.txt
Private Sub Command1_Click()
'PROGRAM D3R4
'Driver for routine QROMB
PIO2 = 1.5707963
A = 0#
B = PIO2
Print
Print Tab(5); "Integral of FUNC with QROMB"
Print
Print Tab(5); "Actual value of integral is:";
Print Tab(34); Format$((FINT(B) - FINT(A)), "0.####00")
Print
Call QROMB(A, B, S)
Print Tab(5); "Result from routine QROMB is:";
Print Tab(35); Format$(S, "0.####00")
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