Visual Basic 常用数学算法集书中收录了所有代码

源代码在线查看: d3r9.txt

软件大小: 1879 K
上传用户: yyyz
关键词: Visual Basic 算法 收录
下载地址: 免注册下载 普通下载 VIP

相关代码

				Private Sub Command1_Click()
				    'PROGRAM D3R9
				    'Driver for routine GAULEG
				    NPOINT = 10
				    X1 = 0#
				    X2 = 1#
				    X3 = 10#
				    Dim X(10), W(10)
				    Call GAULEG(X1, X2, X(), W(), NPOINT)
				    Print
				    Print Tab(5); "#           X(I)        W(I)"
				    For I = 1 To NPOINT
				        Print Tab(5); Format$(I, "##");
				        Print Tab(14); Format$(X(I), "0.######");
				        Print Tab(27); Format$(W(I), "0.######")
				    Next I
				    'Demonstrate the use of GAULEG for an integral
				    Call GAULEG(X1, X3, X(), W(), NPOINT)
				    XX = 0#
				    For I = 1 To NPOINT
				        XX = XX + W(I) * FUNC(X(I))
				    Next I
				    Print
				    Print Tab(5); "Integral from GAULEG: "; Format$(XX, "0.######")
				    Print Tab(5); "Actual value: ";
				    Print Tab(20); Format$((1# - (1# + X3) * Exp(-X3)), "0.######")
				End Sub
				Function FUNC(X)
				    FUNC = X * Exp(-X)
				End Function			

相关资源