# How to use list of rules from solve to plot complex solutions?

I'm trying to find the frequency for three circular particles connected in a circle with different spring constants and different masses. After deriving the equations of motion, I get three complex equations for w which I turn into a matrix. By setting the determinant to 0 I should be able to find w (the frequency). k, l, m, M are constants and w is a function of ka.

For simplification, I changed the exponential function into a trigonometric function. I assumed I'd get some real solutions, but mathematica only found complex solutions. So I'm wondering if the solutions are incorrect or if I went wrong somewhere. The plot comes out completely empty.

Here is my code so far:


In[299]:= k = 9;
l = 12;
m = 2;
M = 4 ;
mat = {{m*w^2 - 2*k, k, k*Exp[-3 I*ka]}, {k, M*w^2 - (l + k),
l}, {-k*Exp[-3 I*ka], l, M*w^2 - (k - l)}};
mydet = ExpToTrig[Det[mat]]
sol = Solve[mydet == 0, w]

Out[304]= 3483 + 558 w^2 - 432 w^4 + 32 w^6 - 1701 Cos[6 ka] +
324 w^2 Cos[6 ka] + 1701 I Sin[6 ka] - 324 I w^2 Sin[6 ka]

Out[305]= {{w -> -\[Sqrt](9/
2 + (1386 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (324 2^(1/3) Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] +
Sqrt[4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
1/(96 2^(
1/3)))((-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3)) + (324 I 2^(1/3) Sin[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3))}, {w -> \[Sqrt](9/2 + (
1386 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
324 2^(1/3)
Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3)/(
96 2^(1/3)) + (
324 I 2^(1/3)
Sin[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3))}, {w -> -\[Sqrt](9/
2 - (693 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (693 I 2^(1/3) Sqrt[3])/(-4478976 + 6718464 Cos[6 ka] +
Sqrt[4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (162 2^(1/3) Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] +
Sqrt[4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (162 I 2^(1/3) Sqrt[3] Cos[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
1/(
192 2^(1/3)))((-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3)) - (
1/(64 2^(1/3) Sqrt[3]))
I (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (162 I 2^(1/3) Sin[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (162 2^(1/3) Sqrt[3] Sin[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3))}, {w -> \[Sqrt](9/2 - (
693 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
693 I 2^(1/3) Sqrt[
3])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
162 2^(1/3)
Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
162 I 2^(1/3) Sqrt[3]
Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3)/(
192 2^(1/3)) - (1/(64 2^(1/3) Sqrt[3]))
I (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
162 I 2^(1/3)
Sin[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
162 2^(1/3) Sqrt[3]
Sin[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3))}, {w -> -\[Sqrt](9/
2 - (693 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (693 I 2^(1/3) Sqrt[3])/(-4478976 + 6718464 Cos[6 ka] +
Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (162 2^(1/3) Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] +
Sqrt[4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (162 I 2^(1/3) Sqrt[3] Cos[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
1/(192 2^(
1/3)))((-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3)) + (
1/(64 2^(1/3) Sqrt[3]))
I (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (162 I 2^(1/3) Sin[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) + (162 2^(1/3) Sqrt[3] Sin[6 ka])/(-4478976 +
6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3))}, {w -> \[Sqrt](9/2 - (
693 2^(1/3))/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
693 I 2^(1/3) Sqrt[
3])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
162 2^(1/3)
Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
162 I 2^(1/3) Sqrt[3]
Cos[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(
1/3) - (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3)/(
192 2^(1/3)) + (1/(64 2^(1/3) Sqrt[3]))
I (-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) - (
162 I 2^(1/3)
Sin[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3) + (
162 2^(1/3) Sqrt[3]
Sin[6 ka])/(-4478976 + 6718464 Cos[6 ka] + Sqrt[
4 (-133056 + 31104 Cos[6 ka] -
31104 I Sin[6 ka])^3 + (-4478976 + 6718464 Cos[6 ka] -
6718464 I Sin[6 ka])^2] - 6718464 I Sin[6 ka])^(1/3))}}

ComplexListPlot[w /. sol, PlotLegends -> "Expressions"]


The plot comes out empty even though I have 6 complex solutions. I have also tried Plot[w/. sol, {ka, 0, pi}] which also gives an empty plot. I get no error with these codes so I'm assuming there is a problem in the way the solution is formatted.

• Just look more carefully at your code. What is ka ? It is not defined anywhere. That is why the plot is empty. Dec 3, 2019 at 2:53
• Welcome to MSE! You can use ReImPlot[] to visualize complex solutions like this: funcs=w/.sol; Grid@Partition[Table[ReImPlot[funcs[[i]], {ka, 0, π}, PlotLabel -> "sol " <> ToString@i, ReImStyle -> {Red, Blue}, Frame -> True], {i, 6}], 3]. You can see that with given constants there is no real solutions (Im = 0) except several points (values of ka) which are multiples of π/6 in accordance with exponent Exp[-6 I ka] in solution.
– Alx
Dec 3, 2019 at 4:24

k = 9;
l = 12;
m = 2;
M = 4;
mat = {{m*w^2 - 2*k, k, k*Exp[-3 I*ka]}, {k, M*w^2 - (l + k), l},
{-k*Exp[-3 I*ka], l, M*w^2 - (k - l)}};
mydet = ExpToTrig[Det[mat]];

sol = Solve[mydet == 0, w] // Simplify;


You can use ParametricPlot to plot in the complex plane

ParametricPlot[
Evaluate[{Re[w], Im[w]} /. sol], {ka, 0, Pi},
Frame -> True,
FrameLabel -> (Style[#, 14, Bold] & /@ {"Re(w)", "Im(w)"}),
PlotPoints -> 100,
PlotRange -> All,
PlotLegends -> Automatic,
ImageSize -> Large]


• Just a reminder. We have ReIm since V10.1, so Evaluate[{Re[w], Im[w]} /. sol] can be replaced by Evaluate[ReIm[w] /. sol] Dec 3, 2019 at 15:02