std::tanh(std::complex)
提供: cppreference.com
| ヘッダ <complex> で定義
|
||
| template< class T > complex<T> tanh( const complex<T>& z ); |
(C++11以上) | |
複素数の値 z の複素数の双曲線正接を計算します。
目次 |
[編集] 引数
| z | - | 複素数の値 |
[編集] 戻り値
エラーが発生しなければ、 z の複素数の双曲線正接が返されます。
[編集] エラー処理と特殊な値
Errors are reported consistent with math_errhandling
If the implementation supports IEEE floating-point arithmetic,
- std::tanh(std::conj(z)) == std::conj(std::tanh(z))
- std::tanh(-z) == -std::tanh(z)
- If
zis(+0,+0), the result is(+0,+0) - If
zis(x,+∞)(for any[1] finite x), the result is(NaN,NaN)and FE_INVALID is raised - If
zis(x,NaN)(for any[2] finite x), the result is(NaN,NaN)and FE_INVALID may be raised - If
zis(+∞,y)(for any finite positive y), the result is(1,+0) - If
zis(+∞,+∞), the result is(1,±0)(the sign of the imaginary part is unspecified) - If
zis(+∞,NaN), the result is(1,±0)(the sign of the imaginary part is unspecified) - If
zis(NaN,+0), the result is(NaN,+0) - If
zis(NaN,y)(for any non-zero y), the result is(NaN,NaN)and FE_INVALID may be raised - If
zis(NaN,NaN), the result is(NaN,NaN)
- ↑ per C11 DR471, this only holds for non-zero x. If
zis(0,∞), the result should be(0,NaN) - ↑ per C11 DR471, this only holds for non-zero x. If
zis(0,NaN), the result should be(0,NaN)
[編集] ノート
双曲線正接の数学的な定義は tanh z =| ez -e-z |
| ez +e-z |
双曲線正接は複素平面上の解析関数であり、分岐切断はありません。 双曲線正接は虚部に関して πi の周期で周期的であり、虚数線に沿って座標 (0, π(1/2 + n)) に位数 1 の極を持ちます。 しかし一般的な浮動小数点表現では π/2 を正確に表すことはできず、そのため極エラーが発生するような引数の値はありません。
[編集] 例
Run this code
#include <iostream> #include <cmath> #include <complex> int main() { std::cout << std::fixed; std::complex<double> z(1, 0); // behaves like real tanh along the real line std::cout << "tanh" << z << " = " << std::tanh(z) << " (tanh(1) = " << std::tanh(1) << ")\n"; std::complex<double> z2(0, 1); // behaves like tangent along the imaginary line std::cout << "tanh" << z2 << " = " << std::tanh(z2) << " ( tan(1) = " << std::tan(1) << ")\n"; }
出力:
tanh(1.000000,0.000000) = (0.761594,0.000000) (tanh(1) = 0.761594) tanh(0.000000,1.000000) = (0.000000,1.557408) ( tan(1) = 1.557408)
[編集] 関連項目
| 複素数の双曲線正弦 (sh(z)) を計算します (関数テンプレート) | |
| 複素数の双曲線余弦 (ch(z)) を計算します (関数テンプレート) | |
| (C++11) |
複素数の逆双曲線正接を計算します (関数テンプレート) |
| (C++11)(C++11) |
双曲線正接を計算します (関数) |
| valarray の各要素に関数 std::tanh を適用します (関数テンプレート) | |
| ctanh の C言語リファレンス
| |

