MyNixOS website logo
Description

The Field of Cyclotomic Numbers.

The cyclotomic numbers are complex numbers that can be thought of as the rational numbers extended with the roots of unity. They are represented exactly, enabling exact computations. They contain the Gaussian rationals (complex numbers with rational real and imaginary parts) as well as the square roots of all rational numbers. They also contain the sine and cosine of all rational multiples of pi. The algorithms implemented in this package are taken from the 'Haskell' package 'cyclotomic', whose algorithms are adapted from code by Martin Schoenert and Thomas Breuer in the 'GAP' project (<https://www.gap-system.org/>). Cyclotomic numbers have applications in number theory, algebraic geometry, algebraic number theory, coding theory, and in the theory of graphs and combinatorics. They have connections to the theory of modular functions and modular curves.

cyclotomic

R-CMD-check

The field of cyclotomic numbers.


The set of cyclotomic numbers is a field obtained by extending the set of rational numbers with the complex roots of unity. The main function used to construct a cyclotomic number in this package is zeta, it returns a primitive root of the unity. For example zeta(4) is the primitive fourth root of unity, that is the imaginary unit.

library(cyclotomic)
im <- zeta(4)
im^2
## -1

Arithmetic on cyclotomic numbers can be performed with this package. It is exact. In particular it allows to deal with the Gaussian rational numbers: the complex numbers whose both real and imaginary part are rational.

a <- as.cyclotomic(5)
b <- as.cyclotomic("3/2")
(a + im * b)^2
## 91/4 + 15*zeta(4)

Note that while zeta(4) is printed as zeta(4), this is not the case for all roots of unity:

zeta(9)
## -zeta(9)^4 - zeta(9)^7

The set of cyclotomic numbers contains all the square roots of rational numbers, and therefore the package allows exact calculations on such square roots. For example, using float numbers, the following equality does not hold true:

sqrt(5/3) == sqrt(5) / sqrt(3)
## [1] FALSE

But it holds true using the cyclotomic arithmetic:

cycSqrt("5/3") == cycSqrt(5) / cycSqrt(3)
## [1] TRUE

The set of cyclotomic numbers also contains the cosine and the sine of the rational multiples of pi. In particular, it contains the cosine and the sine of any rational number when this number represents an angle given in degrees.

cosDeg(60)
## 1/2
sinDeg(60) == cycSqrt(3) / 2
## [1] TRUE

This package is a port of the Haskell library cyclotomic, written by Scott N. Walck.

Metadata

Version

1.3.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows