Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a polynomial with coefficients that are integer polynomials in another (complex) variable. For example:

1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &

I want to solve for $v$ such that the second root of this polynomial is a root of unity. Notice that $v=0$ is such a solution:

In[67]:= Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2] /. {v -> 0}
Out[67]= 1

My two attempts to pull this information out of Mathematica have not worked. Namely,

In[68]:= Reduce[RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]], {v}]
Out[68]= False

and

In[66]:= Solve[RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]], {v}]
Out[66]= {}

both say that there are no solutions, which is not the answer that I am looking for.

Question:

How do I solve for $v$ such that some expression is a root of unity?

share|improve this question
    
Have you noticed that this function is linear in $v^2$? This means that a very simple formula for $v$ can be found as the square root of a rational function of #1. Replacing #1 by $\exp(2 k \pi i/n)$ for integral $k$ and nonzero integral $n$ finishes the job. –  whuber May 23 '12 at 15:48

2 Answers 2

Reduce[1 + (1 - v^2) (x + I y) + (-3 - v^2) (x + I y)^2 + (x + I y)^3 == 0 && x^2 + y^2 == 1, {y, x, v}] seems to give what you want. In general, one might wish to try expanding complex variables into explicit real and imaginary parts, if the usual treatments do not work.

share|improve this answer
1  
Note that the condition x^2 + y^2 == 1 does not necessarily guarantee that x + I y is a root of unity, but this is at least a starting point... –  J. M. May 23 '12 at 14:30
    
Along those lines, I suppose that Reduce[1 + (1 - v^2) x + (-3 - v^2) x^2 + x^3 == 0 && Exists[n, Element[n, Integers] && n > 0 && x^n == 1], {x, v}] would work, but I have no idea how long it will take to execute given that there is an existential quantifier. –  Tyson Williams May 23 '12 at 15:10

The reason why your attempts didn't work is that RootOfUnityQ like all functions ending in Q gives False if the object cannot be determined right away as unit root. For example RootOfUnityQ[x] evaluates straight to False, and so does RootOfUnityQ[Root[1 + (1 - v^2) #1 + (-3 - v^2) #1^2 + #1^3 &, 2]]. So e.g. your first attempt basically reduces to Reduce[False, {v}] which of course evaluates to False.

It is easy to be fooled by those *Q functions which from their name look more like mathematical functions than structural ones, see e.g. the answers on Why does Mathematica claim there is no even prime? for more detailed explanations of those *Q functions. I consider them one of the most confusing functionalities (if not the most confusing functionality) of Mathematica, but basically, the key thing to remember is that all *Q functions have an implied TrueQ.

As of a mathematical expression which could replace RootOfUnityQ I think in many cases Abs[x] == 1, while not exactly equivalent, should suffice. For those where it doesn't, maybe Log[x]/(I Pi) \[Element] Rationals would be a good replacement.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.