SysTutorials

Linux Manual Pages › Section 3

stdexpstdcomplex(3)

std::exp(std::complex) - std::exp(std::complex)

Synopsis

Defined in header<complex>
    template <class T>
    complex<T> exp(const complex<T> &z);

Compute base-e exponential of z, that is e (Euler’s number, 2.7182818) raised to the z power.

Parameters

z - complex value

Return value

If no errors occur, e raised to the power of z, ez , is returned. Error handling and special values Errors are reported consistent with math_errhandling If the implementation supports IEEE floating-point arithmetic,

Notes

The complex exponential function ez for z = x+iy equals ex cis(y), or, ex (cos(y) + i sin(y)) The exponential function is an entire function in the complex plane and has no branch cuts.

Example

// Run this code

#include <complex>
#include <iostream>
int main()
{
const double pi = std::acos(-1);
const std::complex<double> i(0, 1);
std::cout << std::fixed << " exp(i*pi) = " << std::exp(i * pi) << ‘\n’;
}

Output:

  exp(i*pi) = (-1.000000,0.000000)

See also

                   complex natural logarithm with the branch cuts along the negative real axis log(std::complex) (function template) exp expf expl returns e raised to the given power (ex)                    (function) (C++11) (C++11)                    applies the function std::exp to each element of valarray exp(std::valarray) (function template)