I am coding a simple DFT algorithm now and I want to use the complex number i in complex exponential. I saw somebody use #include and #include&
#include
#include&
Here is a short complete example:
#include #include #include using namespace std; typedef complex dcomp; main() { dcomp i; dcomp a; double pi; pi = 2 * asin(1); i = -1; i = sqrt(i); a = exp(2*pi*i); cout << "i is " << i << "and Euler was right: e(i pi) = " << a << endl; }
Tested with g++