RosettaCodeData/Task/Trigonometric-functions/Run-BASIC/trigonometric-functions.basic

20 lines
955 B
Plaintext

' Find these three ratios: Sine, Cosine, Tangent. (These ratios have NO units.)
deg = 45.0
' Run BASIC works in radians; so, first convert deg to rad as shown in next line.
rad = deg * (atn(1)/45)
print "Ratios for a "; deg; " degree angle, (or "; rad; " radian angle.)"
print "Sine: "; SIN(rad)
print "Cosine: "; COS(rad)
print "Tangent: "; TAN(rad)
print "Inverse Functions - - (Using above ratios)"
' Now, use those ratios to work backwards to show their original angle in radians.
' Also, use this: rad / (atn(1)/45) = deg (To change radians to degrees.)
print "Arcsine: "; ASN(SIN(rad)); " radians, (or "; ASN(SIN(rad))/(atn(1)/45); " degrees)"
print "Arccosine: "; ACS(COS(rad)); " radians, (or "; ACS(COS(rad))/(atn(1)/45); " degrees)"
print "Arctangent: "; ATN(TAN(rad)); " radians, (or "; ATN(TAN(rad))/(atn(1)/45); " degrees)"
' This code also works in Liberty BASIC.
' The above (atn(1)/45) = approx .01745329252