2015-02-09 21:43:00 +01:00

47 lines
1.0 KiB
Markdown

# Function cos
Calculate the cosine of a value.
For matrices, the function is evaluated element wise.
## Syntax
```js
math.cos(x)
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`x` | Number | BigNumber | Boolean | Complex | Unit | Array | Matrix | null | Function input
### Returns
Type | Description
---- | -----------
Number | BigNumber | Complex | Array | Matrix | Cosine of x
## Examples
```js
math.cos(2); // returns Number -0.4161468365471422
math.cos(math.pi / 4); // returns Number 0.7071067811865475
math.cos(math.unit(180, 'deg')); // returns Number -1
math.cos(math.unit(60, 'deg')); // returns Number 0.5
var angle = 0.2;
math.pow(math.sin(angle), 2) + math.pow(math.cos(angle), 2); // returns Number ~1
```
## See also
[cos](cos.md),
[tan](tan.md)
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->