I wanted to simplify my program a little bit and I am testing math.net, so for example I got matrix 2x2,
det(A) = a * d - b * c = 71 * 137 - 130 * 107 = -4183
Can sb tell me what is going on here, on the second screenshot, you can see that Math.Net Determinant() Function returns -4183,00000000000000018
. How is it correct for the given matrix? Where this result came from? If it is double, it should be -4183.0
.
Is it some kind of algorithm which count "well enough" but "much faster" for large data?
Second question, out of curiosity, what would be the quickest way to invert matrix modulo 256, using EXACTLY this method:
A^(-1) = 1/det(A) * (A^D)^T
where by (A^D)^T
I mean transposed matrix of cofactors (I believe how it is called in English)
I wrote a method doing that, which works for Matrices or Multidimensional arrays, but I am curious what is the proper way of doing it in math.net, but using the equation I mentioned.
And as always, I truly appreciate every answer guys.
(btw yes, I am aware that I am doing to many casts, vars are declared many times, but try to ignore that, this is simply a testing field)
To make my 1st question more clear (You can click '-' all you want, I don't care :))
@Szab Thank you for the answer, I know that there is such behavior for decimal numbers, but to be more precise: I would like to know, why the result - 4183,00000000000000018 is different than: This Result There are no decimal places here, C# show very clearly that
det(A) = a * d - b * c = 71.0 * 137.0 - 130.0 * 107.0 = -4183.0
for a, b, c, d and det being all doubles.
/edit
Question answered, thank you all very much.