QBasic Information Center Tutorials - Trigonometry Functions
These tutorials were written to help you get a quick, but thorough, understanding of QBasic -
the scope of the language as well as it's specific capabilities.
Arithmetic Functions Summary
As languages go, QBasic provides relatively few arithmetic functions.
Example usage of each function is provided below, but as you can
see the functions are very simple to use. The arithmetic functions
can be categorized roughly into four areas:
Radians
The cos/sin/tan functions require an argument expressed in radians. The
conversion factor is 1 radian = 57.2957795 degrees.
A full circle is 360 degrees, which is 2*pi = 2 * 3.14159 or about 6.28 radians.
180 degrees = 3.14 radians, 90 degrees = 1.57 radians, 45 degrees = 0.7854 radians
Trigonometric Function Reference
Here's a quick reference of the available trigonometric functions, in alphabetical
order. The functions are very simple to use, but be sure to enter the angles
in radians.
- atn - arctangent of numeric expression
result = atn (42) # returns 1.546991
- cos - cosine of angle (in radians)
result = cos (45) # returns 0.525322
- sin - sine of angle (in radians)
result = sin (45) # returns 0.850935
- tan - tangent of angle (in radians)
result = tan (45) # returns 1.619775
|