The SIN() function is used to calculate the sine of a given angle (in radians).
Definition and Usage
- The
SIN()function returns the sine of a number, which is a trigonometric function. - The number provided is interpreted as an angle in radians.
Syntax
SIN(number)
Parameter Values
| Parameter | Description |
|---|---|
number |
The angle, in radians, to calculate the sine of. |
Technical Details
- Works in: From MySQL 4.0
- Return Value: A floating-point number, representing the sine of the given angle.
Examples
Example 1: Sine of a number
SELECT SIN(2);
Output (approximately):
0.9092974268256817
Example 2: Sine of a negative number
SELECT SIN(-1);
Output (approximately):
-0.8414709848078965
Example 3: Sine of 0
SELECT SIN(0);
Output:
0
Example 4: Use in a column
To calculate the sine of values in a column:
SELECT AngleInRadians, SIN(AngleInRadians) AS SineValue
FROM AnglesTable;
Output (example):
| AngleInRadians | SineValue |
|---|---|
| 0 | 0 |
| 1 | 0.84147 |
| 2 | 0.90930 |
Use Cases
- Useful in mathematical and engineering calculations.
- Applied in physics, navigation, and computer graphics for angle-based calculations.
Related Functions
COS(): Returns the cosine of a number (in radians).TAN(): Returns the tangent of a number (in radians).DEGREES(): Converts radians to degrees.RADIANS(): Converts degrees to radians.