?? d4r21.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5520
ClientLeft = 1860
ClientTop = 750
ClientWidth = 4635
LinkTopic = "Form1"
ScaleHeight = 5520
ScaleWidth = 4635
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 375
Left = 2640
TabIndex = 0
Top = 4800
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'PROGRAM D4R21
'Driver for routine BESSI0
Open "D:\VB常用數值算法集\DATA\FNCVAL.DAT" For Input As #1
Do
Line Input #1, Text$
Loop While Text$ <> "Modified Bessel Function I0"
Line Input #1, NVAL$
NVAL = Val(NVAL$)
Print Text$
Print
Print " X Actual BESSI0(X)"
For I = 1 To NVAL
Line Input #1, DUM$
X = Val(Mid(DUM$, 1, 6))
Value = Val(Mid(DUM$, 7))
Print Tab(4); Format$(X, "#0.##");
Print Tab(12); Format$(Value, ".0000000E+00");
Print Tab(28); Format$(BESSI0(X), ".0000000E+00")
Next I
Close #1
End Sub
Function BESSI0(X)
P1 = 1#: P2 = 3.5156229
P3 = 3.0899424: P4 = 1.2067492
P5 = 0.2659732: P6 = 0.0360768
P7 = 0.0045813
Q1 = 0.39894228: Q2 = 0.01328592
Q3 = 0.00225319: Q4 = -0.00157565
Q5 = 0.00916281: Q6 = -0.02057706
Q7 = 0.02635537: Q8 = -0.01647633
Q9 = 0.00392377
If Abs(X) < 3.75 Then
Y = (X / 3.75) ^ 2
AAA = Y * (P5 + Y * (P6 + Y * P7))
BESSI0 = P1 + Y * (P2 + Y * (P3 + Y * (P4 + AAA)))
Else
AX = Abs(X)
Y = 3.75 / AX
AAA = Exp(AX) / Sqr(AX)
BBB = Q4 + Y * (Q5 + Y * (Q6 + Y * (Q7 + Y * (Q8 + Y * Q9))))
BESSI0 = AAA * (Q1 + Y * (Q2 + Y * (Q3 + Y * BBB)))
End If
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -