|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
# mmathlib
|
|
|
|
|
|
|
|
|
|
*get repo*
|
|
|
|
|
***get repo***
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://code.smolnet.org/micke/mmathlib.git
|
|
|
|
|
cd mmathlib
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
*Compile and run*
|
|
|
|
|
***Compile and run***
|
|
|
|
|
|
|
|
|
|
**fractions**
|
|
|
|
|
|
|
|
|
@ -14,7 +14,7 @@ cd mmathlib
|
|
|
|
|
g++ -o fractions fractions.cpp
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
***Output***
|
|
|
|
|
*Output*
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
./fractions
|
|
|
|
@ -39,7 +39,7 @@ g++ -o cnumber cnumber.cpp
|
|
|
|
|
./cnumber
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
***Output***
|
|
|
|
|
*Output*
|
|
|
|
|
```
|
|
|
|
|
a = 3+2i
|
|
|
|
|
a* = 3-2i
|
|
|
|
@ -61,7 +61,7 @@ a / b = (6/25)+(17/25)i
|
|
|
|
|
g++ -o vector vector.cpp
|
|
|
|
|
./vector
|
|
|
|
|
```
|
|
|
|
|
***output***
|
|
|
|
|
*output*
|
|
|
|
|
```
|
|
|
|
|
v:
|
|
|
|
|
| 1 |
|
|
|
|
@ -71,26 +71,75 @@ w:
|
|
|
|
|
| 3 |
|
|
|
|
|
| 4 |
|
|
|
|
|
| 5 |
|
|
|
|
|
v + w:
|
|
|
|
|
| 4 |
|
|
|
|
|
| 6 |
|
|
|
|
|
| 5+i |
|
|
|
|
|
v - w:
|
|
|
|
|
| -2 |
|
|
|
|
|
| -2 |
|
|
|
|
|
| -5+i |
|
|
|
|
|
v * w:
|
|
|
|
|
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**
|
|
|
|
|
```
|
|
|
|
|
g++ -o matrix matrix.cpp
|
|
|
|
|
./matrix
|
|
|
|
|
```
|
|
|
|
|
***output***
|
|
|
|
|
*output*
|
|
|
|
|
```
|
|
|
|
|
The matrix m:
|
|
|
|
|
| 7 | 5 | i |
|
|
|
|
|
| 0 | 2 | 0 |
|
|
|
|
|
| -i | 0 | 4 |
|
|
|
|
|
| 7 | 6+i |
|
|
|
|
|
| 5 | 3 |
|
|
|
|
|
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:
|
|
|
|
|
| 7 | 0 | -i |
|
|
|
|
|
| 5 | 2 | 0 |
|
|
|
|
|
| i | 0 | 4 |
|
|
|
|
|
| 7 | 5 |
|
|
|
|
|
| 6+i | 3 |
|
|
|
|
|
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:
|
|
|
|
|
| 7 | 0 | i |
|
|
|
|
|
| 5 | 2 | 0 |
|
|
|
|
|
| -i | 0 | 4 |
|
|
|
|
|
| 7 | 5 |
|
|
|
|
|
| 6-i | 3 |
|
|
|
|
|
The matrix n is hermitian, here is the hermitian conjugate:
|
|
|
|
|
| 2 | 1+i |
|
|
|
|
|
| 1-i | 5 |
|
|
|
|
|
```
|
|
|
|
|