名前空間
変種
操作

std::log10(std::complex)

From cppreference.com
< cpp‎ | numeric‎ | complex
 
 
 
 
ヘッダ <complex> で定義
template< class T >
std::complex<T> log10( const std::complex<T>& z );

複素数zの(底10の)常用対数を計算します。分岐点は負の実軸にあります。

この関数の動作は、std::log(z) / std::log(T(10))に相当します。

目次

[編集] 引数

z - complex value

[編集] 戻り値

zの複素数常用対数。

[編集]

#include <cmath>
#include <complex>
#include <iostream>
 
int main()
{
    std::complex<double> z(0.0, 1.0); // r = 0, θ = pi / 2
    std::cout << "2 * log10" << z << " = " << 2.0 * std::log10(z) << '\n';
 
    std::complex<double> z2(sqrt(2.0) / 2, sqrt(2.0) / 2); // r = 1, θ = pi / 4
    std::cout << "4 * log10" << z2 << " = " << 4.0 * std::log10(z2) << '\n';
 
    std::complex<double> z3(-100.0, 0.0); // r = 100, θ = pi
    std::cout << "log10" << z3 << " = " << std::log10(z3) << '\n';
    std::complex<double> z4(-100.0, -0.0); // the other side of the cut
    std::cout << "log10" << z4 << " = " << std::log10(z4) << " "
                 "(the other side of the cut)\n"
                 "(note: pi / log(10) = " << std::acos(-1.0) / std::log(10.0) << ")\n";
}

実行結果の例

2 * log10(0,1) = (0,1.36438)
4 * log10(0.707107,0.707107) = (0,1.36438)
log10(-100,0) = (2,1.36438)
log10(-100,-0) = (2,-1.36438) (the other side of the cut)
(note: pi / log(10) = 1.36438)

[編集] 関連項目

複素数の自然対数、分枝切断は負の実軸に沿う
(関数テンプレート) [編集]
(C++11)(C++11)
常用対数 (10 を底とする) を計算する (log10(x))
(関数) [編集]
valarrayの各要素に関数std::log10を適用する
(function template) [編集]
English 日本語 中文(简体) 中文(繁體)