Hey Sreeraj,
which version of Mathematica are you using? ReIm
is a function the was introduced in 10.1 and I always forget to mention that my code runs on the latest version 11.1. In this case, the fix is easy, define the ReIm
function yourself
ReIm[x_?NumericQ] := {Re[x], Im[x]};
ReIm[x_] := x;
As for your other question, this can easily be done, but you have to remember, that your root might be a complex number. Let's say you want to plot your k
against the real part of the first root, you can use:
data = Table[Flatten@{k, roots}, {k, 0.01, 1, .01}];
ListPlot[Re@data[[All, {1, 2}]]]
