You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Micke Nordin 24e8b2bcc1
Correct determinant for nxn matrices
2 years ago
LICENSE Initial commit 2 years ago
README.md Left justify output 2 years ago
cnumber.hpp Dont use namespace std 2 years ago
fractions.hpp These should be signed 2 years ago
main.cpp rename rotate 2 years ago
matrix.hpp Correct determinant for nxn matrices 2 years ago
vector.cpp All of these should be uint64_t 2 years ago
vector.hpp Make it possible to print as row 2 years ago

README.md

mmathlib

get repo

git clone https://code.smolnet.org/micke/mmathlib.git
cd mmathlib

Compile and run

g++ main.cpp vector.cpp -o example
./example

Output

7/3=(7/3)
7/3=2.333333333
1/11=(1/11)
1/11=0.09090909091
(7/3)+(1/11)=(80/33)
(7/3)+(1/11)=2.424242424
(7/3)-(1/11)=(74/33)
(7/3)-(1/11)=2.242424242
(7/3)*(1/11)=(7/33)
(7/3)*(1/11)=0.2121212121
(7/3)/(1/11)=(77/3)
(7/3)/(1/11)=25.66666667
0.75=(3/4)
a = 3+2i
a* = 3-2i
a*a* = 13
b = 4-3i
b* = 4+3i
b*b* = 25
a + b = 7-i
(a + b)* = 7+i
a - b =  -1+5i
(a - b)* = -1-5i
a * b =  18-i
(a * b)* = 18+i
a / b = (6/25)+(17/25)i
(a / b)* = (6/25)-(17/25)i
v:
|1|
|2|
|i|
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|
The matrix m
|1|1|
|1|1|
The determinant of matrix m:
0
The matrix n:
|2  |1+i|
|1-i|5  |
The matrix n roted by one pi radian:
|1+i|5  |
|2  |1-i|
The determinant of matrix n:
8
The matrix n's transpose:
|2  |1-i|
|1+i|5  |
The matrix n's diagonal:
|2|
|5|
The matrix n's off diagonal:
|1+i|
|1-i|
The vector d:
|1-i|
|5  |
The matrix n * the vector d
|2-2i|2   |
|5-5i|25  |
The vector d * the matrix n
|7-7i|
|27  |
The matrix m * n
|3-i|6+i|
|3-i|6+i|
The matrix m + n
|3  |2+i|
|2-i|6  |
Is 2 an eigenvalue of m?
Yes!
The matrix n is hermitian, here is the hermitian conjugate:
|2  |1+i|
|1-i|5  |