i:2
_2 _1 0 1 2

so yes, it it true that 1 and _1 are roots of unity and the others are not.
I am interested in whether rug, which is fairly simple, fails.

On 6/2/2014 10:47 PM, Linda Alvord wrote:
I'm not sure what your example of rug means.

     ruq i:2
0 1 0 1 0

Isn't this always true?

   y=:13
   ((ruq i:y)-:((1=i:y)+.(_1=i:y)))
1
    y=:14
    ((ruq i:y)-:((1=i:y)+.(_1=i:y)))
1
Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Cliff Reiter
Sent: Monday, June 02, 2014 9:17 PM
To: [email protected]
Subject: Re: [Jprogramming] Identifying roots of unity


In light of the link provided by R.E.Boss and x: on complex numbers
     x: 1j1
|domain error
|       x:1j1
|[-0]
We might define rational query as occurring when the denominator of the
rationalization is small and not an error

     ratq=:(1e8>{:@:(2&x:)) :: 0:"0
     ratq ?10$0
0 0 0 0 0 0 0 0 0 0
     ratq 1001%~i.10
1 1 1 1 1 1 1 1 1 1
     ratq 1 j. i.10
1 0 0 0 0 0 0 0 0 0

Then a number is a root of unity if its log divided by 2 pi i is rational
     ruq=:ratq@:(0j2p1%~^.)

     ruq i:2
0 1 0 1 0

     ruq ^0j2p1 * (i.%[)13
1 1 1 1 1 1 1 1 1 1 1 1 1

     ruq ?10$0
0 0 0 0 0 0 0 0 0 0
     Obviously limited by floating precision. Other limitations??
Best, Cliff


On 6/2/2014 5:55 PM, R.E. Boss wrote:
http://mathworld.wolfram.com/RootofUnity.html  seem to indicate you are
right.
R.E. Boss

Date: Mon, 2 Jun 2014 13:59:10 -0600
From: [email protected]
To: [email protected]
Subject: Re: [Jprogramming] Identifying roots of unity

Is n below a primitive root of unity?

     n=._1^3r8

*./2 x:(12 o. n)%o.2

48

n^48

1j_3.9968e_15


Yes.


On Mon, Jun 2, 2014 at 1:42 PM, Don Guinn <[email protected]> wrote:

I don't think that this is a complete test. If 1~:|n then it it is not a
primitive root of unity. But n must be a complex number when raised to
an
*integer* power is 1. Maybe converting the complex number to polar then
checking the angle and seeing if it is a rational fraction of a circle.

Obviously computers will always find some rational number though it
might
require raising n to a very large power. There should be some reasonable
limit as to how large the power may be.


On Mon, Jun 2, 2014 at 1:08 PM, Raul Miller <[email protected]>
wrote:
     1=|n

Thanks,

--
Raul


On Mon, Jun 2, 2014 at 2:54 PM, Dan Bron <[email protected]> wrote:
Given a complex number, how can I determine whether it is a primitive
root
of unity?

(This is a subtask of a code golf problem, so the shorter the better)

-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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
                                        
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
Clifford A. Reiter
Lafayette College, Easton, PA 18042
http://webbox.lafayette.edu/~reiterc/

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to