標題:
[發問]
VBA裡的三角函數
[打印本頁]
作者:
lifedidi
時間:
2013-6-4 09:13
標題:
VBA裡的三角函數
大大好,請問:
我在函數裡表示為:=COS(12度*PI()/180)
請問在VBA裡要如何表示呢?
EX:
textbox1:50
textbox2:val(textbox1) * COS(12度*PI()/180)
謝謝!
作者:
cji3cj6xu6
時間:
2013-6-4 10:02
網路上看到的,不曉得合用否∼
導出的數學函數
以下為非基本數學函數的列表,皆可由基本數學函數導出:
函數 由基本函數導出之公式
Secant(正割) Sec(X) = 1 / Cos(X)
Cosecant(余割) Cosec(X) = 1 / Sin(X)
Cotangent(餘切) Cotan(X) = 1 / Tan(X)
Inverse Sine
(反正弦)
Arcsin(X) = Atn(X / Sqr(-X * X + 1))
Inverse Cosine
(反余弦)
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
Inverse Secant
(反正割)
Arcsec(X) = Atn(X / Sqr(X * X - 1)) + Sgn((X) - 1) * (2 * Atn(1))
Inverse Cosecant
(反余割)
Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 * Atn(1))
Inverse Cotangent
(反餘切)
Arccotan(X) = Atn(X) + 2 * Atn(1)
Hyperbolic Sine
(雙曲正弦)
HSin(X) = (Exp(X) - Exp(-X)) / 2
Hyperbolic Cosine
(雙曲余弦)
HCos(X) = (Exp(X) + Exp(-X)) / 2
Hyperbolic Tangent
(雙曲正切)
HTan(X) = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
Hyperbolic Secant
(雙曲正割)
HSec(X) = 2 / (Exp(X) + Exp(-X))
Hyperbolic Cosecant(雙曲余割) HCosec(X) = 2 / (Exp(X) - Exp(-X))
Hyperbolic Cotangent(雙曲餘切) HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
Inverse Hyperbolic Sine(反雙曲正弦) HArcsin(X) = Log(X + Sqr(X * X + 1))
Inverse Hyperbolic Cosine(反雙曲余弦) HArccos(X) = Log(X + Sqr(X * X - 1))
Inverse Hyperbolic Tangent(反雙曲正切) HArctan(X) = Log((1 + X) / (1 - X)) / 2
Inverse Hyperbolic Secant(反雙曲正割) HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X)
Inverse Hyperbolic Cosecant HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X)
Inverse Hyperbolic Cotangent
(反雙曲餘切)
HArccotan(X) = Log((X + 1) / (X - 1)) / 2
以 N 為底的對數 LogN(X) = Log(X) / Log(N)
'具體定義如下:
Public Function ArcSin(ByVal X As Double) As Double '反正弦
ArcSin = Atn(X / Sqr(-X * X + 1))
End Function
Public Function ArcCos(ByVal X As Double) As Double '反余弦
ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
Public Function ArcCoTan(ByVal X As Double) As Double '反正割
ArcCoTan = Atn(X) + 2 * Atn(1)
End Function
Public Function Sec(ByVal X As Double) As Double '正割
Sec = 1 / Cos(X)
End Function
Public Function CoSec(ByVal X As Double) As Double '余割
CoSec = 1 / Sin(X)
End Function
Public Function CoTan(ByVal X As Double) As Double '餘切
CoTan = 1 / Tan(X)
End Function
Public Function ArcCoSec(ByVal X As Double) As Double '反余割
ArcCoSec = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 * Atn(1))
End Function
Public Function ArcCoTan(ByVal X As Double) As Double '反餘切
ArcCoTan = Atn(X) + 2 * Atn(1)
End Function
Public Function HSin(ByVal X As Double) As Double '雙曲正弦
HSin = (Exp(X) - Exp(-X)) / 2
End Function
Public Function HCos(ByVal X As Double) As Double '雙曲余弦
HCos = (Exp(X) + Exp(-X)) / 2
End Function
Public Function HTan(ByVal X As Double) As Double '雙曲正切
HTan = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
End Function
Public Function HSec(ByVal X As Double) As Double '雙曲正割
HSec = 2 / (Exp(X) + Exp(-X))
End Function
Public Function HCosec(ByVal X As Double) As Double '雙曲余割
HCosec = 2 / (Exp(X) - Exp(-X))
End Function
Public Function HCotan(ByVal X As Double) As Double '雙曲餘切
HCotan = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
End Function
Public Function HArcsin(ByVal X As Double) As Double '反雙曲正弦
HArcsin = Log(X + Sqr(X * X + 1))
End Function
Public Function HArccos(ByVal X As Double) As Double '反雙曲余弦
HArccos = Log(X + Sqr(X * X - 1))
End Function
Public Function HArcsec(ByVal X As Double) As Double '反雙曲正割
HArcsec = Log((Sqr(-X * X + 1) + 1) / X)
End Function
Public Function HArccosec(ByVal X As Double) As Double '反雙曲余割
HArccosec = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X)
End Function
Public Function HArccotan(ByVal X As Double) As Double '反雙曲餘切
HArccotan = Log((X + 1) / (X - 1)) / 2
End Function
Public Function LogN(ByVal X As Double) As Double '以 N 為底的對數
LogN = Log(X) / Log(N)
End Function
作者:
stillfish00
時間:
2013-6-4 10:28
回復
1#
lifedidi
= Cos(12 * WorksheetFunction.Pi() / 180)
textbox2.value = textbox1.value*Cos(12 * WorksheetFunction.Pi() / 180)
作者:
lifedidi
時間:
2013-6-4 16:47
感謝大大!我之前用3.14算出來的值有誤差,現在ok了!謝謝!
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)