VB常用数值算法集 内含有解线性代数方程组

源代码在线查看: d9r4.txt

软件大小: 1879 K
上传用户: whyzhao
关键词: 数值算法 解线性 方程
下载地址: 免注册下载 普通下载 VIP

相关代码

				Private Sub Command1_Click()
				    'PROGRAM D9R4
				    'Driver for routine SVDFIT
				    NPT = 100
				    SPREAD = 0.02
				    NPOL = 5
				    Dim X(100), Y(100), SIG(100), A(5), CVM(5, 5)
				    Dim U(100, 5), V(5, 5), W(5)
				    'Polynomial fit
				    IDUM& = -911
				    MP = NPT
				    NP = NPOL
				    For I = 1 To NPT
				        X(I) = 0.02 * I
				        Y(I) = 1# + X(I) * (2# + X(I) * (3# + X(I) * (4# + X(I) * 5#)))
				        Y(I) = Y(I) + SPREAD * GASDEV(IDUM&)
				        SIG(I) = SPREAD
				    Next I
				    Call SVDFIT(X(), Y(), SIG(), NPT, A(), NPOL, U(), V(), W(), MP, NP, CHISQ, "FPOLY")
				    Call SVDVAR(V(), NPOL, NP, W(), CVM(), NPOL)
				    Print
				    Print Tab(5); "Polynomial fit"
				    Print
				    For I = 1 To NPOL
				          Print Tab(5); Format$(A(I), "#.##0000"), " +-",
				          Print Format$(Sqr(CVM(I, I)), ".#####0")
				    Next I
				    Print
				    Print Tab(5); "Chi-squared  "; Format$(CHISQ, "###.####00")
				    Call SVDFIT(X(), Y(), SIG(), NPT, A(), NPOL, U(), V(), W(), MP, NP, CHISQ, "FLEG")
				    Call SVDVAR(V(), NPOL, NP, W(), CVM(), NPOL)
				    Print
				    Print Tab(5); "Legendre polynomial fit"
				    For I = 1 To NPOL
				        Print Tab(5); Format$(A(I), "#.##0000"), " +-",
				        Print Format$(Sqr(CVM(I, I)), ".#####0")
				    Next I
				    Print
				    Print Tab(5); "Chi-squared  "; Format$(CHISQ, "###.####00")
				End Sub			

相关资源