Back to main (Karim Belabas)

Cubic

This the home of the CUBIC software. The program computes a list of (isomorphism classes of) cubic number fields of bounded discriminant. I wrote this program back in 1995-96 as a toy project, rewrote it in 2003 for a different project involving the 3-ranks of quadratic fields, and eventually made it publicly available in 2009. The current version requires installing the PARI/GP library. I implemented the same functionality for many more degrees and Galois groups with Henri Cohen as the nflist function in GP, which is available natively since pari-2.15 (2022). The GP function is less optimized than cubic and slower (much slower if you only want to count fields and not produce an equation) but should be sufficient for most practical purposes.

I no longer work on this or related projects but I update the code from time to time when the PARI interface changes, and I will try to fix bugs if you report them. Have fun !

[Download] (version 1.4, 10/04/2025)

Cubic vs. nflist benchmark
? #nflist("S3",[1,10^7])  \\ S3 fields |discriminant| less than 10^7
time = 3,059 ms.
%1 = 2497935
? #nflist("S3",[1,10^7], 0) \\ real S3 cubic fields only
time = 663 ms.
%2 = 592421
? #nflist("C3",[1,10^7]) \\ C3 fields only
time = 1 ms.
%3 = 501
? #nflist("S3",[1,10^7], 1) \\ complex cubic fields only
time = 2,433 ms.
%4 = 1905514
$ cubic 10^7> /dev/null
H = 592922                     \\ N.B. C3 and S3 real cubic fields
Global Time: 602 ms
$ cubic -10^7> /dev/null
H = 1905514
Global Time: 1878 ms
$ cubic-noprint 10^7
H = 592922
Global Time: 155 ms
$ cubic-noprint -10^7
H = 1905514
Global Time: 467 ms
The README file
CUBIC, vestion 1.4.

0) Prerequisite: make sure the PARI/GP library is installed on your system

1) Configuration: the default Makefile, assumes that your PARI/GP library
is not too old (more recent than 2.9.0), was compiled with gmp, and is
installed in the standard location. As would be produced by the standard
  ./Configure && make install
Have a look at the numbered configuration options at the top of 'Makefile';
modify if your installation is non-standard.

2) Compilation: simply type

  make

This will produce two binaries :
  cubic-noprint: only *count* the fields
  cubic        : also *output* the fields (about ten times slower).

3) Usage: both binaries use the same syntax, with a single argument
describing a range of discriminants. Restriction: the discriminants
considered must all have the same signs.

  1000          : discriminants in [0, 1000]
  -1000         : discriminants in [-1000, 0]
  [1000, 2000]  : discriminants in [1000, 2000]
  [-2000, -1000]: discriminants in [-2000, -1000]
  [-2000, 2000] : FORBIDDEN (different signs!)
  [58343207081] : discriminants EXACTLY 58343207081

You may use any arithmetic expression in the GP language provided it is
enclosed within quotes:

  ./cubic-noprint "2*10^10"

Extra Flags:
  -g : be increasingly verbose [ default: 0 ]

4) References

Author: Karim Belabas, IMB (UMR 5251)
  Univ. Bordeaux, 351 cours de la Liberation, F-33405 Talence (France)
  http://www.math.u-bordeaux.fr/~kbelabas/

@article {MR1415795,
    AUTHOR = {Belabas, Karim},
     TITLE = {A fast algorithm to compute cubic fields},
   JOURNAL = {Math. Comp.},
  FJOURNAL = {Mathematics of Computation},
    VOLUME = {66},
      YEAR = {1997},
    NUMBER = {219},
     PAGES = {1213--1237},
      ISSN = {0025-5718},
     CODEN = {MCMPAF},
   MRCLASS = {11Y40 (11R16)},
  MRNUMBER = {MR1415795 (97m:11159)},
MRREVIEWER = {Joe P. Buhler},
}

@article {MR2059751,
    AUTHOR = {Belabas, Karim},
     TITLE = {On quadratic fields with large 3-rank},
   JOURNAL = {Math. Comp.},
  FJOURNAL = {Mathematics of Computation},
    VOLUME = {73},
      YEAR = {2004},
    NUMBER = {248},
     PAGES = {2061--2074 (electronic)},
      ISSN = {0025-5718},
     CODEN = {MCMPAF},
   MRCLASS = {11R11 (11R16 11R29 11Y40)},
  MRNUMBER = {MR2059751 (2005c:11132)},
MRREVIEWER = {Michel Olivier},
}

5) License:

This software (the 'cubic' package) is released under the GNU General Public
License (version 2 or above at your convenience). It is free software,
covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY
WHATSOEVER.

PARI/GP is free software, covered by the GNU General Public License.

6) Version history:
CUBIC, v1.4, 10/04/2025: update for recent gcc/ld (duplicate symbols)
CUBIC, v1.3, 25/07/2016: update for pari-2.9
CUBIC, v1.2, 22/07/2011: remove most 'printf'
CUBIC, v1.1, 22/06/2011: fix Makefile, improve README.
CUBIC, v1.0, 15/07/2009: initial public release (stable version).

Karim Belabas
Valid HTML 4.01
2025-04-10 13:02:15