|
ATAN(x)计算程序:
Dim Pi As Double
Private Sub CommandButton1_Click()
x = Sheet1.Cells(2, 1)
Pi = 3.141592654
If x = 0 Then
Sheet1.Cells(3, 1) = 0
Sheet1.Cells(3, 2) = 0
Exit Sub
End If
x1 = Abs(x)
If Abs(x) > 1 Then
x1 = 1 / Abs(x)
End If
y = x1
L = 0
jd = 0.0000000001
100 If L <= 100000 Then
y1 = y - (Tan(y) - x1) / (1 + (Tan(y)) ^ 2)
If Abs(y1 - y) > jd Then
y = y1
L = L + 1
GoTo 100
End If
End If
Sheet1.Cells(3, 1) = x / Abs(x) * y
If Abs(x) > 1 Then
Sheet1.Cells(3, 1) = x / Abs(x) * (Pi / 2 - y)
End If
Sheet1.Cells(3, 2) = L
End Sub
ASIN(x)计算程序:
Private Sub CommandButton2_Click()
x = Sheet1.Cells(5, 1)
y = x
L = 0
jd = 0.0000000001
100 If L <= 100000 Then
y1 = y - (Sin(y) - x) / Cos(y)
If Abs(y1 - y) > jd Then
y = y1
L = L + 1
GoTo 100
End If
End If
Sheet1.Cells(6, 1) = y
Sheet1.Cells(6, 2) = L
End Sub
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-9-19 04:23
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社