|
|
@ -1,12 +1,12 @@
|
|
|
|
# mmathlib
|
|
|
|
# mmathlib
|
|
|
|
|
|
|
|
|
|
|
|
*get repo*
|
|
|
|
***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
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
*Compile and run*
|
|
|
|
***Compile and run***
|
|
|
|
|
|
|
|
|
|
|
|
**fractions**
|
|
|
|
**fractions**
|
|
|
|
|
|
|
|
|
|
|
@ -14,7 +14,7 @@ cd mmathlib
|
|
|
|
g++ -o fractions fractions.cpp
|
|
|
|
g++ -o fractions fractions.cpp
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
***Output***
|
|
|
|
*Output*
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
./fractions
|
|
|
|
./fractions
|
|
|
@ -39,7 +39,7 @@ g++ -o cnumber cnumber.cpp
|
|
|
|
./cnumber
|
|
|
|
./cnumber
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
***Output***
|
|
|
|
*Output*
|
|
|
|
```
|
|
|
|
```
|
|
|
|
a = 3+2i
|
|
|
|
a = 3+2i
|
|
|
|
a* = 3-2i
|
|
|
|
a* = 3-2i
|
|
|
@ -61,7 +61,7 @@ a / b = (6/25)+(17/25)i
|
|
|
|
g++ -o vector vector.cpp
|
|
|
|
g++ -o vector vector.cpp
|
|
|
|
./vector
|
|
|
|
./vector
|
|
|
|
```
|
|
|
|
```
|
|
|
|
***output***
|
|
|
|
*output*
|
|
|
|
```
|
|
|
|
```
|
|
|
|
v:
|
|
|
|
v:
|
|
|
|
| 1 |
|
|
|
|
| 1 |
|
|
|
@ -71,26 +71,75 @@ w:
|
|
|
|
| 3 |
|
|
|
|
| 3 |
|
|
|
|
| 4 |
|
|
|
|
| 4 |
|
|
|
|
| 5 |
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
v + w:
|
|
|
|
|
|
|
|
| 4 |
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
| 5+i |
|
|
|
|
|
|
|
|
v - w:
|
|
|
|
|
|
|
|
| -2 |
|
|
|
|
|
|
|
|
| -2 |
|
|
|
|
|
|
|
|
| -5+i |
|
|
|
|
v * w:
|
|
|
|
v * w:
|
|
|
|
11+5i
|
|
|
|
11+5i
|
|
|
|
|
|
|
|
w * i:
|
|
|
|
|
|
|
|
| 3i |
|
|
|
|
|
|
|
|
| 4i |
|
|
|
|
|
|
|
|
| 5i |
|
|
|
|
|
|
|
|
Element 0 of v:
|
|
|
|
|
|
|
|
1
|
|
|
|
|
|
|
|
Element 1 of v:
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
Element 2 of v:
|
|
|
|
|
|
|
|
i
|
|
|
|
|
|
|
|
A temp vector of dimension 3
|
|
|
|
|
|
|
|
| 0 |
|
|
|
|
|
|
|
|
| 0 |
|
|
|
|
|
|
|
|
| 0 |
|
|
|
|
|
|
|
|
Assignment of w to k
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
| 4 |
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
Manually set elements of k to elements of v
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
| i |
|
|
|
|
```
|
|
|
|
```
|
|
|
|
**matrices**
|
|
|
|
**matrices**
|
|
|
|
```
|
|
|
|
```
|
|
|
|
g++ -o matrix matrix.cpp
|
|
|
|
g++ -o matrix matrix.cpp
|
|
|
|
./matrix
|
|
|
|
./matrix
|
|
|
|
```
|
|
|
|
```
|
|
|
|
***output***
|
|
|
|
*output*
|
|
|
|
```
|
|
|
|
```
|
|
|
|
The matrix m:
|
|
|
|
The matrix m:
|
|
|
|
| 7 | 5 | i |
|
|
|
|
| 7 | 6+i |
|
|
|
|
| 0 | 2 | 0 |
|
|
|
|
| 5 | 3 |
|
|
|
|
| -i | 0 | 4 |
|
|
|
|
The matrix m roted by one pi radian:
|
|
|
|
|
|
|
|
| 6+i | 3 |
|
|
|
|
|
|
|
|
| 7 | 5 |
|
|
|
|
|
|
|
|
The determinant of matrix m:
|
|
|
|
|
|
|
|
-9-5i
|
|
|
|
The matrix m's transpose:
|
|
|
|
The matrix m's transpose:
|
|
|
|
| 7 | 0 | -i |
|
|
|
|
| 7 | 5 |
|
|
|
|
| 5 | 2 | 0 |
|
|
|
|
| 6+i | 3 |
|
|
|
|
| i | 0 | 4 |
|
|
|
|
The matrix m's diagonal:
|
|
|
|
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
| 3 |
|
|
|
|
|
|
|
|
The matrix m's off diagonal:
|
|
|
|
|
|
|
|
| 6+i |
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
The matrix n
|
|
|
|
|
|
|
|
| 2 | 1+i |
|
|
|
|
|
|
|
|
| 1-i | 5 |
|
|
|
|
|
|
|
|
The determinant of matrix n:
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
The matrix m * n
|
|
|
|
|
|
|
|
| 21-5i | 37+12i |
|
|
|
|
|
|
|
|
| 13-3i | 20+5i |
|
|
|
|
The matrix m is not hermitian, here is the hermitian conjugate:
|
|
|
|
The matrix m is not hermitian, here is the hermitian conjugate:
|
|
|
|
| 7 | 0 | i |
|
|
|
|
| 7 | 5 |
|
|
|
|
| 5 | 2 | 0 |
|
|
|
|
| 6-i | 3 |
|
|
|
|
| -i | 0 | 4 |
|
|
|
|
The matrix n is hermitian, here is the hermitian conjugate:
|
|
|
|
|
|
|
|
| 2 | 1+i |
|
|
|
|
|
|
|
|
| 1-i | 5 |
|
|
|
|
```
|
|
|
|
```
|
|
|
|