https://github.com/seigtm/complex
A simple complex numbers class that supports all basic operations.
https://github.com/seigtm/complex
complex-number complex-numbers cpp homework homework-assignments
Last synced: 6 months ago
JSON representation
A simple complex numbers class that supports all basic operations.
- Host: GitHub
- URL: https://github.com/seigtm/complex
- Owner: seigtm
- Archived: true
- Created: 2021-04-17T21:30:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-28T09:27:05.000Z (almost 4 years ago)
- Last Synced: 2025-02-23T03:46:52.948Z (8 months ago)
- Topics: complex-number, complex-numbers, cpp, homework, homework-assignments
- Language: CMake
- Homepage:
- Size: 3.59 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```c++
Complex();
```Constructor with parameters:
```c++
// 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](https://en.wikipedia.org/wiki/De_Moivre%27s_formula));
- nth root (using power);
- trigonometric (sine, cosine and magnitude(abs));
- comparison (equality);
- bitwise (for std::cin and std::cout).## Cloning the repository:
```bash
bash> git clone https://github.com/seigtm/Complex
```---
## Build requirements:
- [cmake](https://cmake.org/) to configure the project (minimum required version is **3.5**).
- [conan](https://conan.io/) to download all application dependencies.
You can install **conan** by giving a command to **pip**:
```bash
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
bash> cd Complex
bash> conan install . -if build --build missing
```To build and run the project with `cmake`, execute:
```bash
bash> cd build
bash> cmake ..
```To install and run the application, execute:
```bash
bash> make
bash> cd bin
bash> ./main
```