úÎ1Þ.     (c) Scott N. Walck 2012-2013GPL-3 (see LICENSE)Scott N. Walck <walck@lvc.edu> experimental Trustworthy%A cyclotomic number.The primitive n"th root of unity. For example, (4) = , is the primitive 4th root of unity, and G(5) = exp(2*pi*i/5) is the primitive 5th root of unity. In general,  n = exp(2*pi*i/n).The square root of an .The square root of a  number.The square root of -1.Make a Gaussian rational; gaussianRat p q is the same as  p + q * i.8A complex number in polar form, with rational magnitude r and rational angle s of the form r * exp(2*pi*i*s);  polarRat r s is the same as  r * e q ^ p , where s = p/q . This function is the same as .YA complex number in polar form, with rational magnitude and rational angle in degrees.]A complex number in polar form, with rational magnitude and rational angle in revolutions. Complex conjugate. #Real part of the cyclotomic number. (Imaginary part of the cyclotomic number.&Step 1 of cyclotomic is gcd reduction.<Step 2 of cyclotomic is reduction to a rational if possible.–Compute phi(n), the number of prime factors, and test if n is square-free. We do these all together for efficiency, so we only call factorise once.&Step 3 of cyclotomic is base reduction Sum of two cyclotomic numbers.!"Product of two cyclotomic numbers."5Product of a rational number and a cyclotomic number.#Additive identity.$Additive inverse.%Multiplicative inverse.  Is the cyclotomic a real number? Is the cyclotomic a rational?&Is the cyclotomic a Gaussian rational?$Export as an inexact complex number.-Export as an inexact real number if possible.,Return an exact rational number if possible.'Sine function with argument in degrees.)Cosine function with argument in degrees.+Sine function with argument in revolutions.-Cosine function with argument in revolutions.The golden ratio,  (1 + "5)/2.Discrete Fourier transform, 7X_k = sum_{n=0}^{N-1} x_n cdot e^{-i 2 pi frac{k}{N} n}.'Inverse discrete Fourier transform, Ax_n = frac{1}{N} sum_{k=0}^{N-1} X_k cdot e^{i 2 pi frac{k}{N} n}.GSolutions to the quadratic equation a x^2 + b x + c = 0. Returns & if a == 0.'abs and signumw are partial functions. A cyclotomic number is not guaranteed to have a cyclotomic absolute value. When defined, signum cL is the complex number with magnitude 1 that has the same argument as c; signum c = c / abs c.G()*+,-./012 magnitudeangle, in revolutionscyclotomic number magnitudeangle, in degreescyclotomic number magnitudeangle, in revolutionscyclotomic number 3456789:;<=>?@ABC !"#$DE% FGabcrootsHI'  D()*+,-./012 3456789:;<=>?@ABC !"#$DE% FGHI'J      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPcyclo_CXzGU53TZmC4INCPFJtnUCData.Complex.Cyclotomic Cyclotomice sqrtIntegersqrtRati gaussianRatpolarRat polarRatDeg polarRatRevconjrealimagisRealisRat isGaussianRat toComplextoRealtoRatsinDegcosDegsinRevcosRev goldenRatiodftdftInv rootsQuadEq integer-gmpGHC.Integer.TypeIntegerbaseGHC.RealRational gcdReduce tryRational phiNrpSqfree tryReducesumCycprodCyc prodRatCyczeroCycaInvCycinvCycGHC.BaseNothing$fNumCyclotomicordercoeffs showBaseExp leadingTermfollowingTerms followingTermshowRatebsqrt2sqrtPositiveIntegerabsValsigNum convertToBase removeZeros cyclotomic mkCyclotomicgcdCycequalCoefficientslenCyc reduceByPrimeequalReplacements replacementsreplace includeMods removeExpspqPairsextraneousPowersmultiplyExponentsproductOfGaloisConjugatesgcdListequal$fShowCyclotomic$fFractionalCyclotomic