[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Types of numbers

0

rational number
Rational numbers are implemented by arbitrary precision integers (bignum). A rational number is always expressed by a fraction of lowest terms.

1

double precision floating point number (double float)
The numbers of this type are numbers provided by the computer hardware. By default, when Asir is started, floating point numbers in a ordinary form are transformed into numbers of this type. However, they will be transformed into bigfloat numbers when the switch bigfloat is turned on (enabled) by ctrl() command.

[0] 1.2;
1.2
[1] 1.2e-1000; 
0
[2] ctrl("bigfloat",1);
1
[3] 1.2e-1000;         
1.20000000000000000513 E-1000

A rational number shall be converted automatically into a double float number before the operation with another double float number and the result shall be computed as a double float number.

2

algebraic number
See section Algebraic numbers.

3

bigfloat
The bigfloat numbers of Asir is realized by MPFR library. A bigfloat number of MPFR has an arbitrary precision mantissa part. However, its exponent part admits only a 64bit integer. Floating point operations will be performed all in bigfloat after activating the bigfloat switch by ctrl() command. The default precision is 53 bits (about 15 digits), which can be specified by setbprec() and setprec() command.

[0] ctrl("bigfloat",1);
1
[1] eval(2^(1/2));
1.4142135623731
[2] setprec(100);      
15
[3] eval(2^(1/2));
1.41421356237309504880168872420969807856967187537694...764157
[4] setbprec(100);
332
[5] 1.41421356237309504880168872421

Function eval() evaluates numerically its argument as far as possible. Notice that the integer given for the argument of setbprec() guarantees the accuracy of the result according to the current rounding mode. The argument of setbprec() is converted to the corresponding bit length and set. (See section eval, deval.)

4

complex number
A complex number of Risa/Asir is a number with the form a+b*@i, where @i is the unit of imaginary number, and a and b are either a rational number, double float number or bigfloat number, respectively. The real part and the imaginary part of a complex number can be taken out by real() and imag() respectively.

5

element of a small finite prime field
Here a small finite field means that its characteristic is less than 2^27. At present small finite fields are used mainly for groebner basis computation, and elements in such finite fields can be extracted by taking coefficients of distributed polynomials whose coefficients are in finite fields. Such an element itself does not have any information about the field to which the element belongs, and field operations are executed by using a prime p which is set by setmod().

6

element of large finite prime field
This type expresses an element of a finite prime field whose characteristic is an arbitrary prime. An object of this type is obtained by applying simp_ff to an integer.

7

element of a finite field of characteristic 2
This type expresses an element of a finite field of characteristic 2. Let F be a finite field of characteristic 2. If [F:GF(2)] is equal to n, then F is expressed as F=GF(2)[t]/(f(t)), where f(t) is an irreducible polynomial over GF(2) of degree n. As an element g of GF(2)[t] can be expressed by a bit string, An element g mod f in F can be expressed by two bit strings representing g and f respectively.

Several methods to input an element of F are provided.

8

element of a finite field of characteristic p^n

A finite field of order p^n, where p is an arbitrary prime and n is a positive integer, is set by setmod_ff by specifying its characteristic p and an irreducible polynomial of degree n over GF(p). An element of this field is represented by a polynomial over GF(p) modulo m(x).

9

element of a finite field of characteristic p^n (small order)

A finite field of order p^n, where p^n must be less than 2^29 and n must be equal to 1 if p is greater or equal to 2^14, is set by setmod_ff by specifying its characteristic p the extension degree n. If p is less than 2^14, each non-zero element of this field is a power of a fixed element, which is a generator of the multiplicative group of the field, and it is represented by its exponent. Otherwise, each element is represented by the redue modulo p. This specification is useful for treating both cases in a single program.

10

element of a finite field which is an algebraic extension of a small finite field of characteristic p^n

An extension field K of the small finite field F of order p^n is set by setmod_ff by specifying its characteristic p the extension degree n and m=[K:F]. An irreducible polynomial of degree m over K is automatically generated and used as the defining polynomial of the generator of the extension K/F. The generator is denoted by @s.

11

algebraic number represented by a distributed polynomial
See section Algebraic numbers.

Finite fields other than small finite prime fields are set by setmod_ff. Elements of finite fields do not have information about the modulus. Upon an arithmetic operation, if one of the operands is a rational number, it is automatically converted into an element of the finite field currently set and the operation is done in the finite field.


[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on December 21, 2024 using texi2html 5.0.