I have a situation where a function sys yields solutions in complex values while I change its argument `x from $-\pi$ to $+\pi$ as in the following:
Bands[sys[t1, t2, 3], {x, -\[Pi], \[Pi]}]
which gives me list of complex values with x as following:
{{-3.14159, -1.99705 + 0.0000290634 I}, {-3.02073, -1.99703 -
0.0000293392 I}, {-2.8897, -1.99698 -
0.0000302499 I}, {-2.76735, -1.99691 - 0.0000316411 I},...{3.14159, 1.99705
+0.0000290634 I}}
Now if I write
Re[Bands[sys[t1, t2, 3], {x, -\[Pi], \[Pi]}]]
it gives me correct list of real parts of the complex values which is:
{{-3.14159, -1.99705},{-3.02073, -1.99703},{-2.8897, -1.99698}...so on} but for imaginary parts:
Im[Bands[sys[t1, t2, 3], {x, -\[Pi], \[Pi]}]]
it gives me:
{{0,0.0000290634 I},{0,- 0.0000293392 I},{0,- 0.0000302499 I}...so on}
thus, not showing the correct values of variable x. As a result, the real values giving me correct plot but the imaginary values don't give me correct plot since the values of 'x' show all zero which is not true.
Someone (@Rom38) suggested me to use: {First@#, Im@Last@#} & /@ [Bands[...]. But in my case how do I implement it when the plot command I use to plot the imaginary part is:
PlotBands[Im[Bands[sys[t1, t2, 1.5], {x, -2 \[Pi], 2[Pi]}]], FrameLabel -> {"x", "Im(E)"}]
Any help will be much appreciated. Many thanks!
{First@#,Im@Last@#}&/@Bands[....]– Rom38 Apr 16 '18 at 06:27Imfor both{x,y}, you will have{0,Im[y]}in case ifxis already real. Mapping my pure function{First@#,Im@Last@#}&for each sublist of your list, you will apply theImonly to second element of each{x,y}pair. You should use the/@command for this. As result, just copy-paste my code from previous comment and see the result – Rom38 Apr 16 '18 at 07:19