a[1] = 2;
a[2] = 4;
a[3] = 7;
E = 1.5;
l = 0.02;
Print["m n1 n2 n3"];
For[m = 1, m < 10, m++,
For[i = 1, x = 0, i <= 3, i++;
x = (a[i] + m + E)/l;
If[i == 1, n1 = x; i == 2, n2 = x; i == 3, n3 = x];];
Print[m " ", n1 " ", n2 " ", n3];]
I want to get output in table format. If anyone can solve this their help will be most welcome.
Table format means I want my output to look like this:
m n1 n2 n3
1 - - -
2 - - -
3 - - -
and so on up to 10 values of m.
Now if you are understanding my problem. please help me.
a[1] = 2; a[2] = 4; a[3] = 7; e = 1.5; l = 0.02; Print["m n1 n2 n3"]; For[m = 1, m < 10, m++, For[i = 1; x = 0, i <= 3, i++, x = (a[i] + m + e)/l; Which[i == 1, n1 = x, i == 2, n2 = x, i == 3, n3 = x];]; Print[m " ", n1 , " ", n2, " ", n3];]$\endgroup$Grid[Table[ f[m,i] , {m, 1, 9}, {i, 1, 3}]]. If that gives you the right size grid, then you're halfway there. After you see whatGridandTablecan do for you, the next step is to define a functionf[m,i]or to replacef[m,i]with an appropriate expression that gives what you want in the grid. If you get stuck, please edit your question and add your new code to show us your changes and where you are stuck. $\endgroup$