Coding Tan, Sine, and Cosine
Mmmmmm bit of problem today.
I am coding a calculator except i need Tangent, Sine, and Cosine. Problem is how do i code them?? Is there a number combo for them or....yteah well how?? :ehh:
Any help would be Graciously accepted. :bigyello:
From Darcey Pollard - President of Evil Penguin Enterprises :)
Re: Coding Tan, Sine, and Cosine
Try using the "Tan", "Sin" and "Cos" commands. I've never had call to use them but know they're there :)
Re: Coding Tan, Sine, and Cosine
Re: Coding Tan, Sine, and Cosine
How would i code that for a calculator??
Re: Coding Tan, Sine, and Cosine
Those are the functions you will need.
Example:
VB Code:
txtResult=TAN('your number')
Re: Coding Tan, Sine, and Cosine
any way to get inverse ratios?
Re: Coding Tan, Sine, and Cosine
Quote:
Originally Posted by Netterhead1
any way to get inverse ratios?
VB supports Sin(), Cos(), Tan()
The rest you can get simply as you do in maths:
Cot = 1/Tan(x)
Sec = 1/Cos(x)
Cosec = 1/Sin(x)
Pradeep :)
Re: Coding Tan, Sine, and Cosine
As in math, all others can be derived from those three functions.
Re: Coding Tan, Sine, and Cosine
Also, we all forgot Atn() which is arctangens.
Look at this page: http://www.engineering.usu.edu/cee/f...s_Examples.htm
it has great examples. It has the examples for working with trigonometry
Re: Coding Tan, Sine, and Cosine
Usually when people talk about inverse functions in trigonometry they are referring to the functions ArcCos, ArcSin and ArcTan.
Since the ArcTan function is built in, here is how to get the other two
VB Code:
Option Explicit
Const Pi = 3.14159265358979
Const PiOn2 = 1.5707963267949
Function ACos(x As Double) As Double
ACos = PiOn2 - Atn(x / Sqr(1 - x ^ 2))
End Function
Function ASin(x As Double) As Double
ASin = Atn(x / Sqr(1 - x ^ 2))
End Function