Top
Back: number
Forward: number expressions
FastBack: module
FastForward: package
Up: number
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.14.1 number declarations

Syntax:
number name = number_expression ;

Purpose:
defines a number.

Default:
0

Note:
Numbers may only be declared w.r.t. the coefficient field of the current basering, i.e., a ring has to be defined prior to any number declaration. See Rings and orderings for a list of the available coefficient fields.

Example:
 
  // finite field Z/p, p<= 32003
  ring r = 32003,(x,y,z),dp;
  number n = 4/6;
  n;
==> -10667
  // finite field GF(p^n), p^n <= 32767
  // z is a primitive root of the minimal polynomial
  ring rg= (7^2,z),x,dp;
  number n = 4/9+z;
  n;
==> z38
  // the rational numbers
  ring r0 = 0,x,dp;
  number n = 4/6;
  n;
==> 2/3
  // algebraic extensions of Z/p or Q
  ring ra=(0,a),x,dp;
  minpoly=a^2+1;
  number n=a3+a2+2a-1;
  n;
==> (a-2)
  a^2;
==> -1
  // transcedental extensions of Z/p or Q
  ring rt=(0,a),x,dp;
  number n=a3+a2+2a-1;
  n;
==> (a3+a2+2a-1)
  a^2;
==> (a2)
  // machine floating point numbers, single precision
  ring R_0=real,x,dp;
  number n=4/6;
  n;
==> (6.667e-01)
  n=0.25e+2;
  n;
==> (2.500e+01)
  // floating point numbers, arbitrary prescribed precision
  ring R_1=(real,50),x,dp;
  number n=4.0/6;
  n;
==> 0.66666666666666666666666666666666666666666666666667
  n=0.25e+2;
  n;
==> 25
  // floating point complex numbers, arbitrary prescribed precision
  // the third parameter gives the name of the imaginary unit
  ring R_2=(complex,50,i),x,dp;
  number n=4.0/6;
  n;
==> 0.66666666666666666666666666666666666666666666666667
  n=0.25e+2*i+n;
  n;
==> (0.66666666666666666666666666666666666666666666666667+i*25)


Top Back: number Forward: number expressions FastBack: module FastForward: package Up: number Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.2, 2023, generated by texi2html.