Trigonometry help

RonMex

Member
Joined
Apr 9, 2011
Messages
10
Programming Experience
3-5
i am trying to find the sin (any number *Pi) but for some reason its not working. the result i am getting is the answer of (sin(any number)) * pi
here is an example of my code:

Answer.Text = Sin(variable1 * Math.PI)

****note variable1 is user input


thank you for all the help so far, really appreciate it.
 
Answer.Text = Sin(variable1 * Math.PI)
The inner expression is evaluated first, then Sin of that.
It is possible that you are confused about Math.Sin operating in radians.
 
Are you sure that is what the problem is? Have you considered the fact that Math.Sin expects a value in Radians and not Degrees?

Math.Sin Method (System)
 
Last edited:
The inner expression is evaluated first, then Sin of that.
It is possible that you are confused about Math.Sin operating in radians.

i know it operates in radians. when i try sin(2*pi) i should get 0. but i get 2.8566.... instead.
 
Well, my code gives 0 (or as close to 0 as possible).

VB.NET:
        Dim AngleInRadians As Double = 2.0
        Dim Result As Double = Math.Sin(AngleInRadians * Math.PI)
        MessageBox.Show(Result.ToString)
 
Well, my code gives 0 (or as close to 0 as possible).

VB.NET:
        Dim AngleInRadians As Double = 2.0
        Dim Result As Double = Math.Sin(AngleInRadians * Math.PI)
        MessageBox.Show(Result.ToString)


this is similar to my code instead of declaring a variable to be a number, it can be a user input. it works when a put 3.14159 instead of math.pi. its weird
 
Back
Top