2022-07-23 12:23:14 +02:00

57 lines
1.5 KiB
Markdown

---
layout: default
---
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
<h1 id="function-sin">Function sin <a href="#function-sin" title="Permalink">#</a></h1>
Calculate the sine of a value.
To avoid confusion with the matrix sine, this function does not apply
to matrices.
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
```js
math.sin(x)
```
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
Parameter | Type | Description
--------- | ---- | -----------
`x` | number &#124; BigNumber &#124; Complex &#124; Unit | Function input
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
Type | Description
---- | -----------
number &#124; BigNumber &#124; Complex | Sine of x
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
Type | Description
---- | -----------
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
```js
math.sin(2) // returns number 0.9092974268256813
math.sin(math.pi / 4) // returns number 0.7071067811865475
math.sin(math.unit(90, 'deg')) // returns number 1
math.sin(math.unit(30, 'deg')) // returns number 0.5
const angle = 0.2
math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2) // returns number ~1
```
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
[cos](cos.html),
[tan](tan.html)