I have a code that says like this:
ClearAll("Global`*")
tbl = Table({x, N(x^0.6), N(Sqrt(x)), N(x^0.2), N(x^(1/3))}, {x, 0, 2,
0.01});
const1 = 20;
const2 = 15;
modifiedr(v_, k_) := (k  v) const1/const2 ;
newrow({k_, r1_, r2_, r3_, r4_}) := {k, r1, modifiedr(r1, k), r2,
modifiedr(r2, k), r3, modifiedr(r3, k), r4, modifiedr(r4, k)};
newtbl = Map(newrow, tbl);
headings =
Flatten({"k",
Table(str = ToString(i); {"r" <> str, "modified_r" <> str}, {i, 1,
4})});
SetDirectory(NotebookDirectory());
Export("file" <> ToString(const1) <> ".dat",
Join({headings}, newtbl));
Here comes the first question:
 You can see that there is a line in the code
{k,r1,modifiedr(r1,k),r2,modifiedr(r2,k),r3,modifiedr(r3,k),r4,modifiedr(r4,k)}
. This is fine when you only have 4 r (r1,r2,r3,r4
) But when you have a big no. of r, let's say until 20 (r1,r2,r3, …, r20
), this can become tedious. Is there any way to automate this procedure like what I have written in "headings"?
Now, I want to draw some graphs with the xaxis as the first column in "newtbl" and the second, fourth, sixth and eight columns in "newtbl" as the yaxis. For this, I first extracted data in xaxis, yaxis1, yaxis2, yaxis3, yaxis4. For this, I wrote the following code:
rowlength = Length(newtbl);
xaxis = Table(newtbl((i, 1)), {i, 1, rowlength});
yaxis1 = Table(newtbl((i, 2)), {i, 1, rowlength});
yaxis2 = Table(newtbl((i, 4)), {i, 1, rowlength});
yaxis3 = Table(newtbl((i, 6)), {i, 1, rowlength});
yaxis4 = Table(newtbl((i, 8)), {i, 1, rowlength});
ListLinePlot(
Transpose({xaxis, #}) & /@ {yaxis1, yaxis2, yaxis3, yaxis4},
AxesStyle > Directive(GrayLevel(0), AbsoluteThickness(1.6)),
PlotLabel > None, LabelStyle > {16, GrayLevel(0)},
AxesLabel > {"k(Rho)", "(Omega)"})
I get the desired plot as shown;
The second question comes here:
 Extracting and writing
xaxis,yaxis1
etc. It becomes tedious if I have a big no. of r. Is there any way to solve this problem?
I modified the code according to what was written here, that is
ListLinePlot(Transpose(Table(Map({newtbl((i, 1)), #} &, Rest(newtbl((i)))), {i, Length(newtbl)})))
Y ListLinePlot(Thread(Thread@{#, {##2}} & @@@ newtbl))
. But while I do it both ways, I get a plot, which shows an additional set of lines:
What am I doing wrong here and, first of all, what does the previous code mean?
The third question is this:

Now, I want to trace it with a certain imposed condition. e.g.:
to. plot r1 when modified_r1 has a value between 0.2 and 0.4
yes. plot r2 when modified_r2 has a value between 0.23 to 0.33
C. trace r3 when modified_r3 has a value between 0.34 to 0.45
re. plot r4 when modified_r4 has a value between 0.54 to 0.63
How can I do this?
Thanks in advance…