|
解四次方程的代码如下:
Private Sub Command1_Click()
Dim a, b, c, d, f, g
Dim ja, jb, jc
k = DeleteSpace(Text1.Text)
ja = DeleteSpace(Text2.Text)
jb = DeleteSpace(Text3.Text)
jc = DeleteSpace(Text4.Text)
jd = DeleteSpace(Text5.Text)
sd1 = DeleteSpace(Text15.Text)
If Abs(Val(sd1)) <= 10 Then
sd = 10 + 2
Else
If Len(sd1) > 3 And Abs(Val(sd1)) > 300 Then
sd = 300 + 2
Else
sd = Int(Abs(Val(sd1))) + 2
End If
End If
a2 = zhengliys2(Trim(ja), Val(sd))
b2 = zhengliys2(Trim(jb), Val(sd))
c2 = zhengliys2(Trim(jc), Val(sd))
D2 = zhengliys2(Trim(jd), Val(sd))
k2 = zhengliys2(Trim(k), Val(sd))
If MBJC(Trim(k2), 0) = 0 Then
Text4.Text = "a 不能为 0"
Text5.Text = "a 为 0可能已不是1元4次方程"
Else
a3 = mcc2(Trim(a2), Trim(k2), Val(sd))
b3 = mcc2(Trim(b2), Trim(k2), Val(sd))
c3 = mcc2(Trim(c2), Trim(k2), Val(sd))
d3 = mcc2(Trim(D2), Trim(k2), Val(sd))
jk = 8 & String(sd, "0")
ja1 = mbc2("-4" & String(sd, "0"), Trim(b3), Val(sd))
jb1 = mpc2(mbc2(2 & String(sd, "0"), mbc2(Trim(a3), Trim(c3), Val(sd)), Val(sd)), mbc2(8 & String(sd, "0"), Trim(d3), Val(sd)))
jc1 = mpc2(mbc2(Trim(d3), mpc2(mbc2(4 & String(sd, "0"), Trim(b3), Val(sd)), mbc2(Trim(a3), Trim(a3), Val(sd))), Val(sd)), mbc2(Trim(c3), Trim(c3), Val(sd)))
y = jie3cifc(Trim(ja1), Trim(jb1), Trim(jc1), Trim(jk), Val(sd))
Y1 = zhengliys2(Trim(y), Val(sd))
End If
Text6 = zhengliys2(Trim(y), Val(sd))
Text8 = y
za = 1 & String(sd, "0")
z2 = mpc2(mpc3(mbc2(8 & String(sd, "0"), Trim(Y1), Val(sd)), mbc2(Trim(a3), Trim(a3), Val(sd))), mbc2(4 & String(sd, "0"), Trim(b3), Val(sd)))
z2 = mbbc2(qdfh(Trim(z2)), Val(sd))
zb1 = mcc2(mpc3(Trim(a3), Trim(z2)), 2 & String(sd, "0"), Val(sd))
zb2 = mcc2(mpc2(Trim(a3), Trim(z2)), 2 & String(sd, "0"), Val(sd))
zc1 = mpc3(Trim(Y1), mcc2(mpc2(mbc2(Trim(a3), Trim(Y1), Val(sd)), Trim(c3)), Trim(z2), Val(sd)))
zc2 = mpc2(Trim(Y1), mcc2(mpc2(mbc2(Trim(a3), Trim(Y1), Val(sd)), Trim(c3)), Trim(z2), Val(sd)))
y3 = jie2cifc(Trim(za), Trim(zb1), Trim(zc1), Val(sd))
y4 = jie2cifc(Trim(za), Trim(zb2), Trim(zc2), Val(sd))
Text9 = y3
Text10 = y4
Text14.Text = Text14.Text & " 输入" & ": " & "a=" & k & ", b=" & ja & ", c=" & jb & ", d=" & jc _
& ",e=" & jd & "; 输出结果" & ": " & "x1,2=" & Text9.Text & ", x3,4=" & Text10.Text
End Sub |
|