Sine, Cosine and Tan Functions

posted Jan 13, 2013, 1:04 PM by Karwan Jacksi   [ updated Jan 13, 2013, 1:07 PM ]
Hello,

Some students have asked me that there is an error while calculating the sine, cosine and tangent  functions. I'd like to tell you that there are no errors in these functions, but they take angles expressed in radians (ask you calculus teacher), while the angles you give them are in degrees. To convert the degrees to radians you have to multiply the radians by  π/180.  π is equal to 3.1415.... use calculator to find it!

Example:

double ang, ang2;
cout<<"\nEnter Angle: ";
cin>>ang;                            // this is in degrees
ang = ang *  3.1415 / 180;     //conversion to radians
ang2 = sin(ang); 
cout<<"\n\nSine of Angle is: "<<ang2;


Regards,
Karwan
Comments