1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615
|
% This file was created automatically from fieldfin.msk.
% DO NOT EDIT!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%A fieldfin.msk GAP documentation Thomas Breuer
%%
%A @(#)$Id: fieldfin.msk,v 1.24.2.3 2006/03/07 22:54:45 sal Exp $
%%
%Y (C) 1998 School Math and Comp. Sci., University of St. Andrews, Scotland
%Y Copyright (C) 2002 The GAP Group
%%
\Chapter{Finite Fields}
This chapter describes the special functionality which exists in {\GAP} for
finite fields and their elements.
Of course the general functionality for fields
(see Chapter~"Fields and Division Rings") also applies to finite fields.
In the following, the term *finite field element* is used to denote {\GAP}
objects in the category `IsFFE' (see~"IsFFE"), and *finite field* means a
field consisting of such elements.
Note that in principle we must distinguish these fields from (abstract)
finite fields.
For example, the image of the embedding of a finite field into a field of
rational functions in the same characteristic is of course a finite field
but its elements are not in `IsFFE', and in fact {\GAP} does currently not
support such fields.
Special representations exist for row vectors and matrices over small finite
fields (see sections~"Row Vectors over Finite Fields"
and~"Matrices over Finite Fields").
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Finite Field Elements}
\>IsFFE( <obj> ) C
\>IsFFECollection( <obj> ) C
\>IsFFECollColl( <obj> ) C
Objects in the category `IsFFE' are used to implement elements of finite
fields. In this manual, the term *finite field element* always means an
object in `IsFFE'.
All finite field elements of the same characteristic form a family in
{\GAP} (see~"Families").
Any collection of finite field elements (see~"IsCollection") lies in
`IsFFECollection', and a collection of such collections
(e.g., a matrix) lies in `IsFFECollColl'.
\> Z(p^d) F
\> Z(p,d) F
For creating elements of a finite field the function `Z' can be used.
The call `Z(p,d)' (alternatively `Z( <p>^<d> )') returns the designated
generator of the multiplicative group of the finite field with `<p>^<d>'
elements. <p> must be a prime.
GAP can represent elements of all finite fields `GF(p^d)' such that
either (1) p^d \<= 65536 (in which case an extremely efficient internal
representation is used); (2) d = 1, (in which case, for large p, the
field is represented the machinery of Residue Class Rings (see
section~"Residue Class Rings") or (3) if the Conway Polynomial of degree
`d' over GF(p) is known, or can be computed, (see "Conway Polynomial").
If you attempt to construct an element of `GF(p^d)' for which `d > 1' and
the relevant Conway Polynomial is not known, and not necessarily easy to
find (see "IsCheapConwayPolynomial"), then {\GAP{ will stop with an error
and enter the break loop. If you leave this break loop by entering
`return;' {\GAP} will attempt to compute the Conway Polynomial, which may
take a very long time.
The root returned by `Z' is a generator of the multiplicative group of
the finite field with $p^d$ elements, which is cyclic. The order of the
element is of course $p^d-1$. The $p^d-1$ different powers of the root
are exactly the nonzero elements of the finite field.
Thus all nonzero elements of the finite field with `<p>^<d>' elements
can be entered as `Z(<p>^<d>)^<i>'. Note that this is also the form
that {\GAP} uses to output those elements when they are stored in the
internal representation. In larger fields, it is more convenient to enter
and print elements as linear combinations of powers of the primitive
element. See section "Printing, Viewing and Displaying Finite Field Elements".
The additive neutral element is `0\*Z(<p>)'. It is different from the
integer `0' in subtle ways. First `IsInt( 0\*Z(<p>) )' (see "IsInt") is
`false' and `IsFFE( 0\*Z(<p>) )' (see "IsFFE") is `true', whereas it is
just the other way around for the integer `0'.
The multiplicative neutral element is `Z(<p>)^0'. It is different from
the integer `1' in subtle ways. First `IsInt( Z(<p>)^0 )' (see "IsInt")
is `false' and `IsFFE( Z(<p>)^0 )' (see "IsFFE") is `true', whereas it
is just the other way around for the integer `1'. Also `1+1' is `2',
whereas, e.g., `Z(2)^0 + Z(2)^0' is `0\*Z(2)'.
The various roots returned by `Z' for finite fields of the same
characteristic are compatible in the following sense. If the field
$GF(p^n)$ is a subfield of the field $GF(p^m)$, i.e., $n$ divides $m$,
then $Z(p^n) = Z(p^m)^{(p^m-1)/(p^n-1)}$. Note that this is the simplest
relation that may hold between a generator of $GF(p^n)$ and $GF(p^m)$,
since $Z(p^n)$ is an element of order $p^m-1$ and $Z(p^m)$ is an element
of order $p^n-1$. This is achieved by choosing $Z(p)$ as the smallest
primitive root modulo $p$ and $Z(p^n)$ as a root of the $n$-th *Conway
polynomial* (see~"ConwayPolynomial") of characteristic $p$.
Those polynomials were defined by J.~H.~Conway, and many of them were
computed by R.~A.~Parker.
\beginexample
gap> a:= Z( 32 );
Z(2^5)
gap> a+a;
0*Z(2)
gap> a*a;
Z(2^5)^2
gap> b := Z(3,12);
z
gap> b*b;
z2
gap> b+b;
2z
gap> Print(b^100,"\n");
Z(3)^0+Z(3,12)^5+Z(3,12)^6+2*Z(3,12)^8+Z(3,12)^10+Z(3,12)^11
\endexample
\begintt
gap> Z(11,40);
Error, Conway Polynomial 11^40 will need to computed and might be slow
return to continue called from
FFECONWAY.ZNC( p, d ) called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>
\endtt
Elements of finite fields can be compared using the operators `=' and
`\<'. The call `<a> = <b>' returns `true' if and only if the finite
field elements <a> and <b> are equal. Furthermore `<a> \< <b>' tests
whether <a> is smaller than <b>. The exact behaviour of this
comparison depends on which of two Categories the field elements
belong to:
\>IsLexOrderedFFE( <ffe> ) C
\>IsLogOrderedFFE( <ffe> ) C
Finite field elements are ordered in GAP (by `\<') first by characteristic
and then by their degree (ie the size of the smallest field containing
them). Amongst irreducible elements of a given field, the ordering
depends on which of these categories the elements of the field belong to
(all elements of a given field should belong to the same one)
Elements in 'IsLexOrderedFFE' are ordered lexicographically by their
coefficients with respect to the canonical basis of the field
Elements in 'IsLogOrderedFFE' are ordered according to their discrete
logarithms with respect to the 'PrimitiveElement' of the field.
For the comparison of finite field elements with other {\GAP} objects,
see~"Comparisons".
\beginexample
gap> Z( 16 )^10 = Z( 4 )^2; # this illustrates the embedding of GF(4) in GF(16)
true
gap> 0 < 0*Z(101);
true
gap> Z(256) > Z(101);
false
gap> Z(2,20) < Z(2,20)^2; # this illustrates the lexicographic ordering
false
\endexample
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Operations for Finite Field Elements}
Since finite field elements are scalars, the operations `Characteristic',
`One', `Zero', `Inverse', `AdditiveInverse', `Order' can be applied to
then (see~"Attributes and Properties of Elements").
Contrary to the situation with other scalars, `Order' is defined also for
the zero element in a finite field, with value `0'.
% mainly for {\GAP}~3 compatibility ...
\beginexample
gap> Characteristic( Z( 16 )^10 ); Characteristic( Z( 9 )^2 );
2
3
gap> Characteristic( [ Z(4), Z(8) ] );
2
gap> One( Z(9) ); One( 0*Z(4) );
Z(3)^0
Z(2)^0
gap> Inverse( Z(9) ); AdditiveInverse( Z(9) );
Z(3^2)^7
Z(3^2)^5
gap> Order( Z(9)^7 );
8
\endexample
\>DegreeFFE( <z> ) O
\>DegreeFFE( <vec> ) O
\>DegreeFFE( <mat> ) O
`DegreeFFE' returns the degree of the smallest finite field
<F> containing the element <z>, respectively all elements of the vector
<vec> over a finite field (see~"Row Vectors"), or matrix <mat> over a
finite field (see~"Matrices").
\beginexample
gap> DegreeFFE( Z( 16 )^10 );
2
gap> DegreeFFE( Z( 16 )^11 );
4
gap> DegreeFFE( [ Z(2^13), Z(2^10) ] );
130
\endexample
\>LogFFE( <z>, <r> ) O
`LogFFE' returns the discrete logarithm of the element <z> in a finite
field with respect to the root <r>.
An error is signalled if <z> is zero. `fail' is returned
if <z> is not a power of <r>.
The *discrete logarithm* of an element $z$ with respect to a root $r$ is
the smallest nonnegative integer $i$ such that $r^i = z$.
\beginexample
gap> LogFFE( Z(409)^116, Z(409) ); LogFFE( Z(409)^116, Z(409)^2 );
116
58
\endexample
\>IntFFE( <z> ) O
`IntFFE' returns the integer corresponding to the element <z>, which must
lie in a finite prime field. That is `IntFFE' returns the smallest
nonnegative integer <i> such that `<i> \*\ One( <z> ) = <z>'.
The correspondence between elements from a finite prime field of
characteristic <p> (for $p\< 2^{16}$) and the integers between $0$ and $p-1$ is defined by
choosing `Z(<p>)' the element corresponding to the smallest primitive
root mod <p> (see~"PrimitiveRootMod").
`IntFFE' is installed as a method for the operation `Int' (see~"Int")
with argument a finite field element.
\beginexample
gap> IntFFE( Z(13) ); PrimitiveRootMod( 13 );
2
2
gap> IntFFE( Z(409) );
21
gap> IntFFE( Z(409)^116 ); 21^116 mod 409;
311
311
\endexample
\>IntFFESymm( <z> ) O
\>IntFFESymm( <vec> ) O
For a finite prime field element <z>, `IntFFESymm' returns the corresponding
integer of smallest absolute value. That is `IntFFESymm' returns the integer
<i> of smallest absolute value that `<i> \*\ One( <z> ) = <z>'.
For a vector <vec>, the operation returns the result if applying
`IntFFESymm' to every entry of the vector.
The correspondence between elements from a finite prime field of
characteristic <p> (for $p\< 2^{16}$) and the integers between $-p/2$ and $p/2$ is defined by
choosing `Z(<p>)' the element corresponding to the smallest positive
primitive
root mod <p> (see~"PrimitiveRootMod") and reducing results to the
$-p/2..p/2$ range.
\beginexample
gap> IntFFE(Z(13)^2);IntFFE(Z(13)^3);
4
8
gap> IntFFESymm(Z(13)^2);IntFFESymm(Z(13)^3);
4
-5
\endexample
\>IntVecFFE( <vecffe> ) O
is the list of integers corresponding to the vector <vecffe> of finite
field elements in a prime field (see~"IntFFE").
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Creating Finite Fields}
\indextt{DefaultField!for finite field elements}
\indextt{DefaultRing!for finite field elements}
`DefaultField' (see~"DefaultField") and `DefaultRing' (see~"DefaultRing")
for finite field elements are defined to return the *smallest* field
containing the given elements.
\beginexample
gap> DefaultField( [ Z(4), Z(4)^2 ] ); DefaultField( [ Z(4), Z(8) ] );
GF(2^2)
GF(2^6)
\endexample
\>GaloisField( <p>^<d> ) F
\>GF( <p>^<d> ) F
\>GaloisField( <p>, <d> ) F
\>GF( <p>, <d> ) F
\>GaloisField( <subfield>, <d> ) F
\>GF( <subfield>, <d> ) F
\>GaloisField( <p>, <pol> ) F
\>GF( <p>, <pol> ) F
\>GaloisField( <subfield>, <pol> ) F
\>GF( <subfield>, <pol> ) F
`GaloisField' returns a finite field. It takes two arguments.
The form `GaloisField( <p>, <d> )', where <p>, <d> are integers,
can also be given as `GaloisField( <p>^<d> )'.
`GF' is an abbreviation for `GaloisField'.
The first argument specifies the subfield <S> over which the new field
<F> is to be taken.
It can be a prime or a finite field.
If it is a prime <p>, the subfield is the prime field of this
characteristic.
The second argument specifies the extension.
It can be an integer or an irreducible polynomial over the field <S>.
If it is an integer <d>, the new field is constructed as the
polynomial extension with the Conway polynomial (see~"ConwayPolynomial")
of degree <d> over the subfield <S>.
If it is an irreducible polynomial <pol> over <S>,
the new field is constructed as polynomial extension of the subfield <S>
with this polynomial;
in this case, <pol> is accessible as the value of `DefiningPolynomial'
(see~"DefiningPolynomial") for the new field,
and a root of <pol> in the new field is accessible as the value of
`RootOfDefiningPolynomial' (see~"RootOfDefiningPolynomial").
Note that the subfield over which a field was constructed determines over
which field the Galois group, conjugates, norm, trace, minimal
polynomial, and trace polynomial are computed (see~"GaloisGroup!of field",
"Conjugates", "Norm", "Trace!for field elements", "MinimalPolynomial!over
a field", "TracePolynomial").
The field is regarded as a vector space (see~"Vector Spaces") over the
given subfield, so this determines the dimension and the canonical basis
of the field.
\beginexample
gap> f1:= GF( 2^4 );
GF(2^4)
gap> Size( GaloisGroup ( f1 ) );
4
gap> BasisVectors( Basis( f1 ) );
[ Z(2)^0, Z(2^4), Z(2^4)^2, Z(2^4)^3 ]
gap> f2:= GF( GF(4), 2 );
AsField( GF(2^2), GF(2^4) )
gap> Size( GaloisGroup( f2 ) );
2
gap> BasisVectors( Basis( f2 ) );
[ Z(2)^0, Z(2^4) ]
\endexample
\>PrimitiveRoot( <F> ) A
A *primitive root* of a finite field is a generator of its multiplicative
group.
A primitive root is always a primitive element (see~"PrimitiveElement"),
the converse is in general not true.
% For example, `Z(9)^2' is a primitive element for `GF(9)' but not a
% primitive root.
\beginexample
gap> f:= GF( 3^5 );
GF(3^5)
gap> PrimitiveRoot( f );
Z(3^5)
\endexample
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{FrobeniusAutomorphism}\nolabel
\atindex{homomorphisms!Frobenius, field}{@homomorphisms!Frobenius, field}
\atindex{field homomorphisms!Frobenius}{@field homomorphisms!Frobenius}
\indextt{Image!for Frobenius automorphisms}
\indextt{CompositionMapping!for Frobenius automorphisms}
\>FrobeniusAutomorphism( <F> ) A
returns the Frobenius automorphism of the finite
field <F> as a field homomorphism (see~"Ring Homomorphisms").
\atindex{Frobenius automorphism}{@Frobenius automorphism}
The *Frobenius automorphism* $f$ of a finite field $F$ of characteristic
$p$ is the function that takes each element $z$ of $F$ to its $p$-th
power.
Each automorphism of $F$ is a power of $f$.
Thus $f$ is a generator for the Galois group of $F$ relative to the prime
field of $F$,
and an appropriate power of $f$ is a generator of the Galois group of $F$
over a subfield (see~"GaloisGroup!of field").
\beginexample
gap> f := GF(16);
GF(2^4)
gap> x := FrobeniusAutomorphism( f );
FrobeniusAutomorphism( GF(2^4) )
gap> Z(16) ^ x;
Z(2^4)^2
gap> x^2;
FrobeniusAutomorphism( GF(2^4) )^2
\endexample
The image of an element $z$ under the $i$-th power of $f$ is computed
as the $p^i$-th power of $z$.
The product of the $i$-th power and the $j$-th power of $f$ is the $k$-th
power of $f$, where $k$ is $i j \pmod{`Size(<F>)'-1}$.
The zeroth power of $f$ is `IdentityMapping( <F> )'.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Conway Polynomials}
\>ConwayPolynomial( <p>, <n> ) F
is the Conway polynomial of the finite field $GF(p^n)$ as
polynomial over the prime field in characteristic <p>.
The *Conway polynomial* $\Phi_{n,p}$ of $GF(p^n)$ is defined by the
following properties.
First define an ordering of polynomials of degree $n$ over $GF(p)$ as
follows. $f = \sum_{i=0}^n (-1)^i f_i x^i$ is smaller than
$g = \sum_{i=0}^n (-1)^i g_i x^i$ if and only if there is an index
$m \leq n$ such that $f_i = g_i$ for all $i > m$, and
$\tilde{f_m} \< \tilde{g_m}$, where $\tilde{c}$ denotes the integer
value in $\{ 0, 1, \ldots, p-1 \}$ that is mapped to $c\in GF(p)$ under
the canonical epimorphism that maps the integers onto $GF(p)$.
$\Phi_{n,p}$ is *primitive* over $GF(p)$ (see~"IsPrimitivePolynomial").
That is, $\Phi_{n,p}$ is irreducible, monic,
and is the minimal polynomial of a primitive root of $GF(p^n)$.
For all divisors $d$ of $n$ the compatibility condition
$\Phi_{d,p}( x^{\frac{p^n-1}{p^m-1}} ) \equiv 0 \pmod{\Phi_{n,p}(x)}$
holds. (That is, the appropriate power of a zero of $\Phi_{n,p}$ is a
zero of the Conway polynomial $\Phi_{d,p}$.)
With respect to the ordering defined above, $\Phi_{n,p}$ shall be
minimal.
The computation of Conway polynomials can be time consuming. Therefore,
{\GAP} comes with a list of precomputed polynomials. If a requested
polynomial is not stored then {\GAP} prints a warning and computes it by
checking all polynomials in the order defined above for the defining
conditions. If $n$ is not a prime this is probably a very long computation.
(Some previously known polynomials with prime $n$ are not stored in
{\GAP} because they are quickly recomputed.) Use the function
"IsCheapConwayPolynomial" to check in advance if `ConwayPolynomial' will
give a result after a short time.
Note that primitivity of a polynomial can only be checked if {\GAP} can
factorize $p^n-1$. A sufficiently new version of the \package{FactInt}
package contains many precomputed factors of such numbers from various
factorization projects.
See~\cite{L03} for further information on known Conway polynomials.
If <pol> is a result returned by `ConwayPolynomial' the command
`Print( InfoText( <pol> ) );' will print some info on the origin of that
particular polynomial.
For some purposes it may be enough to have any primitive polynomial for
an extension of a finite field instead of the Conway polynomial,
see~"ref:RandomPrimitivePolynomial" below.
\beginexample
gap> ConwayPolynomial( 2, 5 ); ConwayPolynomial( 3, 7 );
x_1^5+x_1^2+Z(2)^0
x_1^7-x_1^2+Z(3)^0
\endexample
\>IsCheapConwayPolynomial( <p>, <n> ) F
Returns `true' if `ConwayPolynomial( <p>, <n> )' will give a result in
*reasonable* time. This is either the case when this polynomial is
pre-computed, or if <n> is a not too big prime.
\>RandomPrimitivePolynomial( <F>, <n>[, <i> ] ) F
For a finite field <F> and a positive integer <n> this function
returns a primitive polynomial of degree <n> over <F>, that is a zero of
this polynomial has maximal multiplicative order $|<F>|^n-1$.
If <i> is given then the polynomial is written in variable number <i>
over <F> (see~"ref:Indeterminate"), the default for <i> is 1.
Alternatively, <F> can be a prime power q, then <F> = GF(q) is assumed.
And <i> can be a univariate polynomial over <F>, then the result is a
polynomial in the same variable.
This function can work for much larger fields than those for which
Conway polynomials are available, of course {\GAP} must be able to
factorize $|<F>|^n-1$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Printing, Viewing and Displaying Finite Field Elements}
Internal finite field elements are Viewed, Printed and Displayed (see
section "View and Print" for the distinctions between these
operations) as powers of the primitive root (except for the zero
element, which is displayed as 0 times the primitive root). Thus:
\beginexample
gap> Z(2);
Z(2)^0
gap> Z(5)+Z(5);
Z(5)^2
gap> Z(256);
Z(2^8)
gap> Zero(Z(125));
0*Z(5)
\endexample
Note also that each element is displayed as an element of the field it
generates. Note also that the size of the field is printed as a power
of the characteristic.
Elements of larger fields are printed as {\GAP} expressions with
represent them as a sum of low powers of the primitive root:
\beginexample
gap> Print(Z(3,20)^100,"\n");
2*Z(3,20)^2+Z(3,20)^4+Z(3,20)^6+Z(3,20)^7+2*Z(3,20)^9+2*Z(3,20)^10+2*Z(3,20)^1\
2+2*Z(3,20)^15+2*Z(3,20)^17+Z(3,20)^18+Z(3,20)^19
gap> Print(Z(3,20)^((3^20-1)/(3^10-1)),"\n");
Z(3,20)^3+2*Z(3,20)^4+2*Z(3,20)^7+Z(3,20)^8+2*Z(3,20)^10+Z(3,20)^11+2*Z(3,20)^\
12+Z(3,20)^13+Z(3,20)^14+Z(3,20)^15+Z(3,20)^17+Z(3,20)^18+2*Z(3,20)^19
gap> Z(3,20)^((3^20-1)/(3^10-1)) = Z(3,10);
true
\endexample
Note from the second example above, that these elements are not always
written over the smallest possible field before being output.
The View and Display methods for these large finite field elements use
a slightly more compact, but mathematically equivalent
representation. The primitive root is represented by `z'; its <i>th power by
`z<i>' and <k> times this power by `<k>z<i>'.
\beginexample
gap> Z(5,20)^100;
z2+z4+4z5+2z6+z8+3z9+4z10+3z12+z13+2z14+4z16+3z17+2z18+2z19
\endexample
This output format is always used for `Display'. For `View' it is used
only if its length would not exceed `ViewLength' lines. Longer output is replaced by
`\<\<an element of GF(<p>, <d>)>>'.
\beginexample
gap> Z(2,409)^100000;
<<an element of GF(2, 409)>>
gap> Display(Z(2,409)^100000);
z2+z3+z4+z5+z6+z7+z8+z10+z11+z13+z17+z19+z20+z29+z32+z34+z35+z37+z40+z45+z46+z\
48+z50+z52+z54+z55+z58+z59+z60+z66+z67+z68+z70+z74+z79+z80+z81+z82+z83+z86+z91\
+z93+z94+z95+z96+z98+z99+z100+z101+z102+z104+z106+z109+z110+z112+z114+z115+z11\
8+z119+z123+z126+z127+z135+z138+z140+z142+z143+z146+z147+z154+z159+z161+z162+z\
168+z170+z171+z173+z174+z181+z182+z183+z186+z188+z189+z192+z193+z194+z195+z196\
+z199+z202+z204+z205+z207+z208+z209+z211+z212+z213+z214+z215+z216+z218+z219+z2\
20+z222+z223+z229+z232+z235+z236+z237+z238+z240+z243+z244+z248+z250+z251+z256+\
z258+z262+z263+z268+z270+z271+z272+z274+z276+z282+z286+z288+z289+z294+z295+z29\
9+z300+z301+z302+z303+z304+z305+z306+z307+z308+z309+z310+z312+z314+z315+z316+z\
320+z321+z322+z324+z325+z326+z327+z330+z332+z335+z337+z338+z341+z344+z348+z350\
+z352+z353+z356+z357+z358+z360+z362+z364+z366+z368+z372+z373+z374+z375+z378+z3\
79+z380+z381+z383+z384+z386+z387+z390+z395+z401+z402+z406+z408
\endexample
Finally note that elements of large prime fields are stored and
displayed as residue class objects. So
\beginexample
gap> Z(65537);
ZmodpZObj( 3, 65537 )
\endexample
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%E
|