VB icon

Math Functions (trigonometry)

Email
Submitted on: 1/7/2015 5:08:00 AM
By: Adam Orenstein (from psc cd)  
Level: Advanced
User Rating: By 4 Users
Compatibility: VB 5.0, VB 6.0
Views: 805
 
     this here is a whole bunch of math functions! Too many for me to list right here so come in and check em' all out
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Math Functions (trigonometry)
' Description:this here is a whole bunch of math functions! Too many for me to list right here so come in and check em' all out
' By: Adam Orenstein (from psc cd)
'**************************************

Public Function InvSin(Number As Double) As Double
 InvSin = CutDecimal(Atn(Number / Sqr(-Number * Number + 1)), 87)
End Function
Public Function InvCos(Number As Double) As Double
 InvCos = Atn(-Number / Sqr(-Number * Number + 1)) + 2 * Atn(1)
End Function
Public Function InvSec(Number As Double) As Double
 InvSec = Atn(Number / Sqr(Number * Number - 1)) + Sgn((Number) - 1) * (2 * Atn(1))
End Function
Public Function InvCsc(Number As Double) As Double
 InvCsc = Atn(Number / Sqr(Number * Number - 1)) + (Sgn(Number) - 1) * (2 * Atn(1))
End Function
Public Function InvCot(Number As Double) As Double
 InvCot = Atn(Number) + 2 * Atn(1)
End Function
Public Function Sec(Number As Double) As Double
 Sec = 1 / Cos(Number * PI / 180)
End Function
Public Function Csc(Number As Double) As Double
 Csc = 1 / Sin(Number * PI / 180)
End Function
Public Function Cot(Number As Double) As Double
 Cot = 1 / Tan(Number * PI / 180)
End Function
Public Function HSin(Number As Double) As Double
 HSin = (Exp(Number) - Exp(-Number)) / 2
End Function
Public Function HCos(Number As Double) As Double
 HCos = (Exp(Number) + Exp(-Number)) / 2
End Function
Public Function HTan(Number As Double) As Double
 HTan = (Exp(Number) - Exp(-Number)) / (Exp(Number) + Exp(-Number))
End Function
Public Function HSec(Number As Double) As Double
 HSec = 2 / (Exp(Number) + Exp(-Number))
End Function
Public Function HCsc(Number As Double) As Double
 HCsc = 2 / (Exp(Number) + Exp(-Number))
End Function
Public Function HCot(Number As Double) As Double
 HCot = (Exp(Number) + Exp(-Number)) / (Exp(Number) - Exp(-Number))
End Function
Public Function InvHSin()
 InvHSin = Log(Number + Sqr(Number * Number + 1))
End Function
Public Function InvHCos(Number As Double) As Double
 InvHCos = Log(Number + Sqr(Number * Number - 1))
End Function
Public Function InvHTan(Number As Double) As Double
 InvHTan = Log((1 + Number) / (1 - Number)) / 2
End Function
Public Function InvHSec(Number As Double) As Double
 InvHSec = Log((Sqr(-Number * Number + 1) + 1) / Number)
End Function
Public Function InvHCsc(Number As Double) As Double
 InvHCsc = Log((Sgn(Number) * Sqr(Number * Number + 1) + 1) / Number)
End Function
Public Function InvHCot(Number As Double) As Double
 InvHCot = Log((Number + 1) / (Number - 1)) / 2
End Function
Public Function Percent(is_ As Double, of As Double) As Double
 Percent = is_ / of * 100
End Function


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.