C examples for complex.h:log
function template
<complex>
template<class T> complex<T> log (const complex<T>& x);
Natural logarithm of complex
Parameter | Description |
---|---|
x | Complex value. |
Natural logarithm of x.
#include <iostream> // std::cout #include <complex> // std::complex, std::imag int main ()/*from w ww. j av a 2s . c om*/ { std::complex<double> mycomplex (20.0,2.0); std::cout << "Natural logarithm: " << std::log(mycomplex) << '\n'; return 0; }