I'm trying to compute the determinant of a symbolic matrix made with the following code:
NewMatrix[n_] := Module[{i = 1, j = 1, M = Array[m, {n + 1, n + 1}]},
For[i = 1, i <= n + 1, i++,
For[j = 1, j <= n + 1, j++,
If[j < i, m[i, j] = a[[j]],
If[j == i, m[i, j] = x,
If[j > i, m[i, j] = a[[j - 1]], 0]]]
]
]; M // MatrixForm]
But when I apply:
Det[NewMatrix[4]]
Mathematica returns this:
If I try to give a and x numerical values it still doesn't show the numerical value of the determinant, just gives the same expression but with numbers. What is happening here?







NewMatrix[4], is in theMatrixForm, whileDetcan be applied toLists; first, remove the//MatrixFormpart and it will work. However, I'm getting an error:Part::partd: "Part specification a[[1]] is longer than depth of object."– corey979 Sep 11 '16 at 16:11a = Array[a, n]into theModule, afteriandj, and beforeM. – corey979 Sep 11 '16 at 16:19