# Manipulate[]'ing complex roots of an equation using a 2D slider [closed]

I want to make a demonstration of how the complex roots of a polynomial change when I alter the coefficients. Here is my attempt:

QuintRoots[t_] := Map[{Re[#], Im[#]} &, x /. NSolve[x^5 - x - t == 0, x]]

DrawRoots[t_] := ListPlot[QuintRoots[t], PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}},
PlotStyle -> PointSize[Large], AspectRatio -> Automatic]

Manipulate[DrawRoots[t[[1]] + I*t[[2]]], {t, {-1, 1}, {-1, 1}}]


QuintRoots[] and DrawRoots[] work exactly as I would expect. The final command produces a nice-looking 2D slider and ListPlot below it but, when I try to move the slider, it doesn't move.

A one dimensional slider, such as

 Manipulate[DrawRoots[E^{I*t}], {t, 0, 2 Pi}]


works fine. So does the documentation center's example of a 2D slider,

 Manipulate[ParametricPlot[{Sin[t + d[[1]]], Sin[t + d[[2]]]}, {t, 0, 2 Pi}],
{d, {0, 0}, {Pi, Pi}}]


PS Bonus question: If I can get this to work, I would also like to mark the points $\pm 3/ \sqrt{32}$ and $\pm 3 i /\sqrt{32}$ in the slider field, which are the points where we get multiple roots. Can this be done?

-

## closed as too localized by Dr. belisarius, Oleksandr R., Mr.Wizard♦Jan 12 '13 at 14:44

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Your 2D slider goes from {-1, 1} to {-1, 1}? – Rojo Jan 11 '13 at 22:00
That is to say, you want {t, {-1, -1}, {1, 1}}. Else it remains pinned in the southwest, somewhere near Phoenix. – Daniel Lichtblau Jan 11 '13 at 22:06
As stated in the documentation : The limits in Slider2D are specified by giving coordinates of corners, not x and y ranges. – b.gatessucks Jan 11 '13 at 22:10
could also use a Locator: {{t, {0, 0}}, Locator} – cormullion Jan 11 '13 at 22:15
voting to close as TL – Dr. belisarius Jan 11 '13 at 22:19

I've used this control before, in case it helps:

QuintRoots[t_] :=
Map[{Re[#], Im[#]} &, x /. NSolve[x^5 - x - t == 0, x]]

DrawRoots[t_] :=
ListPlot[QuintRoots[t], PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}},
PlotStyle -> PointSize[Large], AspectRatio -> Automatic]

Manipulate[
DrawRoots[t], {{t, 0.5},
LocatorPane[
Dynamic[{Re[t], Im[t]}, (t = Complex @@ Clip[#, {-1., 1.}]) &],
Labeled[Graphics[{White, Rectangle[{-1., -1.}, {1., 1.}], Blue,
Point[3/Sqrt[32] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}]},
Axes -> True, ImageSize -> 130], Row[{"t = ", Dynamic[t]}]]] &,
ControlPlacement -> Left}]


Nice idea for a demonstration.

-