The built-in trigonometric functions have the following syntax.
Trigonometric Functions: |--+-+-COS-+--(--radian_ expr--)------+-------------------------| | +-SIN-+ | | '-TAN-' | '-+-+-ASIN-+--(--numeric_expr--)-+-' | +-ACOS-+ | | '-ATAN-' | '-ATAN2--(--y, x--)------------'
Element | Description | Restrictions | Syntax |
---|---|---|---|
numeric_expr | Expression that serves as an argument to the ASIN, ACOS, or ATAN functions | Must return a value between -1 and 1, inclusive | Expression, p. Expression |
radian_expr | Expression that represents the number of radians | Must return a numeric value | Expression, p. Expression |
x | Expression that represents the x coordinate of the rectangular coordinate pair (x, y) | Must return a numeric value | Expression, p. Expression |
y | Expression that represents the y coordinate of the rectangular coordinate pair (x, y) | Must return a numeric value | Expression, p. Expression |
The COS, SIN, and TAN functions take the number of radians (radian_expr) as an argument. If you are using degrees and want to convert degrees to radians, use the following formula:
# degrees * p/180= # radians
To convert radians to degrees, use the following formula:
# radians * 180/p = # degrees
The COS function returns the cosine of a radian expression. The following example returns the cosine of the values of the degrees column in the anglestbl table. The expression passed to the COS function in this example converts degrees to radians.
SELECT COS(degrees*180/3.1416) FROM anglestbl
The SIN function returns the sine of a radian expression. This example returns the sine of the values in the radians column of the anglestbl table:
SELECT SIN(radians) FROM anglestbl
The TAN function returns the tangent of a radian expression. This example returns the tangent of the values in the radians column of the anglestbl table:
SELECT TAN(radians) FROM anglestbl
The ACOS function returns the arc cosine of a numeric expression. The following example returns the arc cosine of the value (-0.73) in radians:
SELECT ACOS(-0.73) FROM anglestbl
The ASIN function returns the arc sine of a numeric expression. The following example returns the arc sine of the value (-0.73) in radians:
SELECT ASIN(-0.73) FROM anglestbl
The ATAN function returns the arc tangent of a numeric expression. The following example returns the arc tangent of the value (-0.73) in radians:
SELECT ATAN(-0.73) FROM anglestbl
The ATAN2 function computes the angular component of the polar coordinates (r, q) associated with (x, y). The following example compares angles to q for the rectangular coordinates (4, 5):
WHERE angles > ATAN2(4,5) --determines q for (4,5) and --compares to angles
You can determine the length of the radial coordinate r using the expression that the following example shows:
SQRT(POW(x,2) + POW(y,2)) --determines r for (x,y)
You can determine the length of the radial coordinate r for the rectangular coordinates (4,5) using the expression that the following example shows:
SQRT(POW(4,2) + POW(5,2)) --determines r for (4,5)Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]