项目作者: seigtm

项目描述 :
A simple complex numbers class that supports all basic operations.
高级语言: C++
项目地址: git://github.com/seigtm/Complex.git
创建时间: 2021-04-17T21:30:54Z
项目社区:https://github.com/seigtm/Complex

开源协议:

下载


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:

  1. Complex();

Constructor with parameters:

  1. // double r is real number.
  2. // double i is imaginary unit.
  3. 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:

  1. 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:
    1. 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:

  1. bash> cd Complex
  2. bash> conan install . -if build --build missing

To build and run the project with cmake, execute:

  1. bash> cd build
  2. bash> cmake ..

To install and run the application, execute:

  1. bash> make
  2. bash> cd bin
  3. bash> ./main