13.14 Quadratic

Quadratic( z )

If z is a cyclotomic integer that is contained in a quadratic number field over the rationals, it can be written as <z> = frac{ a + b sqrt{n} }{d} with integers a, b, n and d, where d is either 1 or 2. In this case Quadratic( z ) returns a record with fields a, b, root, d and ATLAS where the first four mean the integers mentioned above, and the last one is a string that is a (not necessarily shortest) representation of z by b_m, i_m or r_m for m = '|root|' (see ATLAS irrationalities).

If z is not a quadratic irrationality or not a cyclotomic integer, false is returned.

    gap> Quadratic( EB(5) ); Quadratic( EB(27) );
    rec(
      a := -1,
      b := 1,
      root := 5,
      d := 2,
      ATLAS := "b5" )
    rec(
      a := -1,
      b := 3,
      root := -3,
      d := 2,
      ATLAS := "1+3b3" )
    gap> Quadratic(0); Quadratic( E(5) );
    rec( 
      a := 0,
      b := 0,
      root := 1,
      d := 1,
      ATLAS := "0" )
    false

Previous Up Top Next
Index

GAP 3.4.4
April 1997