mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.4 KiB
1.4 KiB
| layout |
|---|
| default |
§Function atan2
Calculate the inverse tangent function with two arguments, y/x. By providing two arguments, the right quadrant of the computed angle can be determined.
For matrices, the function is evaluated element wise.
§Syntax
math.atan2(y, x)
§Parameters
| Parameter | Type | Description |
|---|---|---|
y |
Number | Boolean | Complex | Array | Matrix | Second dimension |
x |
Number | Boolean | Complex | Array | Matrix | First dimension |
§Returns
| Type | Description |
|---|---|
| Number | Complex | Array | Matrix | Four-quadrant inverse tangent |
§Examples
math.atan2(2, 2) / math.pi; // returns number 0.25
var angle = math.unit(60, 'deg'); // returns Unit 60 deg
var x = math.cos(angle);
var y = math.sin(angle);
math.atan(2); // returns Complex 1.5707963267948966 -1.3169578969248166 i