# Relation between matrices

Maybe this is not a usual question for this forum... I have the following two matrices, mat1 and mat2, respectively:

mat1={{0.0178885,-0.0178885,-0.00894427,0.00894427,0.,0.,-0.00894427,0.00894427,0.,0.},{-0.0178885,0.0178885,0.00894427,-0.00894427,0.,0.,0.00894427,-0.00894427,0.,0.},{-0.00894427,0.00894427,0.0178885,-0.0178885,-0.00894427,0.00894427,0.,0.,0.,0.},{0.00894427,-0.00894427,-0.0178885,0.0178885,0.00894427,-0.00894427,0.,0.,0.,0.},{0.,0.,-0.00894427,0.00894427,0.00894427,-0.00894427,0.,0.,0.,0.},{0.,0.,0.00894427,-0.00894427,-0.00894427,0.00894427,0.,0.,0.,0.},{-0.00894427,0.00894427,0.,0.,0.,0.,0.0178885,-0.0178885,-0.00894427,0.00894427},{0.00894427,-0.00894427,0.,0.,0.,0.,-0.0178885,0.0178885,0.00894427,-0.00894427},{0.,0.,0.,0.,0.,0.,-0.00894427,0.00894427,0.00894427,-0.00894427},{0.,0.,0.,0.,0.,0.,0.00894427,-0.00894427,-0.00894427,0.00894427}};
mat2={{0.0198382,-0.0198382,-0.00991908,0.00991908,0.,0.,-0.00991908,0.00991908,0.,0.},{-0.0198382,0.0198382,0.00991908,-0.00991908,0.,0.,0.00991908,-0.00991908,0.,0.},{-0.00991908,0.00991908,0.0203862,-0.0203862,-0.0104672,0.0104672,0.,0.,0.,0.},{0.00991908,-0.00991908,-0.0203862,0.0203862,0.0104672,-0.0104672,0.,0.,0.,0.},{0.,0.,-0.0104672,0.0104672,0.0104672,-0.0104672,0.,0.,0.,0.},{0.,0.,0.0104672,-0.0104672,-0.0104672,0.0104672,0.,0.,0.,0.},{-0.00991908,0.00991908,0.,0.,0.,0.,0.0203862,-0.0203862,-0.0104672,0.0104672},{0.00991908,-0.00991908,0.,0.,0.,0.,-0.0203862,0.0203862,0.0104672,-0.0104672},{0.,0.,0.,0.,0.,0.,-0.0104672,0.0104672,0.0104672,-0.0104672},{0.,0.,0.,0.,0.,0.,0.0104672,-0.0104672,-0.0104672,0.0104672}};


If I plot the matrices, as well as their ratio, I obtain a visual representation of these:

Quiet@List[MatrixPlot[mat1], MatrixPlot[mat2], MatrixPlot[mat1/mat2]]


I think that there exists a numerical relation between mat1 and mat2, but I can't find it. Can anyone help me?

• Should your Dssmt and Dss be the same thing? – Roman May 9 '19 at 15:16
• @Roman there is a numerical relation among them, but it isn't a simple scaling operation by means of a scalar – Gae P May 9 '19 at 15:25
• Please make your code self-contained so that people can help without needing to guess. – Roman May 9 '19 at 15:46

Numerically all 100 differences between 100 corresponding elements of matrices correspond fall into just 5 symmetric values:

Round[Union[Flatten[mat1-mat2]],.0001]


{-0.0025,-0.0019,-0.0015,-0.001,0.,0.001,0.0015,0.0019,0.0025}

Which looks a lot like some small noise imposed on:

{-25,-20,-15,-10,0,10,15,20,25}/10000


It is actually quite easy to understand if you visualize your data. First of all you can see that the values of both matrices follow each other closely

ListPlot3D[{mat1,mat2},InterpolationOrder->0,PlotStyle->{Red,Blue},
BoxRatios->1,Mesh->None,SphericalRegion->True,PlotLegends->{"mat1","mat1"}]


You can see the also see the differences and realize, - for some elements mat1 is greater (more red), sometimes mat (more blue), and sometimes the same (white):

ListPlot3D[Rescale[Ds-Dss],InterpolationOrder->0,ColorFunction->
"TemperatureMap",BoxRatios->1,Mesh->None,SphericalRegion->True]


You also can see that all total

In[]:= Length[Flatten[mat1-mat2]]
Out[]= 100


differences between corresponding elements fall into just 9 different values and if you take in account symmetry - just 5 values:

BarChart[Union[Flatten[mat1 - mat2]], PlotTheme -> "Detailed"]


-- lets call them levels. And now you can find the statistics of how many differences correspond to a specific level -- and see it is symmetric:

ListLinePlot[Sort[Tally[Flatten[mat1 - mat2]]], PlotRange -> All, PlotTheme -> "Business"]