complex_log10
complex_log10 (복소수 상용로그)
복소수 z의 복소 상용로그(밑 10 로그)를 구하는 함수예요. 음의 실수축을 따라 분지절단이 있어요.
출처: cppreference
본문
<complex> 헤더에 정의되어 있고, 시그니처는 다음과 같아요.
template< class T >
std::complex<T> log10( const std::complex<T>& z );
음의 실수축을 따라 분지절단이 있는 복소수 z의 복소 상용(밑 10) 로그를 계산해요.
이 함수의 동작은 std::log(z) / std::log(T(10))과 동일해요.
매개변수 (Parameters)
- z — 복소수 값
반환값 (Return value)
z의 복소 상용로그예요.
예제 (Example)
이 코드를 실행해 봐요.
#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)