Actually, scratch that. I'm not testing enough of the candidate roots.

I'll need to go study up on my complex arithmetic.

Thanks,

-- 
Raul


On Mon, Jun 2, 2014 at 4:54 PM, Raul Miller <[email protected]> wrote:
> Here's how I  think I would approach this problem (ignoring the "golf" issue):
>
> monicN=: (<1) >@,@{@,~ (<i:1) #~ ]
>
> primrootN=:3 :0
>   if. 0=y do. 1 return. end.
>   <.&.(%&(9!:18'')) j./2 1 o. 2p1%2^y
> )
>
> rootsN=:3 :0
>   (primrootN y)^i.2^y
> )
>
> polysN=:3 :0
>   maybe=. monicN y
>   keep=. +./"#.0=maybe p."1 (primrootN y)^i.2^y
>   keep#maybe
> )
>
>    #@polysN"0 i. 10
> 0 2 4 6 16 45 126 357 1016 2908
>
> Note that these numbers are different from Peter Taylor's results. But
> looking at the first example in his list of a polynomial which is
> supposed to have a root which is a root of unity:
>
> (x^4) + (-x^3) + (-x^2) + (- x) + 1
>
> I can't find any roots which make that one work.
>
>    <./|1 _1 _1 _1 1 p. rootsN 4
> 0.414214
>
> That's not very close to zero, so I don't think I've got any precision
> errors. But I could be wrong. I'm actually pretty good at being wrong.
>
> Anyways, I'd like to know what the primitive root of 1 is that
> satisfies that equation. I don't think I can get any farther without
> that.
>
> Thanks,
>
> --
> Raul
>
> On Mon, Jun 2, 2014 at 4:12 PM, Dan Bron <[email protected]> wrote:
>> Don wrote:
>>> To the original problem.
>>
>> Here is the original problem:
>>
>> http://codegolf.stackexchange.com/questions/29901/find-number-of-polynomials-with-a-root-which-is-a-root-of-unity
>>
>>>  Does it require only that the absolute value of the number be 1 or does it
>>>  require the actual definition of a primitive root of unity?
>>
>> How about you tell me? ;)
>>
>> -Dan
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to