Liberty BASIC Help Online

Trigonometry
 
Tip:  There are 2 * pi radians in a full circle of 360 degrees.  A formula to convert degrees to radians is:  radians = degrees divided by 57.29577951 Here are some helpful functions to convert degrees to radians, radians to degrees and to calculate PI.
 
function pi()
    pi = asn(1) * 2
end function
 
function rad2deg(num)
    rad2deg = 90 / asn(1) * num
end function
 
function deg2rad(num)
    deg2rad = asn(1) / 90 * num
end function
 
ACS( n )
Description:
This function returns the arc cosine of the number or numeric expression n.  The return value is expressed in radians.
 
Usage:
 
print "The arc cosine of 0.2 is "; acs(0.2)
 
 
ASN( n )
Description:
This function returns the arc sine of the number or numeric expression n.  The return value is expressed in radians.
 
Usage:
 
print "The arc sine of 0.2 is "; asn(0.2)
 
 
ATN( n )
Description:
This function returns the arc tangent of the number or numeric expression n.  The return value is expressed in radians.
 
Usage:
 
print "The arc tangent of 0.2 is "; atn(0.2)
 
 
COS( n )
 
Description:
This function returns the cosine of the angle n.  The angle n should be expressed in radians.
 
Usage:
 
  for c = 1 to 45
    print "The cosine of "; c; " is "; cos(c)
  next c
 
SIN( n )
Description:
  This function returns the sine of the angle n.  The angle n should be expressed in radians.
 
Usage:
 
  for t = 1 to 45
    print "The sine of "; t; " is "; sin(t)
  next t
 
TAN( n )
This function returns the tangent of the angle n.  The angle n should be expressed in radians
 
Usage:
 
  for t = 1 to 45
    print "The tangent of "; t; " is "; tan(t)
  next t


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/