which method is usied to solve the Determinant in Matlab

5 views (last 30 days)
Hi,
Does Matlab use the LU decomposition or the Laplace expansion to calculate the determinant of a Matrix?
best Regards.

Answers (1)

John D'Errico
John D'Errico on 14 Nov 2023
Edited: John D'Errico on 14 Nov 2023
JUST READ THE HELP! (Actually, doc det.) In there, you will see this statement:
det computes the determinant from the triangular factors obtained by Gaussian elimination with the lu function.
[L,U] = lu(X)
s = det(L) % This is always +1 or -1
det(X) = s*prod(diag(U))
Seriously, almost always just reading the docs for a function will give you at least some clue as to how they are written. (Not always.) But at least they will usually give you a reference, and for basic codes, they will give you a good idea of how they are written.
Sometimes, you can even look at the code itself. In that case, do this:
type det
'det' is a built-in function.
Here, it will tell you only that det is a compiled code, but at least you can look.

Categories

Find more on Mathematics and Optimization in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!