⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 大学里数学系必学的一们课程数值分析中的经典算法————hermit插值的程序vb版本
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6810
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8730
   LinkTopic       =   "Form1"
   ScaleHeight     =   6810
   ScaleWidth      =   8730
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text8 
      Height          =   1215
      Left            =   1920
      TabIndex        =   15
      Top             =   3960
      Width           =   5895
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算对应的y值"
      Height          =   735
      Left            =   1200
      TabIndex        =   14
      Top             =   5520
      Width           =   5655
   End
   Begin VB.TextBox Text7 
      Height          =   855
      Left            =   3240
      TabIndex        =   12
      Text            =   "0"
      Top             =   2400
      Width           =   2535
   End
   Begin VB.TextBox Text6 
      Height          =   615
      Left            =   6360
      TabIndex        =   5
      Text            =   "0.5"
      Top             =   1200
      Width           =   1575
   End
   Begin VB.TextBox Text5 
      Height          =   615
      Left            =   3360
      TabIndex        =   4
      Text            =   "2"
      Top             =   1200
      Width           =   1575
   End
   Begin VB.TextBox Text4 
      Height          =   615
      Left            =   720
      TabIndex        =   3
      Text            =   "1"
      Top             =   1200
      Width           =   1575
   End
   Begin VB.TextBox Text3 
      Height          =   615
      Left            =   6360
      TabIndex        =   2
      Text            =   "0.5"
      Top             =   240
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      Height          =   615
      Left            =   3360
      TabIndex        =   1
      Text            =   "1"
      Top             =   240
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   615
      Left            =   720
      TabIndex        =   0
      Text            =   "0"
      Top             =   240
      Width           =   1575
   End
   Begin VB.Label Label8 
      Caption         =   "Hermite插值的结果"
      Height          =   1215
      Left            =   840
      TabIndex        =   16
      Top             =   3960
      Width           =   975
   End
   Begin VB.Label Label7 
      Caption         =   "在此输入你要的x值:"
      Height          =   735
      Left            =   2280
      TabIndex        =   13
      Top             =   2400
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "f'(x1)"
      Height          =   615
      Left            =   5640
      TabIndex        =   11
      Top             =   1200
      Width           =   615
   End
   Begin VB.Label Label5 
      Caption         =   "f'(x0)"
      Height          =   615
      Left            =   5640
      TabIndex        =   10
      Top             =   240
      Width           =   615
   End
   Begin VB.Label Label4 
      Caption         =   "f(x1)"
      Height          =   615
      Left            =   2760
      TabIndex        =   9
      Top             =   1200
      Width           =   615
   End
   Begin VB.Label Label3 
      Caption         =   "f(x0)"
      Height          =   615
      Left            =   2760
      TabIndex        =   8
      Top             =   240
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "x1"
      Height          =   615
      Left            =   120
      TabIndex        =   7
      Top             =   1200
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "x0"
      Height          =   615
      Left            =   120
      TabIndex        =   6
      Top             =   240
      Width           =   615
   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()
Dim x As Double
Dim y As Double

Dim x0 As Double
Dim x1 As Double
Dim y0 As Double
Dim y1 As Double

Dim t0 As Double
Dim t1 As Double

Dim h0 As Double
Dim hh0 As Double
Dim h1 As Double
Dim hh1 As Double


x0 = Text1.Text
y0 = Text2.Text
t0 = Text3.Text
x1 = Text4.Text
y1 = Text5.Text
t1 = Text6.Text
x = Text7.Text

h0 = (1 + 2 * (x - x0) / (x1 - x0)) * (x - x1) * (x - x1) / ((x0 - x1) * (x0 - x1))
h1 = (1 + 2 * (x - x1) / (x0 - x1)) * (x - x0) * (x - x0) / ((x1 - x0) * (x1 - x0))

h00 = (x - x0) * (x - x1) * (x - x1) / ((x0 - x1) * (x0 - x1))
h11 = (x - x1) * (x - x0) * (x - x0) / ((x1 - x0) * (x1 - x0))

y = y0 * h0 + y1 * h1 + t0 * h00 + t1 * h11
Text8.Text = ccstr(y)





End Sub


Function ccstr(a As Double)


  If 0 < a And a < 1 Then ccstr = "0" + CStr(a) '特殊情况 为-1到1 之间的数字
  If -1 < a And a < 0 Then ccstr = "-0" + CStr(Abs(a))
  If CStr(a) = "0" Then ccstr = "0"
  If Abs(a) >= 1 Then ccstr = CStr(a)
      
  End Function
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -