Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
V2.1 solution in Clear category for [old] Determinant by vincent.tscherter
"use strict";
// get the subpart of the Matrix
let sub = (M, index) => M
.filter((_, i) => i > 0) // remove first row
.map(f => f.filter((_, i) => i != index)); // remove col at index
function determinant(M) {
// base case
if (M.length == 1) return M[0][0]
// recursion for M.length > 2
var answer = 0;
for (var i = 0; i < M.length; i++) {
answer += Math.pow(-1, i) * M[0][i] * determinant(sub(M, i), false);
} return answer;
}
Aug. 25, 2018