In mathematics, a complex number is a number that can be expressed in the form a + bi, where a and b are real numbers, and i is a symbol called the imaginary unit, and satisfying the equation i^2 = -1.
(https://en.wikipedia.org/wiki/Complex_number)
Default constructor without parameters:
Complex();
Constructor with parameters:
// double r is real number.
// double i is imaginary unit.
Complex(double r, double i = 0);
- get real and imaginary units;
- unary;
- addition;
- substraction;
- multiplication;
- division;
- exponentiation (using de Moivre's formula);
- nth root (using power);
- trigonometric (sine, cosine and magnitude(abs));
- comparison (equality);
- bitwise (for std::cin and std::cout).
bash> git clone https://github.com/seigtm/Complex
- cmake to configure the project (minimum required version is 3.5).
- conan to download all application dependencies.
You can install conan by giving a command to pip:To use pip you need to install the python interpreter. I highly recommend to install python3-based versions in order to avoid unexpected results when using conan.bash> pip install --user conan
To install with conan
, execute the commands:
bash> cd Complex
bash> conan install . -if build --build missing
To build and run the project with cmake
, execute:
bash> cd build
bash> cmake ..
To install and run the application, execute:
bash> make
bash> cd bin
bash> ./main