|
|
@ -1,21 +1,23 @@
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
# mmathlib
|
|
|
|
# mmathlib
|
|
|
|
|
|
|
|
|
|
|
|
**Compile and run**
|
|
|
|
*get repo*
|
|
|
|
```bash
|
|
|
|
```bash
|
|
|
|
git clone https://code.smolnet.org/micke/mmathlib.git
|
|
|
|
git clone https://code.smolnet.org/micke/mmathlib.git
|
|
|
|
cd mmathlib
|
|
|
|
cd mmathlib
|
|
|
|
g++ -o fractions fractions.cpp
|
|
|
|
|
|
|
|
./fractions
|
|
|
|
|
|
|
|
g++ -o cnumber cnumber.cpp
|
|
|
|
|
|
|
|
./cnumber
|
|
|
|
|
|
|
|
g++ -o matrix matrix.cpp
|
|
|
|
|
|
|
|
./matrix
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Output**
|
|
|
|
*Compile and run*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**fractions**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
g++ -o fractions fractions.cpp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
***Output***
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
./fractions
|
|
|
|
7/3=(7/3)
|
|
|
|
7/3=(7/3)
|
|
|
|
7/3=2.333333333
|
|
|
|
7/3=2.333333333
|
|
|
|
1/11=(1/11)
|
|
|
|
1/11=(1/11)
|
|
|
@ -29,6 +31,16 @@ g++ -o matrix matrix.cpp
|
|
|
|
(7/3)/(1/11)=(77/3)
|
|
|
|
(7/3)/(1/11)=(77/3)
|
|
|
|
(7/3)/(1/11)=25.66666667
|
|
|
|
(7/3)/(1/11)=25.66666667
|
|
|
|
0.75=(3/4)
|
|
|
|
0.75=(3/4)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Complex numbers**
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
g++ -o cnumber cnumber.cpp
|
|
|
|
|
|
|
|
./cnumber
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
***Output***
|
|
|
|
|
|
|
|
```
|
|
|
|
a = 3+2i
|
|
|
|
a = 3+2i
|
|
|
|
a* = 3-2i
|
|
|
|
a* = 3-2i
|
|
|
|
a*a* = 13
|
|
|
|
a*a* = 13
|
|
|
@ -43,6 +55,32 @@ a * b = 18-i
|
|
|
|
(a * b)* = 18+i
|
|
|
|
(a * b)* = 18+i
|
|
|
|
a / b = (6/25)+(17/25)i
|
|
|
|
a / b = (6/25)+(17/25)i
|
|
|
|
(a / b)* = (6/25)-(17/25)i
|
|
|
|
(a / b)* = (6/25)-(17/25)i
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
**vectors**
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
g++ -o vector vector.cpp
|
|
|
|
|
|
|
|
./vector
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
***output***
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
v:
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
| i |
|
|
|
|
|
|
|
|
w:
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
| 4 |
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
v * w:
|
|
|
|
|
|
|
|
11+5i
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
**matrices**
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
g++ -o matrix matrix.cpp
|
|
|
|
|
|
|
|
./matrix
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
***output***
|
|
|
|
|
|
|
|
```
|
|
|
|
The matrix m:
|
|
|
|
The matrix m:
|
|
|
|
| 7 | 5 | i |
|
|
|
|
| 7 | 5 | i |
|
|
|
|
| 0 | 2 | 0 |
|
|
|
|
| 0 | 2 | 0 |
|
|
|
|