首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::log10(std::complex)

Defined in header <complex>

template< class T > complex<T> log10( const complex<T>& z );

计算复杂的公共%28碱基10复值的%29对数z在负实轴上有一个分支。

此函数的行为等价于std::log(z)/std::log(10)...

参数

z

-

complex value

返回值

复公对数z...

二次

代码语言:javascript
复制
#include <iostream>
#include <cmath>
#include <complex>
 
int main()
{
    std::complex<double> z(0, 1); // // r = 0,  = pi/2
    std::cout << "2*log10" << z << " = " << 2.*std::log10(z) << '\n';
 
    std::complex<double> z2(sqrt(2)/2, sqrt(2)/2); // r = 1, # = pi/4
    std::cout << "4*log10" << z2 << " = " << 4.*std::log10(z2) << '\n';
 
    std::complex<double> z3(-100, 0); // r = 100, # = pi
    std::cout << "log10" << z3 << " = " << std::log10(z3) << '\n';
    std::complex<double> z4(-100, -0.0); // the other side of the cut
    std::cout << "log10" << z4 << " (the other side of the cut) = "
              << std::log10(z4) << '\n'
              << "(note: pi/log(10) = " << acos(-1)/log(10) << ")\n";
}

二次

产出:

二次

代码语言:javascript
复制
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) (the other side of the cut) = (2,-1.36438)
(note: pi/log(10) = 1.36438)

二次

另见

log(std::complex)

complex natural logarithm with the branch cuts along the negative real axis (function template)

log10

computes common (base 10) logarithm (log10(x)) (function)

log10(std::valarray)

applies the function std::log10 to each element of valarray (function template)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券