I am trying to define an $n \times n$ matrix for even $n$ using
d1 =
Table[
Which[
i < j, 0, i == j, i!/(2^i 0! i!),
EvenQ[i - j] && j == 0, (i)!/(2^i (i/2)! j!),
EvenQ[i - j] && OddQ[i], (i)!/(2^i ((i + 1)/2 - 1)! j!),
EvenQ[i - j] && EvenQ[i], (i)!/(2^i (i/2 - 1)! j!),
True, 0],
{i, 0, n}, {j, 0, n}]
Is my code correct? Will it be correct when $n$ is odd?



j==0. Also, is there are additionaljdependencies in the other two cases (I don't know, because I don't know exactly what you are trying to do). What happens whennis odd? – mjw Mar 01 '19 at 20:45iis the row, andjis the column, right? The term's dependence onj(other than whether it zero or not) is thej!in the denominator, yes? – mjw Mar 01 '19 at 21:01j==0. Wouldn't it just follow the pattern also? Tryn=4. Is this what you want (a few 3/4 over there in the lower left corner)? – mjw Mar 01 '19 at 21:09EvenQ[i - j], (i)!/(2^i (i/2)! j!), True, 0]? – mjw Mar 01 '19 at 22:31Nas a variable.Nis a reserved symbol for a built-in function. – m_goldberg Mar 02 '19 at 00:40{i,j}entry of each matrix. – mjw Mar 03 '19 at 01:55SparseArrayandBand. – Αλέξανδρος Ζεγγ Mar 03 '19 at 03:02