%I #9 Jan 09 2024 12:25:52
%S -2,0,1,0,-3,-3,1,1,0,0,0,0,0,3,-3,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%T 0,0,0,0,0,17496,11664,-31752,-12420,20196,4392,-5634,-660,744,43,-45,
%U -1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N A real part quaternion-Hadamard matrix self-similarity coefficient triangle: m(n)=real(quaternion_Hadamard(2^n)).
%C Row sums are: {-1, -4, 0, 4024, -2914324434151973883590000,...}.
%C Example Matrix:
%C M(8)={{0, 0, 0, 0, 0, 0, 0, 0},
%C {0, 0, 0, 0, 0, 0, 0, 0},
%C {0, 0, 0, 0, 0, 0, 0, 0},
%C {0, 0, 0, 0, 0, 0, 0, 0},
%C {0, 0, 0, 0, 0, 0, 0, 0},
%C {0, 0, 0, 0, 0, 1, 0, 1},
%C {0, 0, 0, 0, 0, 0, 1, 1},
%C {0, 0, 0, 0, 0, 1, 1, -1}}.
%C I originally did this quaternion Hadamard to see the polynomial-based fractal it generated.
%F m(n) = real(quaternion_Hadamard(2^n));
%F out_(n,m) = coefficients(characteristicpolynomial(m(n),x0,x).
%e {-2, 0, 1},
%e {0, -3, -3, 1, 1},
%e {0, 0, 0, 0, 0, 3, -3, -1, 1},
%e {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17496, 11664, -31752, -12420, 20196, 4392, -5634, -660, 744, 43, -45, -1, 1},
%e {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203971779462337250790998016, -90654124205483222573776896, -995516586182436129374994432, 229036898680674304357564416, 2014940244214672189531619328, -225470354585179660732071936, -2303348875675346491762802688, 102107389232404032780238848, 1699141611174245837080363008, -7907928593626742735241216, -871514449884897217825996800, -16326680701779539939819520, 325779479171150315757502464, 10471821132401396786331648, -91611153839241190921863168,
%e -3593418949147507007422464, 19815151480978064696229888, 836197796503567596994560, -3349274996676445308297216, -142297960404623362117632, 447400068863581245616128, 18352005269645607340032, -47598603085735882767360, -1829483824657528885248, 4052887122252867183360, 142575166258114943232, -276854228032626385920, -8737819537318410816, 15174075363259578048, 421904697273806976, -665838783895241088, -16022240352510912, 23281915965903936, 475961085645264, -643775174648784, -10952855889552, 13917185697600, 192271111392, -231326539824, -2514892444, 2884675668, 23628896, -25995912, -150088, 159224, 575, -591, -1, 1}
%t Clear[HadamardMatrix, c, x, y, z, m, I0, J, K];
%t MatrixJoinH[A_, B_] := Transpose[Join[Transpose[A], Transpose[B]]];
%t KroneckerProduct[M_, N_] := Module[{M1, N1, LM, LN, N2},
%t M1 = M;
%t N1 = N;
%t LM = Length[M1];
%t LN = Length[N1];
%t Do[M1[[i, j]] = M1[[i, j]]N1, {i, 1, LM}, {j, 1, LM}];
%t Do[M1[[i, 1]] = MatrixJoinH[M1[[i, 1]], M1[[i, j]]], {j, 2, LM}, {i, 1, LM}];
%t N2 = {};
%t Do[AppendTo[N2, M1[[i, 1]]], {i, 1, LM}];
%t N2 = Flatten[N2];
%t Partition[N2, LM*LN, LM*LN]]
%t HadamardMatrix[2] := {{1, 1}, {1, -1}};
%t HadamardMatrix[4] := {{I0, I0, J, J}, {I0, -1, J, -1}, {K, K, -1, -1}, {K, -1, -1, 1}};
%t HadamardMatrix[n_] := Module[{m}, m = If[n == 8, {{I0, J}, {K, -1}}, {{1, 1, 1, 1}, {1, -I0, 1, -J}, {1, 1, -1, -1}, {1, -K, -1, 1}}]; KroneckerProduct[m, HadamardMatrix[n/2]]];
%t c = Table[HadamardMatrix[2^n], {n, 1, 5}] /. K -> 0 /. J -> 0 /. I0 -> 0;
%t Table[CoefficientList[CharacteristicPolynomial[ c[[n]], z], z], {n, 1, Length[c]}];
%t Flatten[%]
%t Table[Apply[Plus, CoefficientList[CharacteristicPolynomial[c[[n]], z], z]], {n, 1, Length[c]}];
%K sign,tabf
%O 2,1
%A _Roger L. Bagula_ and _Gary W. Adamson_, Mar 22 2009