📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "泰勒展开"
ClientHeight = 2430
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2430
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "About"
Height = 495
Left = 3720
TabIndex = 6
Top = 1200
Width = 855
End
Begin VB.CommandButton Command2
Caption = "End"
Height = 495
Left = 3720
TabIndex = 5
Top = 600
Width = 855
End
Begin VB.CommandButton Command1
Caption = "Ok"
Height = 495
Left = 3720
TabIndex = 4
Top = 0
Width = 855
End
Begin VB.TextBox Text2
Height = 1215
Left = 2040
TabIndex = 1
Text = "0.001"
Top = 480
Width = 1575
End
Begin VB.TextBox Text1
Height = 1215
Left = 0
TabIndex = 0
Text = "0"
Top = 480
Width = 1935
End
Begin VB.Label Label3
Caption = " 本程序中的展开函数亦需要在公共模块f函数的声明处修改。"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 0
TabIndex = 7
Top = 1800
Width = 4695
End
Begin VB.Label Label2
Caption = "请输入求值点"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2040
TabIndex = 3
Top = 0
Width = 1575
End
Begin VB.Label Label1
Caption = " 请输入展开点"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 0
TabIndex = 2
Top = 0
Width = 1935
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()
x0 = CDbl(Text1.Text)
z = CDbl(Text2.Text)
Call Taylor_Exp
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
temp = MsgBox("理学院一队:王元", 64, "关于:作者")
End Sub
Private Sub Taylor_Exp()
Dim t1, t2, t3, q1, q2, q3 As Double
Dim f0, f1, f_1, f2, f_2, f3, f_3, f4, f_4, f5, f_5 As Double
f0 = f(x0)
f1 = f(x0 + h)
f_1 = f(x0 - h)
f2 = f(x0 + 2 * h)
f_2 = f(x0 - 2 * h)
f3 = f(x0 + 3 * h)
f_3 = f(x0 - 3 * h)
f4 = f(x0 + 4 * h)
f_4 = f(x0 - 4 * h)
f5 = f(x0 + 5 * h)
f_5 = f(x0 - 5 * h)
For i = 1 To 4
a(i, 0) = f0
Next i
t1 = f1 - f_1
t2 = f2 - f_2
t3 = f3 - f_3
q1 = f1 + f_1
q2 = f2 + f_2
q3 = f3 + f_3
a(1, 1) = t1 / (2 * h)
a(1, 2) = (q1 - 2 * f0) / (h * h)
a(1, 3) = (t2 - 2 * t1) / (2 * h * h * h)
a(1, 4) = (q2 - 4 * q1 + 6 * f0) / (h * h * h * h)
a(2, 1) = (8 * t1 - t2) / (12 * h)
a(2, 2) = (16 * q1 - q2 - 30 * f0) / (12 * h * h)
a(2, 3) = (8 * t2 - t3 - 13 * t1) / (8 * h * h * h)
a(2, 4) = (12 * q2 - 39 * q1 - q3 + 56 * f0) / (6 * h * h * h * h)
a(3, 1) = (-3 * f0 + 4 * f1 - f2) / (2 * h)
a(4, 1) = (3 * f0 - 4 * f_1 + f_2) / (2 * h)
a(3, 2) = (2 * f0 - 5 * f_1 + 4 * f2 - f3) / (h * h)
a(4, 2) = (2 * f0 - 5 * f_1 + 4 * f2 - f_3) / (h * h)
a(3, 3) = (18 * f1 - 5 * f0 - 24 * f2 - 14 * f3 - 3 * f4) / (2 * h * h * h)
a(4, 3) = (5 * f0 - 18 * f_1 + 24 * f_2 - 14 * f_3 + 3 * f_4) / (2 * h * h * h)
a(3, 4) = (3 * f0 - 14 * f1 + 26 * f2 - 24 * f3 + 11 * f4 - 2 * f5) / (h * h * h * h)
a(4, 4) = (3 * f0 - 14 * f_1 + 26 * f_2 - 24 * f_3 + 11 * f_4 - 2 * f_5) / (h * h * h * h)
For i = 1 To 4
s(i) = a(i, 0) + a(i, 1) * (z - x0) + (a(i, 2) * (z - x0) * (z - x0)) / 2 + (a(i, 3) * (z - x0) * (z - x0) * (z - x0)) / 6 + (a(i, 4) * (z - x0) * (z - x0) * (z - x0) * (z - x0)) / 24
er(i) = 100 * Abs(s(i) - f(z)) / Abs(f(z))
Next i
Form1.Hide
Form2.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -