Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Latest commit

 

History

History
82 lines (59 loc) · 1.8 KB

README.md

File metadata and controls

82 lines (59 loc) · 1.8 KB

Complex number C++ class

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)


Constructors:

Default constructor without parameters:

Complex();

Constructor with parameters:

// double r is real number.
// double i is imaginary unit.
Complex(double r, double i = 0);

List of supported operators and functions:

  • 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).

Cloning the repository:

bash> git clone https://github.com/seigtm/Complex

Build requirements:

  • 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:
    bash> pip install --user conan
    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.

Configuring and build with conan and cmake:

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