I have two matrices mat1 and mat2, both are results from different algorithms that are supposed to calculate the same result. The nmax is around 300, the q varies from 0.001 to 1.
expr1 = Exp[-q^2/2] Sum[q^(i + j - 2 k) (-1)^(-k + j) (Sqrt[i!] Sqrt[j!])/((i - k)! (j - k)! k!),
{k, 0, Min[i, j]}];
expr2 = Exp[-q^2/2] Sqrt[j!/i!] q^(i - j) LaguerreL[j, i - j, Abs[q]^2];
mat1 = Table[expr1, {i, 0, nmax}, {j, 0, nmax}];
mat2 = Table[expr2, {i, 0, nmax}, {j, 0, nmax}];
What would be the best method of comparing them depending on q to see if they are close enough to be considered the same result? Thanks in advance for the advices.
Norm[mat1-mat2, "Frobenius"]
? This will work for sparse matrices as well. $\endgroup$ – Nasser Oct 26 '14 at 20:46