Important Math functions in Visual Basic
Posted: Mon Oct 05, 2009 1:53 pm
Secant
Cosecant
Cotangent
Inverse Sine
Inverse Cosine
Inverse Secant
Inverse Cosecant
Inverse Cotangent
Hyperbolic Sine
Hyperbolic Cosine
Hyperbolic Tangent
Hyperbolic Secant
Hyperbolic Cosecant
Hyperbolic Cotangent
Inverse Hyperbolic Sine
Inverse Hyperbolic Cosine
Inverse Hyperbolic Tangent
Inverse Hyperbolic Secant
Inverse Hyperbolic Cosecant
Inverse Hyperbolic Cotangent
Logarithm to base N
Code: Select all
Public Function Sec(X As Double) As Double
Sec = 1 / Cos(X)
End Function
Code: Select all
Public Function CoSec(X As Double) As Double
CoSec = 1 / Sin(X)
End Function
Code: Select all
Public Function CoTan(X As Double) As Double
CoTan = 1 / Tan(X)
End Function
Code: Select all
Public Function ArcSin(X As Double) As Double
ArcSin = Atn(X / Sqr(-X * X + 1))
End Function
Code: Select all
Public Function ArcCos(X As Double) As Double
ArcCos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
End Function
Code: Select all
Public Function ArcSec(X As Double) As Double
ArcSec = Atn(X / Sqr(X * X - 1)) + Sgn(X - 1) * (2 * Atn(1))
End Function
Code: Select all
Public Function ArcCoSec(X As Double) As Double
ArcCoSec = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 * Atn(1))
End Function
Code: Select all
Public Function ArcCoTan(X As Double) As Double
ArcCoTan = Atn(X) + 2 * Atn(1)
End Function
Code: Select all
Public Function HSin(X As Double) As Double
HSin = (Exp(X) - Exp(-X)) / 2
End Function
Code: Select all
Public Function HCos(X As Double) As Double
HCos = (Exp(X) + Exp(-X)) / 2
End Function
Code: Select all
Function HTan(X As Double) As Double
HTan = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
End Function
Code: Select all
Public Function HSec(X As Double) As Double
HSec = 2 / (Exp(X) + Exp(-X))
End Function
Code: Select all
Public Function HCoSec(X As Double) As Double
HCoSec = 2 / (Exp(X) - Exp(-X))
End Function
Code: Select all
Public Function HCotan(X As Double) As Double
HCotan = (Exp(X) + Exp(-X)) / (Exp(X) - Exp(-X))
End Function
Code: Select all
Public Function HArcSin(X As Double) As Double
HArcSin = Log(X + Sqr(X * X + 1))
End Function
Code: Select all
Public Function HArcCos(X As Double) As Double
HArcCos = Log(X + Sqr(X * X - 1))
End Function
Code: Select all
Function HArcTan(X As Double) As Double
HArcTan = Log((1 + X) / (1 - X)) / 2
End Function
Code: Select all
Public Function HArcSec(X As Double) As Double
HArcSec = Log((Sqr(-X * X + 1) + 1) / X)
End Function
Code: Select all
Public Function HArcCoSec(X As Double) As Double
HArcCoSec = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X)
End Function
Code: Select all
Public Function HArcCoTan(X As Double) As Double
HArcCoTan = Log((X + 1) / (X - 1)) / 2
End Function
Code: Select all
Public Function LogN(X As Double, n As Double) As Double
LogN = Log(X) / Log(n)
End Function