Dim A(101), B(101), C(101), RE(101), IM(101)
Dim M, PP, QQ, CT, ZZ, DP, DQ, EPS, ERR, EN
Sub Main()
'初期化
ERR = 0
For i = 0 To 100
Sheets("Sheet1").Cells(12 + i, 6).Formula = ""
Sheets("Sheet1").Cells(12 + i, 7).Formula = ""
Next i
'初期入力
EPS = Sheets("Sheet1").Cells(9, 3).Value
EN = Sheets("Sheet1").Cells(10, 3).Value
N = Sheets("Sheet1").Cells(11, 3).Value
For i = 0 To N
A(i) = Sheets("Sheet1").Cells(12 + i, 3).Value
RE(i) = 0: IM(i) = 0
Next i
M = N
BEGIN
Sheets("Sheet1").Cells(10, 6).Value = CT
If ERR = 1 Then
Sheets("Sheet1").Cells(13, 6).Formula = "エラー"
Else
For i = 1 To N
Sheets("Sheet1").Cells(12 + i, 6).Value = RE(i)
Sheets("Sheet1").Cells(12 + i, 7).Value = IM(i)
Next i
End If
End Sub
Sub BEGIN()
Do Until M = 0
If M = 1 Then RE(M) = -A(1): Exit Do
PP = 1: QQ = 1
CT = 0
AA = A(0)
For i = 0 To M
A(i) = A(i) / AA
Next i
If M = 2 Then
PP = A(1): QQ = A(2)
Else
REPEAT
End If
QUADRATIC
M = M - 2
For i = 1 To M
A(i) = B(i)
Next i
Loop
End Sub