I'm not sure how I can explain this problem clearly. Nevertheless, let me try it.

I have to solve a sixth-order equation given by the expression:

$ 1 + { frac {2 kappa-1} {2 kappa-3} frac {Nezero} {k ^ 2}} + { frac {2 kappa-1} {2 kappa-3}} frac {Nbzero} {k ^ 2 Tbe}} – frac {(2 kappa-1) (2 kappa + 1)} {(2 kappa-3) ^ 2} Bigg[{frac{w^2 Nezero}{k^4 mpe}}+{frac{(w-kU_b)^2Nbzero}{k^4Tbe^2mpe}}Bigg]\ – { frac {Npzero} {w ^ 2} bigg (1+ frac {3k ^ 2Tpe} {w ^ 2} bigg)} – { frac {z ^ 2Nizero times mpi} {w ^ 2} bigg (1+ frac {3k ^ 2Tpe} {w ^ 2} bigg)} $

Here, there are constant values, I vary 'k' and find the values of 'w'. For a single value of k, I will have 6 w. Some are complex. I separate it in real and imaginary and write it on **'Solnofequation'**. For simplicity, we can think **solnofequation** as a matrix or table, which in this case has a dimension of 10 X 13 (10 lines and 13 columns; **the lines will change as a change "kinterval"**). The first column gives the values of k, the second column gives **real values** of **first root** for each k, the third column gives **imaginary part** of **first root** etc.

Now I have to take each real part in a line, subtract 'k' times ub divide by k times mpe. And then all this should be multiplied by kappa2 given in the program.

For example. `solnofequation[[2]]`

given `{0,2, 0,161643, 0, 1,06185, 0, -0,144333, -0,109161, -0,144333, 0,109161, 0,0116811, -0,1117174, 0,0116811, 0 , 1117174}`

Here, first element if k, the second element is real by the first root, the third element is an imaginary part of the first root, the fourth element is the real one by the second root and so on. Here, what I have to do is $ frac {(0.161643-0.2 * ub)} {mpe} * kappa2 $then $ frac {(1.06185-0.2 * ub)} {mpe} * kappa2 $ soon.

Further, `solnofequation[[8]]`

given `{0.8, 0.609319, 0, 4.42253, 0, -0.636614, -0.409612, -0.636614.0.409612, 0.0366778, -0.453399, 0.0366778, 0.453399. }`

Here, actually, what I have to do is $ frac {(0.609319-0.8 * ub)} {mpe} * kappa2 $then $ frac {(4.42253-0.8 * ub)} {mpe} * kappa2 $ etc.

This must be done at each row. Then I have to export to a data file, where **first column** gives values of k, **second column** given **real** values of **first root** for each k, **third** the column gives **imaginary** part of **first root** for each k, **fourth column** give the **value of the real part of the first root after the calculation above for each k**, **fifth column** give the real values of the second root for each k, **sixth column** given **imaginary** part of **second root** for each k, **seventh column** given **the value of the real part of the second root after the calculation above for each k** etc.

All I could muster was:

- solve the equation
- write it on a table with a real part and a separate imaginary part
- to export the file without what the computation I need.

Ideally, what I'm looking for is like this:

The code I wrote is:

```
Erase everything["Global`*"]
[Kappa] = 6;
Ub = 2.4;
mp = 1836.2;
mpi = 0.25;
z = 2.0;
Nbzero = 0.01;
Nezero = 1.0 - Nbzero;
Nizero = 0.05;
Npzero = 1.0 - (z Nizero);
Tbe = 0.0046;
Tie = 0.4;
Tpe = 0.2;
a1 = 1 + (2 [Kappa] - 1) / (2 [Kappa] - 3) Nezero / k ^ 2 + (
2 [Kappa] - 1) / (2 [Kappa] - 3) Nbzero / (k ^ 2 Tbe);
a2 = ((2 [Kappa] - 1) (2 [Kappa] + 1)) / (2 [Kappa] - 3) ^ 2;
a3 = Nezero / (k ^ 4 mpe);
a4 = Nbzero / (k ^ 4 Tbe ^ 2 mpe);
a5 = Nizero z ^ 2 mpi;
a6 = 3 Link mpi k ^ 2;
a7 = Npzero;
a8 = 3 k ^ 2 Tpe;
first = a1;
second = a2 (a3 w ^ 2 + a4 (w - k * Ub) ^ 2);
third = a5 / w ^ 2 (1 + a6 / w ^ 2);
va = a7 / w ^ 2 (1 + a8 / w ^ 2);
dsprnrelatn = a1 - second - third - fourth;
rots = w /. nSolve[dsprnrelatn == 0, w];
value of kstr = 0.1;
kinterval = 0.1;
kendvalue = 1;
solnofequation =
Table[Flatten@{k, ReIm /@ rots}, {k, kstrtvalue, kendvalue,
kinterval}]
solnofequation[[8]]kappa2 = gamma[[[[[Kappa] + 1](2 [Kappa]) (3/2);
Table[solnofequation[[1, c]], {c, 1, 13}]Table[solnofequation[[1, c]], {c, 2, 12, 2}]a = table[Table[solnofequation[[r, c]], {c, 2, 12, 2}], {r, 1, 5}]setDirectory[NotebookDirectory[]];
titles1 =
Join[{{"k", "real_part1", "imag_part1", "real_part2", "imag_part2",
"real_part3", "imag_part3", "real_part4", "imag_part4",
"real_part5", "imag_part5", "real_part6", "imag_part6"}},
solnofequation];
Export["mathtica_z" <> ToString[z] <> "Nbzero" <> ToString[Nbzero] <>
"Nizero" <> ToString[Nizero] <> "Tpe" <> ToString[Tpe] <> "Tie" <>
ToString[Tie] <> "Tbe" <> ToString[Tbe] <> "Ub" <> ToString[Ub] <>
"_kappa" <> ToString[[[[[Kappa]]<> ".dat", header1, "Table"];
```

Any help will be appreciated. I know that this question is very long, I could not stop it. Thank you at least to those who took the time to read this long question.