# Nested Tables and List Plot

Take two matrices which depends on three parameters i1,i2 and i3

m1 = {{i1, 0, 0}, {0, i2, 0}, {0, 0, 0}}
m2 = {{0, i1, 0}, {0, i2, 0}, {0, 0, i3}}


I am using a function defined as

NT[n_] := Module[{n1 = n},
Table[Table[Eigenvalues[n1], {i1, 0, 1, 0.2}], {i2, 0, 0.2,
0.1}, {i3, 0, 0.3, 0.1}]
]


((But I need to plot the value of the factor (NT[m1])^2-NT[m2]))^2 with all combinations of the values of the parameters i2 and i3) In all the Plots the Value of the parameter appear along the X-Axis. (I am able to find out the numerical values of the factor (NT[m1])^2-(NT[m2])^2 as given below, but how to make,list plot of \ this factor with all the combinations of the parameter values i2 and i3)

I tried the following code

NT[n_] := Module[{n1 = n},
Table[ListLinePlot[Table[Eigenvalues[n1], {i1, 0, 1, 0.2}],
PlotLabel -> Row@{"i2=", i2, "i3=", i3}], {i2, 0, 0.2, 0.1}, {i3,
0, 0.3, 0.1}]
]


but do not calculate the factor (NT[m1])^2-NT[m2]))^2

• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Commented Apr 30, 2016 at 18:05
• The styling of your question can be improved. Please take the time to read the markdown help page. You'll better communicate your problem when you use the right formatting.
– user9660
Commented Apr 30, 2016 at 18:06

Honestly speaking, your question is not very clear. I put this answer based on what I understand

nt[i1_, i2_, i3_] := Module[{m1, m2, ev1, ev2},
m1 = {{i1, 0, 0}, {0, i2, 0}, {0, 0, 0}};
m2 = {{0, i1, 0}, {0, i2, 0}, {0, 0, i3}};
ev1 = Sort@Eigenvalues[m1];
ev2 = Sort@Eigenvalues[m2];
(ev1[[#]]^2 - ev2[[#]]^2) & /@ Range[Length[ev1]]
]

Table[
dat = Table[{i, nt[i, j, k]}, {i, 0, 1, 0.1}];
ListLinePlot[Table[{#[[1]], #[[2, i]]} & /@ dat, {i, 3}],
Frame -> True,FrameLabel -> {"i1", None},
PlotLabel -> Row@{"i2=", j, "i3=", k}]
,{j, 0, 1, 0.5}, {k, 0, 1, 0.5}] // Grid