asin【アークサイン (逆正弦):arc-sine】メソッド
acos【アークコサイン (逆余弦):arc-cosine】メソッド
atan【アークタンジェント (逆正接):arc-tangent】メソッド
atan2【y/x のアークタンジェント (逆正接)】メソッド
メモ
- 逆三角関数:アークサイン 【逆正弦】・アークコサイン 【逆余弦】・アークタンジェント 【逆正接】 ・y/x のアークタンジェント 【逆正接】
Math.asin【アークサイン (逆正弦):arc-sine】
構文
- asin(x)
- x:数値 (-1 ~ 1)
アークサイン (ラジアン単位:-π/2 ~ +π/2)
| x | 戻り値 |
|---|---|
| NaN | NaN |
| 1 < | NaN |
| < (-1) | NaN |
| +0 | +0 |
| -0 | -0 |
例
グラフ表示
console.log(Math.asin(-1)); // 出力:-1.570796... (-π/2)
console.log(Math.asin(+1)); // 出力:1.570796... (+π/2)
console.log(Math.asin(NaN)); // 出力:NaN
console.log(Math.asin(2)); // 出力:NaN
console.log(Math.asin(-0)); // 出力:-0
console.log(Math.asin(+0)); // 出力:0
Math.acos【アークコサイン (逆余弦):arc-cosine】メソッド
構文
- acos(x)
- x:数値 (-1 ~ 1)
アークコサイン (ラジアン単位:+0 ~ +π)
| x | 戻り値 |
|---|---|
| NaN | NaN |
| 1 < x | NaN |
| x < (-1) | NaN |
| 1 | +0 |
例
グラフ表示
console.log(Math.acos(-1)); // 出力:3.141592... (π)
console.log(Math.acos(1)); // 出力:0
console.log(Math.acos(NaN)); // 出力:NaN
console.log(Math.acos(2)); // 出力:NaN
Math.atan【アークタンジェント (逆正接):arc-tangent】メソッド
構文
- atan(x)
- x:数値
アークタンジェント(ラジアン単位:-π/2 ~ +π/2)
| x | 戻り値 |
|---|---|
| NaN | NaN |
| +0 | +0 |
| -0 | -0 |
| +∞ | +π/2 |
| -∞ | -π/2 |
例
グラフ表示
console.log(Math.atan(1)); // 出力:0.7853981633974483 (π/4)
console.log(Math.atan(NaN)); // 出力:NaN
console.log(Math.atan(-0)); // 出力:-0
console.log(Math.atan(+0)); // 出力:0
console.log(Math.atan(+Infinity)); // 出力:1.570796... (+π/2)
console.log(Math.atan(-Infinity)); // 出力:-1.570796... (-π/2)
Math.atan2【y/x のアークタンジェント (逆正接)】メソッド
構文
- atan2(y, x)
- y:y座標
- x:x座標
戻り値:X 軸から座標 (y,x) までの逆時計回りの角度 (ラジアン単位)
| y | x | 戻り値 |
|---|---|---|
| 任意 | NaN | NaN |
| NaN | 任意 | NaN |
| 0 < y | +0 | ≒ +π/2 |
| 0 < y | −0 | ≒ +π/2 |
| +0 | 0 < x | +0 |
| +0 | +0 | +0 |
| +0 | −0 | ≒ +π |
| +0 | x < 0 | ≒ +π |
| −0 | 0 < x | −0 |
| −0 | +0 | −0 |
| −0 | −0 | ≒ −π |
| −0 | x < 0 | ≒ −π |
| y < 0 | +0 | ≒ −π/2 |
| y < 0 | −0 | ≒ −π/2 |
| 0 < (有限数) | +∞ | +0 |
| 0 < (有限数) | −∞ | ≒ +π |
| < 0 (有限数) | +∞ | −0 |
| < 0 (有限数) | −∞ | ≒ −π |
| +∞ | 有限数 | ≒ +π/2 |
| −∞ | 有限数 | ≒ −π/2 |
| +∞ | +∞ | ≒ +π/4 |
| +∞ | −∞ | ≒ +3π/4 |
| −∞ | +∞ | ≒ −π/4 |
| −∞ | −∞ | ≒ −3π/4 |
例
console.log(Math.atan2(1, 1)); // 出力:≒ +π/2
console.log(Math.atan2(1, NaN)); // 出力:NaN
console.log(Math.atan2(NaN, 1)); // 出力:NaN
console.log(Math.atan2(1, +0)); // 出力:≒ +π/2
console.log(Math.atan2(1, -0)); // 出力:≒ +π/2
console.log(Math.atan2(+0, 1)); // 出力:0
console.log(Math.atan2(+0, +0)); // 出力:0
console.log(Math.atan2(+0, -0)); // 出力:≒ +π
console.log(Math.atan2(+0, -1)); // 出力:≒ +π
console.log(Math.atan2(-0, 1)); // 出力:-0
console.log(Math.atan2(-0, +0)); // 出力:-0
console.log(Math.atan2(-0, -0)); // 出力:≒ -π
console.log(Math.atan2(-0, -1)); // 出力:≒ -π
console.log(Math.atan2(-1, +0)); // 出力:≒ −π/2
console.log(Math.atan2(-1, -0)); // 出力:≒ −π/2
console.log(Math.atan2(1, +Infinity)); // 出力:+0
console.log(Math.atan2(1, -Infinity)); // 出力:≒ +π
console.log(Math.atan2(-1, +Infinity)); // 出力:-0
console.log(Math.atan2(-1, -Infinity)); // 出力:≒ -π
console.log(Math.atan2(+Infinity, 1)); // 出力:≒ +π/2
console.log(Math.atan2(-Infinity, 1)); // 出力:≒ −π/2
console.log(Math.atan2(+Infinity, +Infinity)); // 出力:≒ +π/4
console.log(Math.atan2(+Infinity, -Infinity)); // 出力:+3π/4
console.log(Math.atan2(-Infinity, +Infinity)); // 出力:−π/4
console.log(Math.atan2(-Infinity, -Infinity)); // 出力:−3π/4
関連
- PI【円周率 (π)】 ・sin【サイン (正弦)】 ・cos【コサイン (余弦)】 ・tan【タンジェント (正接)】
- ECMAScript 5.1 (英語)
- ECMAScript 2015 (6) (英語)
- ECMAScript 2016 (7) (英語)