File: ratfun.xml

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (737 lines) | stat: -rw-r--r-- 27,601 bytes parent folder | download | duplicates (2)
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
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  ratfun.xml                  GAP documentation            Alexander Hulpke -->
<!-- %A                                                           Frank Celler -->
<!-- %% -->
<!-- %% -->
<!-- %Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="Polynomials and Rational Functions">
<Heading>Polynomials and Rational Functions</Heading>

Let <M>R</M> be a commutative ring-with-one. We call a free associative
algebra <M>A</M> over <M>R</M> a <E>polynomial ring</E> over <M>R</M>. The free generators of
<M>A</M> are called <E>indeterminates</E>
(to avoid naming conflicts with the word <E>variables</E> which will be used
to denote &GAP; variables only)
, they are usually denoted by
<M>x_1, x_2, \ldots</M>.
The number of indeterminates is called the <E>rank</E> of <M>A</M>.
The elements of <M>A</M> are called <E>polynomials</E>. Products of
indeterminates are called <E>monomials</E>, every
polynomial can be expressed as a finite sum of products of monomials with
ring elements in a form like
<M>r_{{1,0}} x_1 + r_{{1,1}} x_1 x_2 + r_{{0,1}} x_2 + \cdots</M>
with <M>r_{{i,j}} \in R</M>.
<P/>
A polynomial ring of rank 1 is called an <E>univariate</E> polynomial ring, its
elements are <E>univariate polynomials</E>.
<P/>
Polynomial rings of smaller rank naturally embed in rings of higher rank; if
<M>S</M> is a subring of <M>R</M> then a polynomial ring over <M>S</M> naturally embeds in
a polynomial ring over <M>R</M> of the same rank. Note however that &GAP; does
not consider <M>R</M> as a subset of a polynomial ring over <M>R</M>; for example the
zero of <M>R</M> (<M>0</M>) and the zero of the polynomial ring (<M>0x^0</M>) are different
objects.
<P/>
Internally, indeterminates are represented by positive integers, but it is
possible to give names to them to have them printed in a nicer way. Beware,
however that there is not necessarily any relation between the way an
indeterminate is called and the way it is printed. See section
<Ref Sect="Indeterminates"/> for details.
<P/>
If <M>R</M> is an integral domain, the polynomial ring <M>A</M> over <M>R</M> is an integral domain as well and one can
therefore form its quotient field <M>Q</M>. This field is called a <E>field of
rational functions</E>. Again <M>A</M> embeds naturally into <M>Q</M> and &GAP; will
perform this embedding implicitly. (In fact it implements the ring of rational
functions over <M>R</M>.) To avoid problems with leading
coefficients, however, <M>R</M> must be a unique factorization domain.


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Indeterminates">
<Heading>Indeterminates</Heading>

<#Include Label="[1]{ringpoly}">
<P/>
<#Include Label="[2]{ringpoly}">
<#Include Label="Indeterminate">
<#Include Label="IndeterminateNumberOfUnivariateRationalFunction">
<#Include Label="IndeterminateOfUnivariateRationalFunction">
<#Include Label="IndeterminateName">
<#Include Label="CIUnivPols">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Operations for Rational Functions">
<Heading>Operations for Rational Functions</Heading>

The rational functions form a field,
therefore all arithmetic operations are applicable to rational functions.
<P/>
<Index Subkey="rational functions">addition</Index>
<Index Subkey="rational functions">subtraction</Index>
<Index Subkey="rational functions">product</Index>
<Index Subkey="rational functions">quotient</Index>
<C><A>f</A> + <A>g</A></C>
<P/>
<C><A>f</A> - <A>g</A></C>
<P/>
<C><A>f</A> * <A>g</A></C>
<P/>
<C><A>f</A> / <A>g</A></C>
<P/>
<Example><![CDATA[
gap> x:=Indeterminate(Rationals,1);;y:=Indeterminate(Rationals,2);;
gap> f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;
gap> a:=g/f;
(x_1^2*x_2+x_1*x_2^2+5)/(x_1^5+x_1*x_2+3)
]]></Example>
<P/>
Note that the quotient <C><A>f</A>/<A>g</A></C> of two polynomials might be represented as
a rational function again. If <A>g</A> is known to divide <A>f</A> the call
<C>Quotient(<A>f</A>,<A>g</A>)</C> (see&nbsp;<Ref Oper="Quotient"/>) should be used instead.
<P/>
<Index Subkey="Laurent polynomials">mod</Index>
<C><A>f</A> mod <A>g</A></C>
<!-- %\><C><A>f</A> mod <A>int</A></C>{mod!integer polynomial} -->
<P/>
For two Laurent polynomials <A>f</A> and <A>g</A>, <C><A>f</A> mod <A>g</A></C> is the Euclidean
remainder (see&nbsp;<Ref Oper="EuclideanRemainder"/>) of <A>f</A> modulo <A>g</A>.
<!-- % For a polynomial <A>f</A> over the integers and an integer <A>int</A>, <C><A>f</A> mod <A>int</A></C> -->
<!-- % is the polynomial over the integers obtained by reducing the coefficients -->
<!-- % of <A>f</A> modulo <A>int</A>. -->
<!-- % Just a remark: -->
<!-- % These two methods would not be compatible if integers would be regarded -->
<!-- % as constant polynomials. -->
<!-- % Therefore, I leave the second method undocumented. -->
<P/>
As calculating a multivariate Gcd can be expensive,
it is not guaranteed that rational functions will always be
represented as a quotient of coprime polynomials. In certain unfortunate
situations this might lead to a degree explosion.
To ensure cancellation you can use
<Ref Func="Gcd" Label="for (a ring and) several elements"/> on the
<Ref Attr="NumeratorOfRationalFunction"/> and
<Ref Attr="DenominatorOfRationalFunction"/> values
of a given rational function.
<P/>
All polynomials as well as all the univariate polynomials in the same
indeterminate form subrings of this field. If two rational functions are
known to be in the same subring, the result will be expressed as element in
this subring.

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Comparison of Rational Functions">
<Heading>Comparison of Rational Functions</Heading>

<Index Subkey="rational functions">comparison</Index>
<C><A>f</A> = <A>g</A></C>
<P/>
Two rational functions <A>f</A> and <A>g</A> are equal if the product
<C>Numerator(<A>f</A>) * Denominator(<A>g</A>)</C> equals
<C>Numerator(<A>g</A>) * Denominator(<A>f</A>)</C>.
<P/>
<Example><![CDATA[
gap> x:=Indeterminate(Rationals,"x");;y:=Indeterminate(Rationals,"y");;
gap> f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;
gap> a:=g/f;
(x^2*y+x*y^2+5)/(x^5+x*y+3)
gap> b:=(g*f)/(f^2);
(x^7*y+x^6*y^2+5*x^5+x^3*y^2+x^2*y^3+3*x^2*y+3*x*y^2+5*x*y+15)/(x^10+2\
*x^6*y+6*x^5+x^2*y^2+6*x*y+9)
gap> a=b;
true
]]></Example>
<P/>
<Index Subkey="rational functions">smaller</Index>
<C><A>f</A> &lt; <A>g</A></C>
<P/>
The ordering of rational functions is defined in several steps. Monomials
(products of indeterminates) are sorted first by degree, then
lexicographically (with <M>x_1>x_2</M>)
(see&nbsp;<Ref Func="MonomialGrlexOrdering"/>). Products of monomials
with ring elements (<Q>terms</Q>) are compared first by their monomials and
then by their coefficients.
<P/>
<Example><![CDATA[
gap> x>y;
true
gap> x^2*y<x*y^2;
false
gap> x*y<x^2*y;
true
gap> x^2*y < 5* y*x^2;
true
]]></Example>
Polynomials are compared by comparing the largest terms in turn until they
differ.
<Example><![CDATA[
gap> x+y<y;
false
gap> x<x+1;
true
]]></Example>
Rational functions are compared by comparing the polynomial
<C>Numerator(<A>f</A>) * Denominator(<A>g</A>)</C> with the polynomial
<C>Numerator(<A>g</A>) * Denominator(<A>f</A>)</C>. (As the ordering of monomials used by
&GAP; is invariant under multiplication this is independent of common
factors in numerator and denominator.)
<Example><![CDATA[
gap> f/g<g/f;
false
gap> f/g<(g*g)/(f*g);
false
]]></Example>
<P/>
For univariate polynomials this reduces to an ordering first by total degree
and then lexicographically on the coefficients.

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Properties and Attributes of Rational Functions">
<Heading>Properties and Attributes of Rational Functions</Heading>

All these tests are applicable to <E>every</E> rational function.
Depending on the internal representation of the rational function,
however some of these tests (in particular, univariateness)
might be expensive in some cases.
<P/>
For reasons of performance within algorithms it can be useful to use other
attributes, which give a slightly more technical representation.
See section&nbsp;<Ref Sect="The Representations of Rational Functions"/>
for details.

<#Include Label="IsPolynomialFunction">
<#Include Label="NumeratorOfRationalFunction">
<#Include Label="DenominatorOfRationalFunction">
<#Include Label="IsPolynomial">
<#Include Label="AsPolynomial">
<#Include Label="IsUnivariateRationalFunction">
<#Include Label="CoefficientsOfUnivariateRationalFunction">
<#Include Label="IsUnivariatePolynomial">
<#Include Label="CoefficientsOfUnivariatePolynomial">
<#Include Label="IsLaurentPolynomial">
<#Include Label="IsConstantRationalFunction">
<#Include Label="IsPrimitivePolynomial">
<#Include Label="SplittingField">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Univariate Polynomials">
<Heading>Univariate Polynomials</Heading>

Some of the operations are actually defined on the larger domain of Laurent
polynomials (see <Ref Sect="Laurent Polynomials"/>). For this section you can simply
ignore the word <Q>Laurent</Q> if it occurs in a description.
<P/>

<#Include Label="UnivariatePolynomial">
<#Include Label="UnivariatePolynomialByCoefficients">
<#Include Label="DegreeOfLaurentPolynomial">
<#Include Label="RootsOfPolynomial">
<#Include Label="RootsOfUPol">
<#Include Label="QuotRemLaurpols">
<#Include Label="UnivariatenessTestRationalFunction">
<#Include Label="InfoPoly">

We remark that some functions for multivariate polynomials (which will be
defined in the following sections) permit a different syntax for univariate
polynomials which drops the requirement to specify the indeterminate.
Examples are
<Ref Oper="Value" Label="for rat. function, a list of indeterminates, a value (and a one)"/>,
<Ref Oper="Discriminant"/>, <Ref Attr="Derivative"/>,
<Ref Oper="LeadingCoefficient"/> and <Ref Oper="LeadingMonomial"/>:
<Example><![CDATA[
gap> p:=UnivariatePolynomial(Rationals,[1,2,3,4],1);
4*x^3+3*x^2+2*x+1
gap> Value(p,Z(5));
Z(5)^2
gap> LeadingCoefficient(p);
4
gap> Derivative(p);
12*x^2+6*x+2
]]></Example>

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Polynomials as Univariate Polynomials in one Indeterminate">
<Heading>Polynomials as Univariate Polynomials in one Indeterminate</Heading>

<#Include Label="DegreeIndeterminate">
<#Include Label="PolynomialCoefficientsOfPolynomial">
<#Include Label="LeadingCoefficient">
<#Include Label="LeadingMonomial">
<#Include Label="Derivative">
<#Include Label="Discriminant">
<#Include Label="Resultant">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Multivariate Polynomials">
<Heading>Multivariate Polynomials</Heading>

<#Include Label="Value">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Minimal Polynomials">
<Heading>Minimal Polynomials</Heading>

<Index Key="MinimalPolynomial" Subkey="over a ring"><C>MinimalPolynomial</C></Index>
<#Include Label="MinimalPolynomial">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Cyclotomic Polynomials">
<Heading>Cyclotomic Polynomials</Heading>

<#Include Label="CyclotomicPolynomial">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Polynomial Factorization">
<Heading>Polynomial Factorization</Heading>

At the moment &GAP; provides only methods to factorize
polynomials over finite fields (see Chapter&nbsp;<Ref Chap="Finite Fields"/>),
over subfields of cyclotomic fields (see Chapter&nbsp;<Ref Chap="Abelian Number Fields"/>),
and over algebraic extensions of these
(see Chapter&nbsp;<Ref Chap="Algebraic extensions of fields"/>).
<P/>

<ManSection>
<Meth Name="Factors" Arg='[R, ]poly[, opt]' Label="of polynomial"/>

<Description>
returns a list of the irreducible factors of the polynomial
<A>poly</A> in the polynomial ring <A>R</A>. (That is factors over the
<Ref Attr="CoefficientsRing"/> value of <A>R</A>.)
<P/>
For univariate factorizations, it is possible to pass a record <A>opt</A>
as a third argument. This record can contain the following components:
<List>
<Mark><C>onlydegs</C></Mark>
<Item>
is a set of positive integers. The factorization assumes
that all irreducible factors have a degree in this set.
</Item>
<Mark><C>stopdegs</C></Mark>
<Item>
is a set of positive integers. The factorization will stop once a
factor of degree in <C>stopdegs</C> has been found and will return the
factorization found so far.
</Item>
</List>
<P/>
<Example><![CDATA[
gap> f:= CyclotomicPolynomial( GF(2), 7 );
x_1^6+x_1^5+x_1^4+x_1^3+x_1^2+x_1+Z(2)^0
gap> Factors( f );
[ x_1^3+x_1+Z(2)^0, x_1^3+x_1^2+Z(2)^0 ]
gap> Factors( PolynomialRing( GF(8) ), f );
[ x_1+Z(2^3), x_1+Z(2^3)^2, x_1+Z(2^3)^3, x_1+Z(2^3)^4, x_1+Z(2^3)^5,
  x_1+Z(2^3)^6 ]
gap> f:= MinimalPolynomial( Rationals, E(4) );
x^2+1
gap> Factors( f );
[ x^2+1 ]
gap> Factors( PolynomialRing( Rationals ), f );
[ x^2+1 ]
gap> Factors( PolynomialRing( CF(4) ), f );
[ x+(-E(4)), x+E(4) ]
]]></Example>
</Description>
</ManSection>


<#Include Label="FactorsSquarefree">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Polynomials over the Rationals">
<Heading>Polynomials over the Rationals</Heading>

The following functions are only available to polynomials with rational
coefficients:

<#Include Label="PrimitivePolynomial">
<#Include Label="PolynomialModP">
<#Include Label="GaloisType">
<#Include Label="ProbabilityShapes">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Factorization of Polynomials over the Rationals">
<Heading>Factorization of Polynomials over the Rationals</Heading>

The following operations are used by &GAP; inside the factorization algorithm
but might be of interest also in other contexts.
<#Include Label="BombieriNorm">
<#Include Label="MinimizedBombieriNorm">
<#Include Label="HenselBound">
<#Include Label="OneFactorBound">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Laurent Polynomials">
<Heading>Laurent Polynomials</Heading>

A univariate polynomial can be written in the form
<M>r_0 + r_1 x + \cdots + r_n x^n</M>, with <M>r_i \in R</M>.
Formally, there is no reason to start with 0, if <M>m</M> is an
integer, we can consider objects of the form
<M>r_m x^m + r_{{m+1}} x^{{m+1}} + \cdots + r_n x^n</M>.
We call these <E>Laurent polynomials</E>.
Laurent polynomials also can be considered as quotients of a univariate
polynomial by a power of the indeterminate.  The addition and multiplication
of univariate polynomials extends to Laurent polynomials (though it might be
impossible to interpret a Laurent polynomial as a function) and many
functions for univariate polynomials extend to Laurent polynomials (or
extended versions for Laurent polynomials exist).

<#Include Label="LaurentPolynomialByCoefficients">
<#Include Label="CoefficientsOfLaurentPolynomial">
<#Include Label="IndeterminateNumberOfLaurentPolynomial">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Univariate Rational Functions">
<Heading>Univariate Rational Functions</Heading>

<#Include Label="UnivariateRationalFunctionByCoefficients">

<#Include Label="TaylorSeriesRationalFunction">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Polynomial Rings and Function Fields">
<Heading>Polynomial Rings and Function Fields</Heading>

While polynomials depend only on the family of the coefficients, polynomial
rings <M>A</M> are defined over a base ring <M>R</M>.
A polynomial is an element of <M>A</M> if and only if all its coefficients
are contained in <M>R</M>.
Besides providing domains and an easy way to create polynomials,
polynomial rings can affect the behavior of operations like
factorization into irreducibles.
<P/>
If you need to work with a polynomial ring and its indeterminates the
following two approaches will produce a ring that contains given variables
(see section&nbsp;<Ref Sect="Indeterminates"/> for details about the internal numbering):
Either, first create the ring and then get the indeterminates with
<Ref Attr="IndeterminatesOfPolynomialRing"/>.
<P/>
<Example><![CDATA[
gap> r := PolynomialRing(Rationals,["a","b"]);;
gap> indets := IndeterminatesOfPolynomialRing(r);;
gap> a := indets[1]; a := indets[2];
a
b
]]></Example>
<P/>
Alternatively, first create the
indeterminates and then create the ring including these indeterminates.
<P/>
<Example><![CDATA[
gap> a:=Indeterminate(Rationals,"a":old);;
gap> b:=Indeterminate(Rationals,"b":old);;
gap> PolynomialRing(Rationals,[a,b]);;
]]></Example>
<P/>
As a convenient shortcut, intended mainly for interactive working, the
<M>i</M>-th indeterminate of a polynomial ring <M>R</M> can be accessed as
<M>R.i</M>,
which corresponds exactly to
<C>IndeterminatesOfPolynomialRing</C><M>( R )[i]</M>
or, if it has the name <C>nam</C>, as <M>R</M><C>.nam</C>.
<E>Note</E> that the number <M>i</M> is in general
<E>not</E> the indeterminate number,
but simply an index into the indeterminates list of <M>R</M>.
<P/>
<Example><![CDATA[
gap> r := PolynomialRing(Rationals, ["a", "b"]:old );;
gap> r.1; r.2; r.a; r.b;
a
b
a
b
gap> IndeterminateNumberOfLaurentPolynomial(r.1);
3
]]></Example>
<P/>
Polynomials as &GAP; objects can exist without a polynomial ring being
defined and polynomials cannot be associated to a particular polynomial
ring. (For example dividing a polynomial which is in a polynomial ring over
the integers by another integer will result in a polynomial over the
rationals, not in a rational function over the integers.)
<P/>
<#Include Label="PolynomialRing">
<#Include Label="IndeterminatesOfPolynomialRing">
<#Include Label="CoefficientsRing">
<#Include Label="IsPolynomialRing">
<#Include Label="IsFiniteFieldPolynomialRing">
<#Include Label="IsAbelianNumberFieldPolynomialRing">
<#Include Label="IsRationalsPolynomialRing">
<#Include Label="FunctionField">
<#Include Label="IsFunctionField">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Univariate Polynomial Rings">
<Heading>Univariate Polynomial Rings</Heading>

<#Include Label="UnivariatePolynomialRing">
<#Include Label="IsUnivariatePolynomialRing">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Monomial Orderings">
<Heading>Monomial Orderings</Heading>

It is often desirable to consider the monomials within a polynomial to be
arranged with respect to a certain ordering. Such an ordering is called a
<E>monomial ordering</E> if it is total, invariant under multiplication with
other monomials and admits no infinite descending chains. For details on
monomial orderings see <Cite Key="coxlittleoshea"/>.
<P/>
In &GAP;, monomial orderings are represented by objects that provide a way
to compare monomials (as polynomials as well as &ndash;for efficiency purposes
within algorithms&ndash; in the internal representation as lists).
<P/>
Normally the ordering chosen should be <E>admissible</E>, i.e. it
must be compatible with products:
If <M>a &lt; b</M> then <M>ca &lt; cb</M> for all monomials
<M>a, b</M> and <M>c</M>.
<P/>
Each monomial ordering provides the two functions
<Ref Attr="MonomialComparisonFunction"/> and
<Ref Attr="MonomialExtrepComparisonFun"/> to compare monomials.
These functions work as <Q>is less than</Q>,
i.e. they return <K>true</K> if and only if the left argument is smaller.
<P/>
<#Include Label="IsMonomialOrdering">
<#Include Label="LeadingMonomialOfPolynomial">
<#Include Label="LeadingTermOfPolynomial">
<#Include Label="LeadingCoefficientOfPolynomial">
<#Include Label="MonomialComparisonFunction">
<#Include Label="MonomialExtrepComparisonFun">
<#Include Label="MonomialLexOrdering">
<#Include Label="MonomialGrlexOrdering">
<#Include Label="MonomialGrevlexOrdering">
<#Include Label="EliminationOrdering">
<#Include Label="PolynomialReduction">
<#Include Label="PolynomialReducedRemainder">
<#Include Label="PolynomialDivisionAlgorithm">
<#Include Label="MonomialExtGrlexLess">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Groebner Bases">
<Heading>Groebner Bases</Heading>

A <E>Groebner Basis</E> of an ideal <M>I</M>i, in a polynomial ring <M>R</M>, with
respect to a monomial ordering, is a set of ideal generators <A>G</A> such that
the ideal generated by the leading monomials of all polynomials in <A>G</A> is
equal to the ideal generated by the leading monomials of all polynomials
in <A>I</A>.
<P/>
For more details on Groebner bases see <Cite Key="coxlittleoshea"/>.

<#Include Label="GroebnerBasis">
<#Include Label="ReducedGroebnerBasis">
<#Include Label="StoredGroebnerBasis">
<#Include Label="InfoGroebner">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Rational Function Families">
<Heading>Rational Function Families</Heading>

All rational functions defined over a ring lie in the same family, the
rational functions family over this ring.
<P/>
In &GAP; therefore the family of a polynomial depends only on the family of
the coefficients, all polynomials whose coefficients lie in the same family
are <Q>compatible</Q>.

<#Include Label="RationalFunctionsFamily">
<#Include Label="IsPolynomialFunctionsFamily">
<#Include Label="CoefficientsFamily">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="The Representations of Rational Functions">
<Heading>The Representations of Rational Functions</Heading>

&GAP; uses four representations of rational functions: Rational
functions given by numerator and denominator, polynomials, univariate
rational functions (given by coefficient lists for numerator and denominator
and valuation) and
Laurent polynomials (given by coefficient list and valuation).
<P/>
These representations do not necessarily reflect mathematical properties:
While an object in the Laurent polynomials representation must be a
Laurent polynomial it might turn out that a rational function given by
numerator and denominator is actually a Laurent polynomial and the property
tests in section&nbsp;<Ref Sect="Properties and Attributes of Rational Functions"/> will find
this out.
<P/>
Each representation is associated one or several <Q>defining attributes</Q>
that give an <Q>external</Q> representation
(see&nbsp;<Ref Sect="The Defining Attributes of Rational Functions"/>)
of the representation in the form of lists and are the defining information
that tells a rational function what it is.
<P/>
&GAP; also implements methods to compute these attributes for rational
functions in <E>other</E> representations, provided it would be possible to
express an <E>mathematically equal</E> rational function in the representation
associated with the attribute. (That is one can always get a
numerator/denominator representation of a polynomial while an arbitrary
function of course can compute a polynomial representation only if it is a
polynomial.)
<P/>
Therefore these attributes can be thought of as <Q>conceptual</Q>
representations that allow us &ndash;as far as possible&ndash;
to consider an object as a rational function, a polynomial or a Laurent
polynomial, regardless of the way it is represented in the computer.
<P/>
Functions thus usually do not need to care about the representation of
a rational function. Depending on its (known in the context or determined)
properties, they can access the attribute representing the rational function
in the desired way.
<P/>
Consequently, methods for rational functions are installed for properties
and not for representations.
<P/>
When <E>creating</E> new rational functions however they must be created in one
of the three representations. In most cases this will be the representation
for which the <Q>conceptual</Q> representation in which the calculation was done
is the defining attribute.
<P/>
Iterated operations (like forming the product over a list) therefore will
tend to stay in the most suitable representation and the calculation of
another conceptual representation (which may be comparatively expensive in
certain circumstances) is not necessary.

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="The Defining Attributes of Rational Functions">
<Heading>The Defining Attributes of Rational Functions</Heading>

In general, rational functions are given in terms of monomials.
They are represented by lists, using numbers
(see&nbsp;<Ref Sect="Indeterminates"/>) for the indeterminates.
<P/>
<#Include Label="[4]{ratfun}">
<#Include Label="[1]{ratfun}">
<P/>
The attributes that give a representation of a rational function as a Laurent polynomial are
<Ref Attr="CoefficientsOfLaurentPolynomial"/>
and <Ref Attr="IndeterminateNumberOfUnivariateRationalFunction"/>.
<P/>
<#Include Label="[2]{ratfun}">
<#Include Label="IsRationalFunctionDefaultRep">
<#Include Label="ExtRepNumeratorRatFun">
<#Include Label="ExtRepDenominatorRatFun">
<#Include Label="ZeroCoefficientRatFun">
<#Include Label="IsPolynomialDefaultRep">
<#Include Label="ExtRepPolynomialRatFun">
<#Include Label="IsLaurentPolynomialDefaultRep">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Creation of Rational Functions">
<Heading>Creation of Rational Functions</Heading>

<#Include Label="[3]{ratfun}">
<#Include Label="RationalFunctionByExtRep">
<#Include Label="PolynomialByExtRep">
<#Include Label="LaurentPolynomialByExtRep">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Arithmetic for External Representations of Polynomials">
<Heading>Arithmetic for External Representations of Polynomials</Heading>

The following operations are used internally to perform the arithmetic for
polynomials in their <Q>external</Q> representation
(see&nbsp;<Ref Sect="The Defining Attributes of Rational Functions"/>)
as lists.
<P/>
Functions to perform arithmetic with the coefficient lists of Laurent
polynomials are described in
Section&nbsp;<Ref Sect="Coefficient List Arithmetic"/>.

<#Include Label="ZippedSum">
<#Include Label="ZippedProduct">
<#Include Label="QuotientPolynomialsExtRep">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Cancellation Tests for Rational Functions">
<Heading>Cancellation Tests for Rational Functions</Heading>

The operation <Ref Func="Gcd" Label="for (a ring and) several elements"/>
can be used to test for common factors of two polynomials.
This however would be too expensive to be done in the arithmetic,
thus uses the following
operations internally to try to keep the denominators as small as
possible

<#Include Label="RationalFunctionByExtRepWithCancellation">
<#Include Label="TryGcdCancelExtRepPolynomials">
<#Include Label="HeuristicCancelPolynomialsExtRep">

</Section>
</Chapter>