软件所用版本:Windows Server 2012 R2、VB6简体精简版.exe
目录
第1章 VB6.0数值计算
1.1数值积分
1.2行列式
1.3复数运算
1.3.1 复数乘法
1.3.2 复数次幂
1.3.3 实数次幂
1.3.4 复数对数
第2章 Visual Basic语言知识点
2.1 调用Windows API
2.2 循环语句例子——生成循环群C_n的凯莱表Cn.exe
实现下列群论小工具的VB6.0版本:
1、实现一个复数字符串解析的函数,函数原型为vector<double> atodc(const string &s),复数字符串非法就返回空容器,否则就返回实部和虚部。
2、实现一个矩阵字符串解析的函数,函数原型为vector<vector<double>> atomtx(const char* strMtx);和vector<int> IsLegalMtx(const vector<vector<double>> &mtx)矩阵字符串非法就返回-1,否则就返回0,行数,列数。
3、输入两个有限群的凯莱表D4.txt,C2.txt,输出它们直积群的凯莱表D4C2.txt。
4、输入一个有限群的凯莱表D4C2.txt,输出它的结构分析D4C2_ElementToOrder.txt。
Private Sub Command1_Click()
On Error Resume Next
n! = InputBox("请输入n:")
For i = 0 To n - 1
For j = i To i + n - 1
s = s & (j Mod n + 1) & " "
Next j
s = s & Chr(13) & Chr(10)
Next i
Text1.Text = s
End Sub
Private Sub Form_Load()
'Text1.MultiLine = True只读属性
Command1.Caption = "Cn"
End Sub
Function nitrapzd(a As Double, b As Double, eps As Double) As Double
Dim n As Integer, k As Integer
Dim fa As Double, fb As Double, h As Double, t1 As Double, p As Double, s As Double, x As Double, t As Double
fa = func(a): fb = func(b)
n = 1: h = b - a: t1 = h * (fa + fb) / 2#
p = eps + 1#
While (p >= eps)
s = 0#
For k = 0 To n - 1
x = a + (k + 0.5) * h
s = s + func(x)
Next k
t = (t1 + h * s) / 2#
p = Abs(t1 - t)
t1 = t
n = n + n
h = h / 2#
Wend
nitrapzd = t
End Function
Function func(x As Double) As Double
func = Exp(-x * x)
End Function
Private Sub Command1_Click()