# How do I make a table of values that looks like this? I want to make a table that looks like the above image to record values from my function $$\omega(m,n)$$ as defined in the following Mathematica code:

\[Lambda]   = 1550 10^-9; (*Unit: m*)
c   = 2.99 10^8;   (*Unit: m/s*)
n0 = 1.2;
\[Mu]0 = 4 \[Pi] 10^-7;
\[Epsilon]0 = 8.854 10^-12; (*Unit: F/m*)
a    = 2. 10^-6;
b    = 0.22 10^-6;

\[Omega][m_, n_] := \[Pi]/(n0*Sqrt[\[Mu]0 * \[Epsilon]0])*
Sqrt[m/a^2 + n/b^2] (*Define the Cutoff Frequency function*)
\[Omega][0, 1]
\[Omega][1, 0]


The documentation has the nice Table tool, but I quite desire the style of the incomplete table in the above image. How can I replicate this?

• I am getting different values than shown from your function w[m,n] for example !Mathematica graphics does not give 2.00 as you show. Aug 4, 2022 at 18:46
• @Nasser Good observation. The provide table image is of the same function, but with different physical parameters. My $\omega(m,n)$ function will provide different values than shown in the image. Aug 4, 2022 at 18:54

Something to get you started. You can modify the Grid if you just want frame line around specific rows. Left as an exercise :) code

λ = 1550 10^-9; (*Unit:m*)
c = 2.99 10^8;   (*Unit:m/s*)
n0 = 1.2;
μ0 = 4 π 10^-7;
ϵ0 = 8.854 10^-12; (*Unit:F/m*)
a = 2. 10^-6;
b = 0.22 10^-6;

ω[m_, n_] := π/(n0*Sqrt[μ0*ϵ0])*Sqrt[m/a^2 + n/b^2] (*Define the Cutoff Frequency function*)
top = Table[n, {n, 0, 3}];
left = Table[m, {m, -1, 6}];
data = Table[ω[m, n], {m, 0, 6}, {n, 0, 3}]
data = PrependTo[data, top];
data = Transpose[Insert[Transpose@data, left, 1]];
g = Graphics[{Text[Style["n", 16], Scaled[{.75, .75}]],
Text[Style["m", 16], Scaled[{-.15, .25}]],
Line[{{0, 0}, {-1, 1}}]}, ImageSize -> 40];
data[[1, 1]] = g;
Grid[data, Frame -> All]


To adjust frame lines to make it as shown, replace the Grid command with

Grid[data, Frame -> All, Spacings -> {1, 1},
Dividers -> {{False, True, Table[False, {4}]}, {False, True,
Table[False, {7}]}}] You could use this code based on TableForm:

ms=Range[0,6];
ns=Range[0,3];

tableData=Table[
If[And[1<=m+n<=6,Implies[n==3,m<=0]],
NumberForm[\[Omega][m,n],3],""],
{m,ms},{n,ns}]; 