log - C complex.h

C examples for complex.h:log

type

function template

From

<complex>

Prototype

template<class T> 
complex<T> log (const complex<T>& x);

Description

Natural logarithm of complex

Parameters

Parameter Description
x Complex value.

Return value

Natural logarithm of x.

Demo Code


#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;
}

Related Tutorials