complex - STL C++

exp()

Declaration

complex<X> exp(const complex<X>& kqrZ);

Description

This is the friend function exp() for complex numbers. It returns the exponential of the complex number kqrZ. The formula for the exponential of a complex number z = x + iy, for real numbers x and y is

exp(z) = exp(x)(cos(y) + isin(y)).

Header Include

#include <complex>

Example

#include <complex>
#include <iostream>

int main()
{
	using namespace std;

	// Create a complex number and calculate its exponential
	complex<double> qZ(2.0, 4.0);
	cout << "Complex Number : "<< qZ << endl;
	cout << "The exponential is "<< exp(qZ) << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

exp() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.