0
|
3240 Views
|
|
1 Total Likes
View groups...
Share
GROUPS:

# Convert root to coordinate form

Posted 9 years ago
 Hey, I want to convert the output of the Root function to coordinate in the form {{2,0}{-2,0}}, because I want to view them in the LocatorPane. Thats the code i wrote so far: zero1 = x /. {ToRules[Roots[x^2 - 4 == 0, x]]}; xval[k_] := zero1[[k]] yval = 0 Join[{Do[List[xval[b], yval], {b, Exponent[x^2, x]}]}]  But if I evaluate it I just get {{0,0},{0,0}} as a result. The code should work for every polynomial function thats why I use the Do function In the case of a polynomial with degree 2 the code Join[{List[xval, yval]}, {List[xval, yval]}]  works. I just cant find the mistake I made or don't know how to solve in in mathematica.
 On my system I get the result {Null}. That's because Do executes but does not give an output. This seems to work: zero1 = x /. {ToRules[Roots[x^2 - 4 == 0, x]]}; xval[k_] := zero1[[k]] yval = 0 Table[{xval[b], yval}, {b, Exponent[x^2, x]}] However, I would rather achieve the goal this way: {Re[x], Im[x]} /. NSolve[x^2 - 4 == 0, x]