sin() : Sine Function
On this page
Summary
Calculate the sine of an angle (in radians).
Signature
sin(angleInRadians)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
angleInRadians |
Number | Yes | The angle in radians |
Returns
Type: Double
The sine of the angle (value between -1 and 1).
Examples
Basic Sine
Output:
<p>sin(π/2) = 1.000</p>
Convert Degrees to Radians First
Output:
<p>sin(30°) = 0.500</p>
<p>sin(45°) = 0.707</p>
<p>sin(90°) = 1.000</p>
Calculate Wave Position
Data:
doc.Params["model"] = new {
amplitude = 10,
angle = Math.PI / 4 // 45 degrees
};
Output:
<p>Y = 7.07</p>
Notes
- Input must be in radians (not degrees)
- Returns value between -1 and 1
- For degrees, use:
sin(radians(degrees)) - Common values:
- sin(0) = 0
- sin(π/6) = 0.5
- sin(π/4) ≈ 0.707
- sin(π/2) = 1