/*
    Demonstrates complex math and functions    See Nyhoff P223-237
    http://www.cplusplus.com/reference/complex/
*/

#include <iostream>
#include <complex>

using namespace std;

int main()
{
   complex<double> z(1,2);                   // z = 1+2i
   
   cout << "z="   << z << endl;
   cout << "Re(z)=" << real(z) << endl;
   cout << "Im(z)=" << imag(z) << endl;
   cout << "|z|  =" << norm(z) << endl;
   
   complex<double> w(0,4);                   // w = 0+4i
   
   cout << "z*w=" << z*w << endl;
   cout << "cos(w)=" << cos(w) << endl;
   cout << "exp(z)=" << exp(z) << endl;
   
}
