发布网友 发布时间:2022-04-25 05:12
共1个回答
热心网友 时间:2023-10-28 19:22
?AInv (0.02842)
24.5822867713287
Public Function Inv(a As Double) As Double
Inv = Tan(a) - a
End Function
Public Function AInv(num As Double) As Double
Dim lowangle As Double
Dim highangle As Double
Dim midangle As Double
lowangle = 0
highangle = Atn(1) * 2
Do While highangle - lowangle > 10 ^ -12
midangle = (lowangle + highangle) / 2
If Inv(midangle) > num Then
highangle = midangle
Else
lowangle = midangle
End If
Loop
AInv = (lowangle + highangle) / 2 / Atn(1) * 45
End Function
加个牛顿法的
Public Function AInv2(num As Double) As Double
Dim x1 As Double
Dim x2 As Double
x2 = Atn(1)
Do
x1 = x2
x2 = x1 - (Tan(x1) - x1 - num) / (1 / Cos(x1) ^ 2 - 1)
Loop While Abs(x2 - x1) > 10 ^ -12
AInv2 = x2 / Atn(1) * 45
End Function