This file is indexed.

/usr/share/gap/doc/ref/chap66.html is in gap-doc 4r7p9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (ref) - Chapter 66: Polynomials and Rational Functions</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap66"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap65.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap67.html">[Next Chapter]</a>&nbsp;  </div>

<p id="mathjaxlink" class="pcenter"><a href="chap66_mj.html">[MathJax on]</a></p>
<p><a id="X7A14A6588268810A" name="X7A14A6588268810A"></a></p>
<div class="ChapSects"><a href="chap66.html#X7A14A6588268810A">66 <span class="Heading">Polynomials and Rational Functions</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7A8FADCD875826DA">66.1 <span class="Heading">Indeterminates</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X79D0380D7FA39F7D">66.1-1 <span class="Heading">Indeterminate</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X816C8D797C804380">66.1-2 IndeterminateNumberOfUnivariateRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A2FA46885EF403D">66.1-3 IndeterminateOfUnivariateRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7FD4AC807A1C8E27">66.1-4 IndeterminateName</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X791A06E67F784328">66.1-5 CIUnivPols</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X86A68FD582F4F757">66.2 <span class="Heading">Operations for Rational Functions</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X824B6D328643CE04">66.3 <span class="Heading">Comparison of Rational Functions</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7D871EA180E9486C">66.4 <span class="Heading">Properties and Attributes of Rational Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X86C92F677DA9347F">66.4-1 IsPolynomialFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7D7D2667803D8D8A">66.4-2 NumeratorOfRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X78DC1B5B866ADB6C">66.4-3 DenominatorOfRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7974B0707C8DAB6C">66.4-4 IsPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7914771F7C6013EF">66.4-5 AsPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8738F73583273FCA">66.4-6 IsUnivariateRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7F1F67527A35A9CE">66.4-7 CoefficientsOfUnivariateRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X86A2546685D0016B">66.4-8 IsUnivariatePolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X78C9524D7F2708C2">66.4-9 CoefficientsOfUnivariatePolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X79138FF28213B6EC">66.4-10 IsLaurentPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7F2A49208341C2A8">66.4-11 IsConstantRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X834B54947FAADEA4">66.4-12 IsPrimitivePolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X87531E03849391C1">66.4-13 SplittingField</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X82E2F1707FC2E553">66.5 <span class="Heading">Univariate Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8379F8CB7D0076BA">66.5-1 UnivariatePolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X85178A3E7B4F11E0">66.5-2 UnivariatePolynomialByCoefficients</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X78AF77C383245254">66.5-3 DegreeOfLaurentPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7CBB760C87B04F75">66.5-4 RootsOfPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X80CEB10D7879767F">66.5-5 RootsOfUPol</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7887FBC78149BB0C">66.5-6 QuotRemLaurpols</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7DDADF157879EFBF">66.5-7 UnivariatenessTestRationalFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A3BC96B7A50DE98">66.5-8 InfoPoly</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X81499B5A823E6EA3">66.6 <span class="Heading">Polynomials as Univariate Polynomials in one Indeterminate</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X826B99B17ABD11BE">66.6-1 DegreeIndeterminate</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X85646FD07F9C60F5">66.6-2 PolynomialCoefficientsOfPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X80710E9B7D8340BD">66.6-3 LeadingCoefficient</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7B3EAE41795598A5">66.6-4 LeadingMonomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7B57CEE2780D0E0B">66.6-5 Derivative</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7C7D790A7D6E11AD">66.6-6 Discriminant</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X857AD5587EF49029">66.6-7 Resultant</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X85ABC4687DF05777">66.7 <span class="Heading">Multivariate Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A70769C7F52CD2D">66.7-1 <span class="Heading">Value</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7ED3E7D17C7AC732">66.8 <span class="Heading">Minimal Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8643915A8424DAF8">66.8-1 MinimalPolynomial</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X837B8E55832CDFEB">66.9 <span class="Heading">Cyclotomic Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X827FC7FE81EE4C02">66.9-1 CyclotomicPolynomial</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X8551EF5187509D69">66.10 <span class="Heading">Polynomial Factorization</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X83511D517B544F36">66.10-1 Factors</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7F5A4ACB7AF9E329">66.10-2 FactorsSquarefree</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7F45E9E47EA2C18B">66.11 <span class="Heading">Polynomials over the Rationals</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7E66494B7B05A055">66.11-1 PrimitivePolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A73A3877EB73566">66.11-2 PolynomialModP</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7AB9A6257ED694EC">66.11-3 GaloisType</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7EB610D37D156DC6">66.11-4 ProbabilityShapes</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7C178AB9866FDDE5">66.12 <span class="Heading">Factorization of Polynomials over the Rationals</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8723075C81D2CCA6">66.12-1 BombieriNorm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X856D769D878AF7AE">66.12-2 MinimizedBombieriNorm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8139BB0F87399F2C">66.12-3 HenselBound</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X79CC9C8D7C9F6B6A">66.12-4 OneFactorBound</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X844B3C6C87A0E7E0">66.13 <span class="Heading">Laurent Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8467263B7EFA013E">66.13-1 LaurentPolynomialByCoefficients</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X86D58AB67F86469F">66.13-2 CoefficientsOfLaurentPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8381E1B582F38C85">66.13-3 IndeterminateNumberOfLaurentPolynomial</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7C1708D27F97B05F">66.14 <span class="Heading">Univariate Rational Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X83DD411179888783">66.14-1 UnivariateRationalFunctionByCoefficients</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7C59471783C3FEDC">66.15 <span class="Heading">Polynomial Rings and Function Fields</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7D2F16E480060330">66.15-1 <span class="Heading">PolynomialRing</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X80D585E1793D4552">66.15-2 IndeterminatesOfPolynomialRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8235D10781BE8003">66.15-3 CoefficientsRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7D631ACC86C584B7">66.15-4 IsPolynomialRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X86F391237A76D804">66.15-5 IsFiniteFieldPolynomialRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X782D07F77BCF67C1">66.15-6 IsAbelianNumberFieldPolynomialRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7D45213A8642033B">66.15-7 IsRationalsPolynomialRing</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X812E801484E3624E">66.15-8 <span class="Heading">FunctionField</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8090C9EC85201AAC">66.15-9 IsFunctionField</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X85CA757B844F12AE">66.16 <span class="Heading">Univariate Polynomial Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X84DC2A59797A26DE">66.16-1 <span class="Heading">UnivariatePolynomialRing</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A43D74B812401CA">66.16-2 IsUnivariatePolynomialRing</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X86E2ADEA784AD163">66.17 <span class="Heading">Monomial Orderings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X79D4CBBF820EA204">66.17-1 IsMonomialOrdering</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7D052A017A73E91E">66.17-2 LeadingMonomialOfPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7B6231137BA8B95F">66.17-3 LeadingTermOfPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X798E707D86141087">66.17-4 LeadingCoefficientOfPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7EDE941781BA7F8B">66.17-5 MonomialComparisonFunction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7EDC3A457E7B591E">66.17-6 MonomialExtrepComparisonFun</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X852D7BB37ECE98E1">66.17-7 MonomialLexOrdering</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X786C866C824D2688">66.17-8 MonomialGrlexOrdering</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8094C733808D1799">66.17-9 MonomialGrevlexOrdering</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X84AC871283A74EC0">66.17-10 EliminationOrdering</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7C99593584D478D7">66.17-11 PolynomialReduction</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7DE7D4467EBAD916">66.17-12 PolynomialReducedRemainder</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7C8239057FD4EC03">66.17-13 PolynomialDivisionAlgorithm</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A30E10B820311D1">66.17-14 MonomialExtGrlexLess</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X79BAB2937E6085D6">66.18 <span class="Heading">Groebner Bases</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7A43611E876B7560">66.18-1 <span class="Heading">GroebnerBasis</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7DEF286384967C9E">66.18-2 <span class="Heading">ReducedGroebnerBasis</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7FC1EFE78498C17C">66.18-3 StoredGroebnerBasis</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7C55702786D284A7">66.18-4 InfoGroebner</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X8113DD9B781CA6C1">66.19 <span class="Heading">Rational Function Families</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X855DD73C78A90BC3">66.19-1 RationalFunctionsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X86E097307D188D3B">66.19-2 IsPolynomialFunctionsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7AADCA45826866FB">66.19-3 CoefficientsFamily</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7E360788785DE530">66.20 <span class="Heading">The Representations of Rational Functions</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X7F44CF87801DB965">66.21 <span class="Heading">The Defining Attributes of Rational Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X791E16C67A352263">66.21-1 IsRationalFunctionDefaultRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7DF955C87CBFC12B">66.21-2 ExtRepNumeratorRatFun</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8059E74D7DCABDBC">66.21-3 ExtRepDenominatorRatFun</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X84F546F87B5ECFE0">66.21-4 ZeroCoefficientRatFun</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X833CE16579AB26E0">66.21-5 IsPolynomialDefaultRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X8406EE2E8775FBAB">66.21-6 ExtRepPolynomialRatFun</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7E1B98CC7BADAF56">66.21-7 IsLaurentPolynomialDefaultRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X791FADD278A2F32F">66.22 <span class="Heading">Creation of Rational Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X81297E4587A9F2A6">66.22-1 RationalFunctionByExtRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X79E445AF7849F48A">66.22-2 PolynomialByExtRep</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7E2A46D68472F492">66.22-3 LaurentPolynomialByExtRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X809028CD7C0EA7CE">66.23 <span class="Heading">Arithmetic for External Representations of Polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X855094857A78ABF9">66.23-1 ZippedSum</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7B911136782F0F6D">66.23-2 ZippedProduct</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X87E5EB8985AF04CD">66.23-3 QuotientPolynomialsExtRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap66.html#X811B7D8E79E4BD46">66.24 <span class="Heading">Cancellation Tests for Rational Functions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X878A1AC87B492E3D">66.24-1 RationalFunctionByExtRepWithCancellation</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X7BFB55887A153003">66.24-2 TryGcdCancelExtRepPolynomials</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap66.html#X81CC7D9B819A9332">66.24-3 HeuristicCancelPolynomials</a></span>
</div></div>
</div>

<h3>66 <span class="Heading">Polynomials and Rational Functions</span></h3>

<p>Let <span class="SimpleMath">R</span> be a commutative ring-with-one. We call a free associative algebra <span class="SimpleMath">A</span> over <span class="SimpleMath">R</span> a <em>polynomial ring</em> over <span class="SimpleMath">R</span>. The free generators of <span class="SimpleMath">A</span> are called <em>indeterminates</em> (to avoid naming conflicts with the word <em>variables</em> which will be used to denote <strong class="pkg">GAP</strong> variables only) , they are usually denoted by <span class="SimpleMath">x_1, x_2, ...</span>. The number of indeterminates is called the <em>rank</em> of <span class="SimpleMath">A</span>. The elements of <span class="SimpleMath">A</span> are called <em>polynomials</em>. Products of indeterminates are called <em>monomials</em>, every polynomial can be expressed as a finite sum of products of monomials with ring elements in a form like <span class="SimpleMath">r_{1,0} x_1 + r_{1,1} x_1 x_2 + r_{0,1} x_2 + ⋯</span> with <span class="SimpleMath">r_{i,j} ∈ R</span>.</p>

<p>A polynomial ring of rank 1 is called an <em>univariate</em> polynomial ring, its elements are <em>univariate polynomials</em>.</p>

<p>Polynomial rings of smaller rank naturally embed in rings of higher rank; if <span class="SimpleMath">S</span> is a subring of <span class="SimpleMath">R</span> then a polynomial ring over <span class="SimpleMath">S</span> naturally embeds in a polynomial ring over <span class="SimpleMath">R</span> of the same rank. Note however that <strong class="pkg">GAP</strong> does not consider <span class="SimpleMath">R</span> as a subset of a polynomial ring over <span class="SimpleMath">R</span>; for example the zero of <span class="SimpleMath">R</span> (<span class="SimpleMath">0</span>) and the zero of the polynomial ring (<span class="SimpleMath">0x^0</span>) are different objects.</p>

<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 <a href="chap66.html#X7A8FADCD875826DA"><span class="RefLink">66.1</span></a> for details.</p>

<p>If <span class="SimpleMath">R</span> is an integral domain, the polynomial ring <span class="SimpleMath">A</span> over <span class="SimpleMath">R</span> is an integral domain as well and one can therefore form its quotient field <span class="SimpleMath">Q</span>. This field is called a <em>field of rational functions</em>. Again <span class="SimpleMath">A</span> embeds naturally into <span class="SimpleMath">Q</span> and <strong class="pkg">GAP</strong> will perform this embedding implicitly. (In fact it implements the ring of rational functions over <span class="SimpleMath">R</span>.) To avoid problems with leading coefficients, however, <span class="SimpleMath">R</span> must be a unique factorization domain.</p>

<p><a id="X7A8FADCD875826DA" name="X7A8FADCD875826DA"></a></p>

<h4>66.1 <span class="Heading">Indeterminates</span></h4>

<p>Internally, indeterminates are created for a <em>family</em> of objects (for example all elements of finite fields in characteristic <span class="SimpleMath">3</span> are in one family). Thus a variable "x" over the rationals is also an "x" over the integers, while an "x" over <code class="code">GF(3)</code> is different.</p>

<p>Within one family, every indeterminate has a number <var class="Arg">nr</var> and as long as no other names have been assigned, this indeterminate will be displayed as "<code class="code">x_<var class="Arg">nr</var></code>". Indeterminate numbers can be arbitrary nonnegative integers.</p>

<p>It is possible to assign names to indeterminates; these names are strings and only provide a means for printing the indeterminates in a nice way. Indeterminates that have not been assigned a name will be printed as "<code class="code">x_<var class="Arg">nr</var></code>".</p>

<p>(Because of this printing convention, the name <code class="code">x_<var class="Arg">nr</var></code> is interpreted specially to always denote the variable with internal number <var class="Arg">nr</var>.)</p>

<p>The indeterminate names have not necessarily any relations to variable names: this means that an indeterminate whose name is, say, "<code class="code">x</code>" cannot be accessed using the variable <code class="code">x</code>, unless <code class="code">x</code> was defined to be that indeterminate.</p>

<p>When asking for indeterminates with certain names, <strong class="pkg">GAP</strong> usually will take the first (with respect to the internal numbering) indeterminates that are not yet named, name these accordingly and return them. Thus when asking for named indeterminates, no relation between names and indeterminate numbers can be guaranteed. The attribute <code class="code">IndeterminateNumberOfLaurentPolynomial(<var class="Arg">indet</var>)</code> will return the number of the indeterminate <var class="Arg">indet</var>.</p>

<p>When asked to create an indeterminate with a name that exists already for the family, <strong class="pkg">GAP</strong> will by default return this existing indeterminate. If you explicitly want a <em>new</em> indeterminate, distinct from the already existing one with the <em>same</em> name, you can add the <code class="code">new</code> option to the function call. (This is in most cases not a good idea.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">R:=PolynomialRing(GF(3),["x","y","z"]);</span>
GF(3)[x,y,z]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List(IndeterminatesOfPolynomialRing(R),</span>
<span class="GAPprompt">&gt;</span> <span class="GAPinput">  IndeterminateNumberOfLaurentPolynomial);</span>
[ 1, 2, 3 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">R:=PolynomialRing(GF(3),["z"]);</span>
GF(3)[z]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List(IndeterminatesOfPolynomialRing(R),</span>
<span class="GAPprompt">&gt;</span> <span class="GAPinput">  IndeterminateNumberOfLaurentPolynomial);</span>
[ 3 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">R:=PolynomialRing(GF(3),["x","y","z"]:new);</span>
GF(3)[x,y,z]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List(IndeterminatesOfPolynomialRing(R),</span>
<span class="GAPprompt">&gt;</span> <span class="GAPinput">  IndeterminateNumberOfLaurentPolynomial);</span>
[ 4, 5, 6 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">R:=PolynomialRing(GF(3),["z"]);</span>
GF(3)[z]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">List(IndeterminatesOfPolynomialRing(R),</span>
<span class="GAPprompt">&gt;</span> <span class="GAPinput">  IndeterminateNumberOfLaurentPolynomial);</span>
[ 3 ]
</pre></div>

<p><a id="X79D0380D7FA39F7D" name="X79D0380D7FA39F7D"></a></p>

<h5>66.1-1 <span class="Heading">Indeterminate</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Indeterminate</code>( <var class="Arg">R</var>[, <var class="Arg">nr</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Indeterminate</code>( <var class="Arg">R</var>[, <var class="Arg">name</var>][, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Indeterminate</code>( <var class="Arg">fam</var>, <var class="Arg">nr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; X</code>( <var class="Arg">R</var>[, <var class="Arg">nr</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; X</code>( <var class="Arg">R</var>[, <var class="Arg">name</var>][, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; X</code>( <var class="Arg">fam</var>, <var class="Arg">nr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the indeterminate number <var class="Arg">nr</var> over the ring <var class="Arg">R</var>. If <var class="Arg">nr</var> is not given it defaults to 1. If the number is not specified a list <var class="Arg">avoid</var> of indeterminates may be given. The function will return an indeterminate that is guaranteed to be different from all the indeterminates in the list <var class="Arg">avoid</var>. The third usage returns an indeterminate called <var class="Arg">name</var> (also avoiding the indeterminates in <var class="Arg">avoid</var> if given).</p>

<p><code class="func">X</code> is simply a synonym for <code class="func">Indeterminate</code>. However, we do not recommend to use this synonym which is supported only for the backwards compatibility.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=Indeterminate(GF(3),"x");</span>
x
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">y:=X(GF(3),"y");z:=X(GF(3),"X");</span>
y
X
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">X(GF(3),2);</span>
y
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">X(GF(3),"x_3");</span>
X
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">X(GF(3),[y,z]);</span>
x
</pre></div>

<p><a id="X816C8D797C804380" name="X816C8D797C804380"></a></p>

<h5>66.1-2 IndeterminateNumberOfUnivariateRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminateNumberOfUnivariateRationalFunction</code>( <var class="Arg">rfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the number of the indeterminate in which the univariate rational function <var class="Arg">rfun</var> is expressed. (This also provides a way to obtain the number of a given indeterminate.)</p>

<p>A constant rational function might not possess an indeterminate number. In this case <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> will default to a value of 1. Therefore two univariate polynomials may be considered to be in the same univariate polynomial ring if their indeterminates have the same number or one if of them is constant. (see also <code class="func">CIUnivPols</code> (<a href="chap66.html#X791A06E67F784328"><span class="RefLink">66.1-5</span></a>) and <code class="func">IsLaurentPolynomialDefaultRep</code> (<a href="chap66.html#X7E1B98CC7BADAF56"><span class="RefLink">66.21-7</span></a>)).</p>

<p><a id="X7A2FA46885EF403D" name="X7A2FA46885EF403D"></a></p>

<h5>66.1-3 IndeterminateOfUnivariateRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminateOfUnivariateRationalFunction</code>( <var class="Arg">rfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the indeterminate in which the univariate rational function <var class="Arg">rfun</var> is expressed. (cf. <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>).)</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateNumberOfUnivariateRationalFunction(z);</span>
3
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateOfUnivariateRationalFunction(z^5+z);</span>
X
</pre></div>

<p><a id="X7FD4AC807A1C8E27" name="X7FD4AC807A1C8E27"></a></p>

<h5>66.1-4 IndeterminateName</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminateName</code>( <var class="Arg">fam</var>, <var class="Arg">nr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; HasIndeterminateName</code>( <var class="Arg">fam</var>, <var class="Arg">nr</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetIndeterminateName</code>( <var class="Arg">fam</var>, <var class="Arg">nr</var>, <var class="Arg">name</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">SetIndeterminateName</code> assigns the name <var class="Arg">name</var> to indeterminate <var class="Arg">nr</var> in the rational functions family <var class="Arg">fam</var>. It issues an error if the indeterminate was already named.</p>

<p><code class="func">IndeterminateName</code> returns the name of the <var class="Arg">nr</var>-th indeterminate (and returns <code class="keyw">fail</code> if no name has been assigned).</p>

<p><code class="func">HasIndeterminateName</code> tests whether indeterminate <var class="Arg">nr</var> has already been assigned a name.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateName(FamilyObj(x),2);</span>
"y"
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasIndeterminateName(FamilyObj(x),4);</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetIndeterminateName(FamilyObj(x),10,"bla");</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Indeterminate(GF(3),10);</span>
bla
</pre></div>

<p>As a convenience there is a special method installed for <code class="code">SetName</code> that will assign a name to an indeterminate.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:=Indeterminate(GF(3),5);</span>
x_5
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetName(a,"ah");</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a^5+a;</span>
ah^5+ah
</pre></div>

<p><a id="X791A06E67F784328" name="X791A06E67F784328"></a></p>

<h5>66.1-5 CIUnivPols</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CIUnivPols</code>( <var class="Arg">upol1</var>, <var class="Arg">upol2</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function (whose name stands for "common indeterminate of univariate polynomials") takes two univariate polynomials as arguments. If both polynomials are given in the same indeterminate number <var class="Arg">indnum</var> (in this case they are "compatible" as univariate polynomials) it returns <var class="Arg">indnum</var>. In all other cases it returns <code class="keyw">fail</code>. <code class="func">CIUnivPols</code> also accepts if either polynomial is constant but formally expressed in another indeterminate, in this situation the indeterminate of the other polynomial is selected.</p>

<p><a id="X86A68FD582F4F757" name="X86A68FD582F4F757"></a></p>

<h4>66.2 <span class="Heading">Operations for Rational Functions</span></h4>

<p>The rational functions form a field, therefore all arithmetic operations are applicable to rational functions.</p>

<p><code class="code"><var class="Arg">f</var> + <var class="Arg">g</var></code></p>

<p><code class="code"><var class="Arg">f</var> - <var class="Arg">g</var></code></p>

<p><code class="code"><var class="Arg">f</var> * <var class="Arg">g</var></code></p>

<p><code class="code"><var class="Arg">f</var> / <var class="Arg">g</var></code></p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=Indeterminate(Rationals,1);;y:=Indeterminate(Rationals,2);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:=g/f;</span>
(x_1^2*x_2+x_1*x_2^2+5)/(x_1^5+x_1*x_2+3)
</pre></div>

<p>Note that the quotient <code class="code"><var class="Arg">f</var>/<var class="Arg">g</var></code> of two polynomials might be represented as a rational function again. If <var class="Arg">g</var> is known to divide <var class="Arg">f</var> the call <code class="code">Quotient(<var class="Arg">f</var>,<var class="Arg">g</var>)</code> (see <code class="func">Quotient</code> (<a href="chap56.html#X8350500B8576F833"><span class="RefLink">56.1-9</span></a>)) should be used instead.</p>

<p><code class="code"><var class="Arg">f</var> mod <var class="Arg">g</var></code></p>

<p>For two Laurent polynomials <var class="Arg">f</var> and <var class="Arg">g</var>, <code class="code"><var class="Arg">f</var> mod <var class="Arg">g</var></code> is the Euclidean remainder (see <code class="func">EuclideanRemainder</code> (<a href="chap56.html#X7B5E9639865E91BA"><span class="RefLink">56.6-4</span></a>)) of <var class="Arg">f</var> modulo <var class="Arg">g</var>.</p>

<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 <code class="func">Gcd</code> (<a href="chap56.html#X7DE207718456F98F"><span class="RefLink">56.7-1</span></a>) on the <code class="func">NumeratorOfRationalFunction</code> (<a href="chap66.html#X7D7D2667803D8D8A"><span class="RefLink">66.4-2</span></a>) and <code class="func">DenominatorOfRationalFunction</code> (<a href="chap66.html#X78DC1B5B866ADB6C"><span class="RefLink">66.4-3</span></a>) values of a given rational function.</p>

<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.</p>

<p><a id="X824B6D328643CE04" name="X824B6D328643CE04"></a></p>

<h4>66.3 <span class="Heading">Comparison of Rational Functions</span></h4>

<p><code class="code"><var class="Arg">f</var> = <var class="Arg">g</var></code></p>

<p>Two rational functions <var class="Arg">f</var> and <var class="Arg">g</var> are equal if the product <code class="code">Numerator(<var class="Arg">f</var>) * Denominator(<var class="Arg">g</var>)</code> equals <code class="code">Numerator(<var class="Arg">g</var>) * Denominator(<var class="Arg">f</var>)</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=Indeterminate(Rationals,"x");;y:=Indeterminate(Rationals,"y");;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=3+x*y+x^5;;g:=5+x^2*y+x*y^2;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:=g/f;</span>
(x^2*y+x*y^2+5)/(x^5+x*y+3)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">b:=(g*f)/(f^2);</span>
(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)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a=b;</span>
true
</pre></div>

<p><code class="code"><var class="Arg">f</var> &lt; <var class="Arg">g</var></code></p>

<p>The ordering of rational functions is defined in several steps. Monomials (products of indeterminates) are sorted first by degree, then lexicographically (with <span class="SimpleMath">x_1&gt;x_2</span>) (see <code class="func">MonomialGrlexOrdering</code> (<a href="chap66.html#X786C866C824D2688"><span class="RefLink">66.17-8</span></a>)). Products of monomials with ring elements ("terms") are compared first by their monomials and then by their coefficients.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x&gt;y;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x^2*y&lt;x*y^2;</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x*y&lt;x^2*y;</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x^2*y &lt; 5* y*x^2;</span>
true
</pre></div>

<p>Polynomials are compared by comparing the largest terms in turn until they differ.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x+y&lt;y;</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x&lt;x+1;</span>
true
</pre></div>

<p>Rational functions are compared by comparing the polynomial <code class="code">Numerator(<var class="Arg">f</var>) * Denominator(<var class="Arg">g</var>)</code> with the polynomial <code class="code">Numerator(<var class="Arg">g</var>) * Denominator(<var class="Arg">f</var>)</code>. (As the ordering of monomials used by <strong class="pkg">GAP</strong> is invariant under multiplication this is independent of common factors in numerator and denominator.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f/g&lt;g/f;</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f/g&lt;(g*g)/(f*g);</span>
false
</pre></div>

<p>For univariate polynomials this reduces to an ordering first by total degree and then lexicographically on the coefficients.</p>

<p><a id="X7D871EA180E9486C" name="X7D871EA180E9486C"></a></p>

<h4>66.4 <span class="Heading">Properties and Attributes of Rational Functions</span></h4>

<p>All these tests are applicable to <em>every</em> 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>

<p>For reasons of performance within algorithms it can be useful to use other attributes, which give a slightly more technical representation. See section <a href="chap66.html#X7E360788785DE530"><span class="RefLink">66.20</span></a> for details.</p>

<p><a id="X86C92F677DA9347F" name="X86C92F677DA9347F"></a></p>

<h5>66.4-1 IsPolynomialFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPolynomialFunction</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRationalFunction</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A rational function is an element of the quotient field of a polynomial ring over an UFD. It is represented as a quotient of two polynomials, its numerator (see <code class="func">NumeratorOfRationalFunction</code> (<a href="chap66.html#X7D7D2667803D8D8A"><span class="RefLink">66.4-2</span></a>)) and its denominator (see <code class="func">DenominatorOfRationalFunction</code> (<a href="chap66.html#X78DC1B5B866ADB6C"><span class="RefLink">66.4-3</span></a>))</p>

<p>A polynomial function is an element of a polynomial ring (not necessarily an UFD), or a rational function.</p>

<p><strong class="pkg">GAP</strong> considers <code class="func">IsRationalFunction</code> as a subcategory of <code class="func">IsPolynomialFunction</code>.</p>

<p><a id="X7D7D2667803D8D8A" name="X7D7D2667803D8D8A"></a></p>

<h5>66.4-2 NumeratorOfRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NumeratorOfRationalFunction</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the numerator of the rational function <var class="Arg">ratfun</var>.</p>

<p>As no proper multivariate gcd has been implemented yet, numerators and denominators are not guaranteed to be reduced!</p>

<p><a id="X78DC1B5B866ADB6C" name="X78DC1B5B866ADB6C"></a></p>

<h5>66.4-3 DenominatorOfRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DenominatorOfRationalFunction</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the denominator of the rational function <var class="Arg">ratfun</var>.</p>

<p>As no proper multivariate gcd has been implemented yet, numerators and denominators are not guaranteed to be reduced!</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=Indeterminate(Rationals,1);;y:=Indeterminate(Rationals,2);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DenominatorOfRationalFunction((x*y+x^2)/y);</span>
y
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NumeratorOfRationalFunction((x*y+x^2)/y);</span>
x^2+x*y
</pre></div>

<p><a id="X7974B0707C8DAB6C" name="X7974B0707C8DAB6C"></a></p>

<h5>66.4-4 IsPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPolynomial</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A polynomial is a rational function whose denominator is one. (If the coefficients family forms a field this is equivalent to the denominator being constant.)</p>

<p>If the base family is not a field, it may be impossible to represent the quotient of a polynomial by a ring element as a polynomial again, but it will have to be represented as a rational function.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsPolynomial((x*y+x^2*y^3)/y);</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsPolynomial((x*y+x^2)/y);</span>
false
</pre></div>

<p><a id="X7914771F7C6013EF" name="X7914771F7C6013EF"></a></p>

<h5>66.4-5 AsPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AsPolynomial</code>( <var class="Arg">poly</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If <var class="Arg">poly</var> is a rational function that is a polynomial this attribute returns an equal rational function <span class="SimpleMath">p</span> such that <span class="SimpleMath">p</span> is equal to its numerator and the denominator of <span class="SimpleMath">p</span> is one.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPolynomial((x*y+x^2*y^3)/y);</span>
x^2*y^2+x
</pre></div>

<p><a id="X8738F73583273FCA" name="X8738F73583273FCA"></a></p>

<h5>66.4-6 IsUnivariateRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsUnivariateRationalFunction</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A rational function is univariate if its numerator and its denominator are both polynomials in the same one indeterminate. The attribute <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>) can be used to obtain the number of this common indeterminate.</p>

<p><a id="X7F1F67527A35A9CE" name="X7F1F67527A35A9CE"></a></p>

<h5>66.4-7 CoefficientsOfUnivariateRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoefficientsOfUnivariateRationalFunction</code>( <var class="Arg">rfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>if <var class="Arg">rfun</var> is a univariate rational function, this attribute returns a list <code class="code">[ <var class="Arg">ncof</var>, <var class="Arg">dcof</var>, <var class="Arg">val</var> ]</code> where <var class="Arg">ncof</var> and <var class="Arg">dcof</var> are coefficient lists of univariate polynomials <var class="Arg">n</var> and <var class="Arg">d</var> and a valuation <var class="Arg">val</var> such that <span class="SimpleMath"><var class="Arg">rfun</var> = x^<var class="Arg">val</var><var class="Arg">n</var> / <var class="Arg">d</var></span> where <span class="SimpleMath">x</span> is the variable with the number given by <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>). Numerator and denominator are guaranteed to be cancelled.</p>

<p><a id="X86A2546685D0016B" name="X86A2546685D0016B"></a></p>

<h5>66.4-8 IsUnivariatePolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsUnivariatePolynomial</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A univariate polynomial is a polynomial in only one indeterminate.</p>

<p><a id="X78C9524D7F2708C2" name="X78C9524D7F2708C2"></a></p>

<h5>66.4-9 CoefficientsOfUnivariatePolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoefficientsOfUnivariatePolynomial</code>( <var class="Arg">pol</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="func">CoefficientsOfUnivariatePolynomial</code> returns the coefficient list of the polynomial <var class="Arg">pol</var>, sorted in ascending order. (It returns the empty list if <var class="Arg">pol</var> is 0.)</p>

<p><a id="X79138FF28213B6EC" name="X79138FF28213B6EC"></a></p>

<h5>66.4-10 IsLaurentPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsLaurentPolynomial</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A Laurent polynomial is a univariate rational function whose denominator is a monomial. Therefore every univariate polynomial is a Laurent polynomial.</p>

<p>The attribute <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>) gives a compact representation as Laurent polynomial.</p>

<p><a id="X7F2A49208341C2A8" name="X7F2A49208341C2A8"></a></p>

<h5>66.4-11 IsConstantRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsConstantRationalFunction</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A constant rational function is a function whose numerator and denominator are polynomials of degree 0.</p>

<p><a id="X834B54947FAADEA4" name="X834B54947FAADEA4"></a></p>

<h5>66.4-12 IsPrimitivePolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPrimitivePolynomial</code>( <var class="Arg">F</var>, <var class="Arg">pol</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a univariate polynomial <var class="Arg">pol</var> of degree <span class="SimpleMath">d</span> in the indeterminate <span class="SimpleMath">X</span>, with coefficients in a finite field <var class="Arg">F</var> with <span class="SimpleMath">q</span> elements, say, <code class="func">IsPrimitivePolynomial</code> returns <code class="keyw">true</code> if</p>

<ol>
<li><p><var class="Arg">pol</var> divides <span class="SimpleMath">X^{q^d-1} - 1</span>, and</p>

</li>
<li><p>for each prime divisor <span class="SimpleMath">p</span> of <span class="SimpleMath">q^d - 1</span>, <var class="Arg">pol</var> does not divide <span class="SimpleMath">X^{(q^d-1)/p} - 1</span>,</p>

</li>
</ol>
<p>and <code class="keyw">false</code> otherwise.</p>

<p><a id="X87531E03849391C1" name="X87531E03849391C1"></a></p>

<h5>66.4-13 SplittingField</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SplittingField</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the smallest field which contains the coefficients of <var class="Arg">f</var> and the roots of <var class="Arg">f</var>.</p>

<p><a id="X82E2F1707FC2E553" name="X82E2F1707FC2E553"></a></p>

<h4>66.5 <span class="Heading">Univariate Polynomials</span></h4>

<p>Some of the operations are actually defined on the larger domain of Laurent polynomials (see <a href="chap66.html#X844B3C6C87A0E7E0"><span class="RefLink">66.13</span></a>). For this section you can simply ignore the word "Laurent" if it occurs in a description.</p>

<p><a id="X8379F8CB7D0076BA" name="X8379F8CB7D0076BA"></a></p>

<h5>66.5-1 UnivariatePolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariatePolynomial</code>( <var class="Arg">ring</var>, <var class="Arg">cofs</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>constructs an univariate polynomial over the ring <var class="Arg">ring</var> in the indeterminate <var class="Arg">ind</var> with the coefficients given by <var class="Arg">coefs</var>.</p>

<p><a id="X85178A3E7B4F11E0" name="X85178A3E7B4F11E0"></a></p>

<h5>66.5-2 UnivariatePolynomialByCoefficients</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariatePolynomialByCoefficients</code>( <var class="Arg">fam</var>, <var class="Arg">cofs</var>, <var class="Arg">ind</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>constructs an univariate polynomial over the coefficients family <var class="Arg">fam</var> and in the indeterminate <var class="Arg">ind</var> with the coefficients given by <var class="Arg">coefs</var>. This function should be used in algorithms to create polynomials as it avoids overhead associated with <code class="func">UnivariatePolynomial</code> (<a href="chap66.html#X8379F8CB7D0076BA"><span class="RefLink">66.5-1</span></a>).</p>

<p><a id="X78AF77C383245254" name="X78AF77C383245254"></a></p>

<h5>66.5-3 DegreeOfLaurentPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DegreeOfLaurentPolynomial</code>( <var class="Arg">pol</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>The degree of a univariate (Laurent) polynomial <var class="Arg">pol</var> is the largest exponent <span class="SimpleMath">n</span> of a monomial <span class="SimpleMath">x^n</span> of <var class="Arg">pol</var>. The degree of a zero polynomial is defined to be <code class="code">-infinity</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">p:=UnivariatePolynomial(Rationals,[1,2,3,4],1);</span>
4*x^3+3*x^2+2*x+1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnivariatePolynomialByCoefficients(FamilyObj(1),[9,2,3,4],73);</span>
4*x_73^3+3*x_73^2+2*x_73+9
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CoefficientsOfUnivariatePolynomial(p);</span>
[ 1, 2, 3, 4 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DegreeOfLaurentPolynomial(p);</span>
3
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DegreeOfLaurentPolynomial(Zero(p));</span>
-infinity
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateNumberOfLaurentPolynomial(p);</span>
1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateOfLaurentPolynomial(p);</span>
x
</pre></div>

<p><a id="X7CBB760C87B04F75" name="X7CBB760C87B04F75"></a></p>

<h5>66.5-4 RootsOfPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RootsOfPolynomial</code>( [<var class="Arg">R</var>, ]<var class="Arg">p</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>For a univariate polynomial <var class="Arg">p</var>, this function returns all roots of <var class="Arg">p</var> over the ring <var class="Arg">R</var>. If the ring is not specified, it defaults to the ring specified by the coefficients of <var class="Arg">p</var> via <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=X(Rationals,"x");;p:=x^4-1;    </span>
x^4-1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RootsOfPolynomial(p);</span>
[ 1, -1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RootsOfPolynomial(CF(4),p);</span>
[ 1, -1, E(4), -E(4) ]
</pre></div>

<p><a id="X80CEB10D7879767F" name="X80CEB10D7879767F"></a></p>

<h5>66.5-5 RootsOfUPol</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RootsOfUPol</code>( [<var class="Arg">field</var>, ]<var class="Arg">upol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function returns a list of all roots of the univariate polynomial <var class="Arg">upol</var> in its default domain. If the optional argument <var class="Arg">field</var> is a field then the roots in this field are computed. If <var class="Arg">field</var> is the string <code class="code">"split"</code> then the splitting field of the polynomial is taken.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RootsOfUPol(50-45*x-6*x^2+x^3);</span>
[ 10, 1, -5 ]
</pre></div>

<p><a id="X7887FBC78149BB0C" name="X7887FBC78149BB0C"></a></p>

<h5>66.5-6 QuotRemLaurpols</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; QuotRemLaurpols</code>( <var class="Arg">left</var>, <var class="Arg">right</var>, <var class="Arg">mode</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This internal function for euclidean division of polynomials takes two polynomials <var class="Arg">left</var> and <var class="Arg">right</var> and computes their quotient. No test is performed whether the arguments indeed are polynomials. Depending on the integer variable <var class="Arg">mode</var>, which may take values in a range from 1 to 4, it returns respectively:</p>

<ol>
<li><p>the quotient (there might be some remainder),</p>

</li>
<li><p>the remainder,</p>

</li>
<li><p>a list <code class="code">[<var class="Arg">q</var>,<var class="Arg">r</var>]</code> of quotient and remainder,</p>

</li>
<li><p>the quotient if there is no remainder and <code class="keyw">fail</code> otherwise.</p>

</li>
</ol>
<p><a id="X7DDADF157879EFBF" name="X7DDADF157879EFBF"></a></p>

<h5>66.5-7 UnivariatenessTestRationalFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariatenessTestRationalFunction</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>takes a rational function <var class="Arg">f</var> and tests whether it is univariate rational function (or even a Laurent polynomial). It returns a list <code class="code">[isunivariate, indet, islaurent, cofs]</code>.</p>

<p>If <var class="Arg">f</var> is a univariate rational function then <code class="code">isunivariate</code> is <code class="keyw">true</code> and <code class="code">indet</code> is the number of the appropriate indeterminate.</p>

<p>Furthermore, if <var class="Arg">f</var> is a Laurent polynomial, then <code class="code">islaurent</code> is also <code class="keyw">true</code>. In this case the fourth entry, <code class="code">cofs</code>, is the value of the attribute <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>) for <var class="Arg">f</var>.</p>

<p>If <code class="code">isunivariate</code> is <code class="keyw">true</code> but <code class="code">islaurent</code> is <code class="keyw">false</code>, then <code class="code">cofs</code> is the value of the attribute <code class="func">CoefficientsOfUnivariateRationalFunction</code> (<a href="chap66.html#X7F1F67527A35A9CE"><span class="RefLink">66.4-7</span></a>) for <var class="Arg">f</var>.</p>

<p>Otherwise, each entry of the returned list is equal to <code class="keyw">fail</code>. As there is no proper multivariate gcd, this may also happen for the rational function which may be reduced to univariate (see example).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnivariatenessTestRationalFunction( 50-45*x-6*x^2+x^3 );</span>
[ true, 1, true, [ [ 50, -45, -6, 1 ], 0 ] ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnivariatenessTestRationalFunction( (-6*y^2+y^3) / (y+1) );</span>
[ true, 2, false, [ [ -6, 1 ], [ 1, 1 ], 2 ] ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnivariatenessTestRationalFunction( (-6*y^2+y^3) / (x+1));</span>
[ fail, fail, fail, fail ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnivariatenessTestRationalFunction( ((y+2)*(x+1)) / ((y-1)*(x+1)) );</span>
[ fail, fail, fail, fail ]
</pre></div>

<p><a id="X7A3BC96B7A50DE98" name="X7A3BC96B7A50DE98"></a></p>

<h5>66.5-8 InfoPoly</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoPoly</code></td><td class="tdright">( info class )</td></tr></table></div>
<p>is the info class for univariate polynomials.</p>

<p>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 <code class="func">Value</code> (<a href="chap66.html#X7A70769C7F52CD2D"><span class="RefLink">66.7-1</span></a>), <code class="func">Discriminant</code> (<a href="chap66.html#X7C7D790A7D6E11AD"><span class="RefLink">66.6-6</span></a>), <code class="func">Derivative</code> (<a href="chap66.html#X7B57CEE2780D0E0B"><span class="RefLink">66.6-5</span></a>), <code class="func">LeadingCoefficient</code> (<a href="chap66.html#X80710E9B7D8340BD"><span class="RefLink">66.6-3</span></a>) and <code class="func">LeadingMonomial</code> (<a href="chap66.html#X7B3EAE41795598A5"><span class="RefLink">66.6-4</span></a>):</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">p:=UnivariatePolynomial(Rationals,[1,2,3,4],1);</span>
4*x^3+3*x^2+2*x+1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Value(p,Z(5));</span>
Z(5)^2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingCoefficient(p);</span>
4
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Derivative(p);</span>
12*x^2+6*x+2
</pre></div>

<p><a id="X81499B5A823E6EA3" name="X81499B5A823E6EA3"></a></p>

<h4>66.6 <span class="Heading">Polynomials as Univariate Polynomials in one Indeterminate</span></h4>

<p><a id="X826B99B17ABD11BE" name="X826B99B17ABD11BE"></a></p>

<h5>66.6-1 DegreeIndeterminate</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DegreeIndeterminate</code>( <var class="Arg">pol</var>, <var class="Arg">ind</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the degree of the polynomial <var class="Arg">pol</var> in the indeterminate (or indeterminate number) <var class="Arg">ind</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=x^5+3*x*y+9*y^7+4*y^5*x+3*y+2;</span>
9*y^7+4*x*y^5+x^5+3*x*y+3*y+2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DegreeIndeterminate(f,1);</span>
5
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DegreeIndeterminate(f,y);</span>
7
</pre></div>

<p><a id="X85646FD07F9C60F5" name="X85646FD07F9C60F5"></a></p>

<h5>66.6-2 PolynomialCoefficientsOfPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialCoefficientsOfPolynomial</code>( <var class="Arg">pol</var>, <var class="Arg">ind</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">PolynomialCoefficientsOfPolynomial</code> returns the coefficient list (whose entries are polynomials not involving the indeterminate <var class="Arg">ind</var>) describing the polynomial <var class="Arg">pol</var> viewed as a polynomial in <var class="Arg">ind</var>. Instead of the indeterminate, <var class="Arg">ind</var> can also be an indeterminate number.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PolynomialCoefficientsOfPolynomial(f,2);</span>
[ x^5+2, 3*x+3, 0, 0, 0, 4*x, 0, 9 ]
</pre></div>

<p><a id="X80710E9B7D8340BD" name="X80710E9B7D8340BD"></a></p>

<h5>66.6-3 LeadingCoefficient</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeadingCoefficient</code>( <var class="Arg">pol</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the leading coefficient (that is the coefficient of the leading monomial, see <code class="func">LeadingMonomial</code> (<a href="chap66.html#X7B3EAE41795598A5"><span class="RefLink">66.6-4</span></a>)) of the polynomial <var class="Arg">pol</var>.</p>

<p><a id="X7B3EAE41795598A5" name="X7B3EAE41795598A5"></a></p>

<h5>66.6-4 LeadingMonomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeadingMonomial</code>( <var class="Arg">pol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the leading monomial (with respect to the ordering given by <code class="func">MonomialExtGrlexLess</code> (<a href="chap66.html#X7A30E10B820311D1"><span class="RefLink">66.17-14</span></a>)) of the polynomial <var class="Arg">pol</var> as a list containing indeterminate numbers and exponents.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingCoefficient(f,1);</span>
1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingCoefficient(f,2);</span>
9
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingMonomial(f);</span>
[ 2, 7 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingCoefficient(f);</span>
9
</pre></div>

<p><a id="X7B57CEE2780D0E0B" name="X7B57CEE2780D0E0B"></a></p>

<h5>66.6-5 Derivative</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Derivative</code>( <var class="Arg">ratfun</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If <var class="Arg">ratfun</var> is a univariate rational function then <code class="func">Derivative</code> returns the <em>derivative</em> of <var class="Arg">ufun</var> by its indeterminate. For a rational function <var class="Arg">ratfun</var>, the derivative by the indeterminate <var class="Arg">ind</var> is returned, regarding <var class="Arg">ratfun</var> as univariate in <var class="Arg">ind</var>. Instead of the desired indeterminate, also the number of this indeterminate can be given as <var class="Arg">ind</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Derivative(f,2);</span>
63*y^6+20*x*y^4+3*x+3
</pre></div>

<p><a id="X7C7D790A7D6E11AD" name="X7C7D790A7D6E11AD"></a></p>

<h5>66.6-6 Discriminant</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Discriminant</code>( <var class="Arg">pol</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>If <var class="Arg">pol</var> is a univariate polynomial then <code class="func">Discriminant</code> returns the <em>discriminant</em> of <var class="Arg">pol</var> by its indeterminate. The two-argument form returns the discriminant of a polynomial <var class="Arg">pol</var> by the indeterminate number <var class="Arg">ind</var>, regarding <var class="Arg">pol</var> as univariate in this indeterminate. Instead of the indeterminate number, the indeterminate itself can also be given as <var class="Arg">ind</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Discriminant(f,1);</span>
20503125*y^28+262144*y^25+27337500*y^22+19208040*y^21+1474560*y^17+136\
68750*y^16+18225000*y^15+6075000*y^14+1105920*y^13+3037500*y^10+648972\
0*y^9+4050000*y^8+900000*y^7+62208*y^5+253125*y^4+675000*y^3+675000*y^\
2+300000*y+50000
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Discriminant(f,1) = Discriminant(f,x);</span>
true
</pre></div>

<p><a id="X857AD5587EF49029" name="X857AD5587EF49029"></a></p>

<h5>66.6-7 Resultant</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Resultant</code>( <var class="Arg">pol1</var>, <var class="Arg">pol2</var>, <var class="Arg">ind</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>computes the resultant of the polynomials <var class="Arg">pol1</var> and <var class="Arg">pol2</var> with respect to the indeterminate <var class="Arg">ind</var>, or indeterminate number <var class="Arg">ind</var>. The resultant considers <var class="Arg">pol1</var> and <var class="Arg">pol2</var> as univariate in <var class="Arg">ind</var> and returns an element of the corresponding base ring (which might be a polynomial ring).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Resultant(x^4+y,y^4+x,1);</span>
y^16+y
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Resultant(x^4+y,y^4+x,2);</span>
x^16+x
</pre></div>

<p><a id="X85ABC4687DF05777" name="X85ABC4687DF05777"></a></p>

<h4>66.7 <span class="Heading">Multivariate Polynomials</span></h4>

<p><a id="X7A70769C7F52CD2D" name="X7A70769C7F52CD2D"></a></p>

<h5>66.7-1 <span class="Heading">Value</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Value</code>( <var class="Arg">ratfun</var>, <var class="Arg">indets</var>, <var class="Arg">vals</var>[, <var class="Arg">one</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Value</code>( <var class="Arg">upol</var>, <var class="Arg">value</var>[, <var class="Arg">one</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>The first variant takes a rational function <var class="Arg">ratfun</var> and specializes the indeterminates given in <var class="Arg">indets</var> to the values given in <var class="Arg">vals</var>, replacing the <span class="SimpleMath">i</span>-th entry in <var class="Arg">indets</var> by the <span class="SimpleMath">i</span>-th entry in <var class="Arg">vals</var>. If this specialization results in a constant polynomial, an element of the coefficient ring is returned. If the specialization would specialize the denominator of <var class="Arg">ratfun</var> to zero, an error is raised.</p>

<p>A variation is the evaluation at elements of another ring <span class="SimpleMath">R</span>, for which a multiplication with elements of the coefficient ring of <var class="Arg">ratfun</var> are defined. In this situation the identity element of <span class="SimpleMath">R</span> may be given by a further argument <var class="Arg">one</var> which will be used for <span class="SimpleMath">x^0</span> for any specialized indeterminate <span class="SimpleMath">x</span>.</p>

<p>The second version takes an univariate rational function and specializes the value of its indeterminate to <var class="Arg">val</var>. Again, an optional argument <var class="Arg">one</var> may be given.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Value(x*y+y+x^7,[x,y],[5,7]);</span>
78167
</pre></div>

<p>Note that the default values for <var class="Arg">one</var> can lead to different results than one would expect: For example for a matrix <span class="SimpleMath">M</span>, the values <span class="SimpleMath">M+M^0</span> and <span class="SimpleMath">M+1</span> are <em>different</em>. As <code class="func">Value</code> defaults to the one of the coefficient ring, when evaluating matrices in polynomials always the correct <var class="Arg">one</var> should be given!</p>

<p><a id="X7ED3E7D17C7AC732" name="X7ED3E7D17C7AC732"></a></p>

<h4>66.8 <span class="Heading">Minimal Polynomials</span></h4>

<p><a id="X8643915A8424DAF8" name="X8643915A8424DAF8"></a></p>

<h5>66.8-1 MinimalPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MinimalPolynomial</code>( <var class="Arg">R</var>, <var class="Arg">elm</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the <em>minimal polynomial</em> of <var class="Arg">elm</var> over the ring <var class="Arg">R</var>, expressed in the indeterminate number <var class="Arg">ind</var>. If <var class="Arg">ind</var> is not given, it defaults to 1.</p>

<p>The minimal polynomial is the monic polynomial of smallest degree with coefficients in <var class="Arg">R</var> that has value zero at <var class="Arg">elm</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">MinimalPolynomial(Rationals,[[2,0],[0,2]]);</span>
x-2
</pre></div>

<p><a id="X837B8E55832CDFEB" name="X837B8E55832CDFEB"></a></p>

<h4>66.9 <span class="Heading">Cyclotomic Polynomials</span></h4>

<p><a id="X827FC7FE81EE4C02" name="X827FC7FE81EE4C02"></a></p>

<h5>66.9-1 CyclotomicPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CyclotomicPolynomial</code>( <var class="Arg">F</var>, <var class="Arg">n</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>is the <var class="Arg">n</var>-th cyclotomic polynomial over the ring <var class="Arg">F</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CyclotomicPolynomial(Rationals,5);</span>
x^4+x^3+x^2+x+1
</pre></div>

<p><a id="X8551EF5187509D69" name="X8551EF5187509D69"></a></p>

<h4>66.10 <span class="Heading">Polynomial Factorization</span></h4>

<p>At the moment <strong class="pkg">GAP</strong> provides only methods to factorize polynomials over finite fields (see Chapter <a href="chap59.html#X7893ABF67A028802"><span class="RefLink">59</span></a>), over subfields of cyclotomic fields (see Chapter <a href="chap60.html#X80510B5880521FDC"><span class="RefLink">60</span></a>), and over algebraic extensions of these (see Chapter <a href="chap67.html#X85732CEF7ECFCA68"><span class="RefLink">67</span></a>).</p>

<p><a id="X83511D517B544F36" name="X83511D517B544F36"></a></p>

<h5>66.10-1 Factors</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Factors</code>( [<var class="Arg">R</var>, ]<var class="Arg">poly</var>[, <var class="Arg">opt</var>] )</td><td class="tdright">( method )</td></tr></table></div>
<p>returns a list of the irreducible factors of the polynomial <var class="Arg">poly</var> in the polynomial ring <var class="Arg">R</var>. (That is factors over the <code class="func">CoefficientsRing</code> (<a href="chap66.html#X8235D10781BE8003"><span class="RefLink">66.15-3</span></a>) value of <var class="Arg">R</var>.)</p>

<p>For univariate factorizations, it is possible to pass a record <var class="Arg">opt</var> as a third argument. This record can contain the following components:</p>


<dl>
<dt><strong class="Mark"><code class="code">onlydegs</code></strong></dt>
<dd><p>is a set of positive integers. The factorization assumes that all irreducible factors have a degree in this set.</p>

</dd>
<dt><strong class="Mark"><code class="code">stopdegs</code></strong></dt>
<dd><p>is a set of positive integers. The factorization will stop once a factor of degree in <code class="code">stopdegs</code> has been found and will return the factorization found so far.</p>

</dd>
</dl>

<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= CyclotomicPolynomial( GF(2), 7 );</span>
x_1^6+x_1^5+x_1^4+x_1^3+x_1^2+x_1+Z(2)^0
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors( f );</span>
[ x_1^3+x_1+Z(2)^0, x_1^3+x_1^2+Z(2)^0 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors( PolynomialRing( GF(8) ), f );</span>
[ 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 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= MinimalPolynomial( Rationals, E(4) );</span>
x^2+1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors( f );</span>
[ x^2+1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors( PolynomialRing( Rationals ), f );</span>
[ x^2+1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors( PolynomialRing( CF(4) ), f );</span>
[ x+(-E(4)), x+E(4) ]
</pre></div>

<p><a id="X7F5A4ACB7AF9E329" name="X7F5A4ACB7AF9E329"></a></p>

<h5>66.10-2 FactorsSquarefree</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FactorsSquarefree</code>( <var class="Arg">pring</var>, <var class="Arg">upol</var>, <var class="Arg">opt</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns a factorization of the squarefree, monic, univariate polynomial <var class="Arg">upol</var> in the polynomial ring <var class="Arg">pring</var>; <var class="Arg">opt</var> must be a (possibly empty) record of options. <var class="Arg">upol</var> must not have zero as a root. This function is used by the factoring algorithms.</p>

<p>The current method for multivariate factorization reduces to univariate factorization by use of a reduction homomorphism of the form <span class="SimpleMath">f(x_1,x_2,x_3) ↦ f(x,x^p,x^{p^2})</span>. It can be very time intensive for larger degrees.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Factors(x^10-y^10);</span>
[ x-y, x+y, x^4-x^3*y+x^2*y^2-x*y^3+y^4, x^4+x^3*y+x^2*y^2+x*y^3+y^4 ]
</pre></div>

<p><a id="X7F45E9E47EA2C18B" name="X7F45E9E47EA2C18B"></a></p>

<h4>66.11 <span class="Heading">Polynomials over the Rationals</span></h4>

<p>The following functions are only available to polynomials with rational coefficients:</p>

<p><a id="X7E66494B7B05A055" name="X7E66494B7B05A055"></a></p>

<h5>66.11-1 PrimitivePolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PrimitivePolynomial</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>takes a polynomial <var class="Arg">f</var> with rational coefficients and computes a new polynomial with integral coefficients, obtained by multiplying with the Lcm of the denominators of the coefficients and casting out the content (the Gcd of the coefficients). The operation returns a list [<var class="Arg">newpol</var>,<var class="Arg">coeff</var>] with rational <var class="Arg">coeff</var> such that <code class="code"><var class="Arg">coeff</var>*<var class="Arg">newpol</var>=<var class="Arg">f</var></code>.</p>

<p><a id="X7A73A3877EB73566" name="X7A73A3877EB73566"></a></p>

<h5>66.11-2 PolynomialModP</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialModP</code>( <var class="Arg">pol</var>, <var class="Arg">p</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>for a rational polynomial <var class="Arg">pol</var> this function returns a polynomial over the field with <var class="Arg">p</var> elements, obtained by reducing the coefficients modulo <var class="Arg">p</var>.</p>

<p><a id="X7AB9A6257ED694EC" name="X7AB9A6257ED694EC"></a></p>

<h5>66.11-3 GaloisType</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GaloisType</code>( <var class="Arg">f</var>[, <var class="Arg">cand</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>Let <var class="Arg">f</var> be an irreducible polynomial with rational coefficients. This function returns the type of Gal(<var class="Arg">f</var>) (considered as a transitive permutation group of the roots of <var class="Arg">f</var>). It returns a number <var class="Arg">i</var> if Gal(<var class="Arg">f</var>) is permutation isomorphic to <code class="code">TransitiveGroup(<var class="Arg">n</var>,<var class="Arg">i</var>)</code> where <var class="Arg">n</var> is the degree of <var class="Arg">f</var>.</p>

<p>Identification is performed by factoring appropriate Galois resolvents as proposed in <a href="chapBib.html#biBMS85">[SM85]</a>. This function is provided for rational polynomials of degree up to 15. However, in some cases the required calculations become unfeasibly large.</p>

<p>For a few polynomials of degree 14, a complete discrimination is not yet possible, as it would require computations, that are not feasible with current factoring methods.</p>

<p>This function requires the transitive groups library to be installed (see <a href="chap50.html#X7FBB970F7D110FDB"><span class="RefLink">50.6</span></a>).</p>

<p><a id="X7EB610D37D156DC6" name="X7EB610D37D156DC6"></a></p>

<h5>66.11-4 ProbabilityShapes</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProbabilityShapes</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Let <var class="Arg">f</var> be an irreducible polynomial with rational coefficients. This function returns a list of the most likely type(s) of Gal(<var class="Arg">f</var>) (see <code class="func">GaloisType</code> (<a href="chap66.html#X7AB9A6257ED694EC"><span class="RefLink">66.11-3</span></a>)), based on factorization modulo a set of primes. It is very fast, but the result is only probabilistic.</p>

<p>This function requires the transitive groups library to be installed (see <a href="chap50.html#X7FBB970F7D110FDB"><span class="RefLink">50.6</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=x^9-9*x^7+27*x^5-39*x^3+36*x-8;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GaloisType(f);</span>
25
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">TransitiveGroup(9,25);</span>
[1/2.S(3)^3]3
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProbabilityShapes(f);</span>
[ 25 ]
</pre></div>

<p><a id="X7C178AB9866FDDE5" name="X7C178AB9866FDDE5"></a></p>

<h4>66.12 <span class="Heading">Factorization of Polynomials over the Rationals</span></h4>

<p>The following operations are used by <strong class="pkg">GAP</strong> inside the factorization algorithm but might be of interest also in other contexts.</p>

<p><a id="X8723075C81D2CCA6" name="X8723075C81D2CCA6"></a></p>

<h5>66.12-1 BombieriNorm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BombieriNorm</code>( <var class="Arg">pol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>computes weighted Norm [<var class="Arg">pol</var>]<span class="SimpleMath">_2</span> of <var class="Arg">pol</var> which is a good measure for factor coefficients (see <a href="chapBib.html#biBBTW93">[BTW93]</a>).</p>

<p><a id="X856D769D878AF7AE" name="X856D769D878AF7AE"></a></p>

<h5>66.12-2 MinimizedBombieriNorm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MinimizedBombieriNorm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>This function applies linear Tschirnhaus transformations (<span class="SimpleMath">x ↦ x + i</span>) to the polynomial <var class="Arg">f</var>, trying to get the Bombieri norm of <var class="Arg">f</var> small. It returns a list <code class="code">[<var class="Arg">new_polynomial</var>, <var class="Arg">i_of_transformation</var>]</code>.</p>

<p><a id="X8139BB0F87399F2C" name="X8139BB0F87399F2C"></a></p>

<h5>66.12-3 HenselBound</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; HenselBound</code>( <var class="Arg">pol</var>[, <var class="Arg">minpol</var>, <var class="Arg">den</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the Hensel bound of the polynomial <var class="Arg">pol</var>. If the computation takes place over an algebraic extension, then the minimal polynomial <var class="Arg">minpol</var> and denominator <var class="Arg">den</var> must be given.</p>

<p><a id="X79CC9C8D7C9F6B6A" name="X79CC9C8D7C9F6B6A"></a></p>

<h5>66.12-4 OneFactorBound</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; OneFactorBound</code>( <var class="Arg">pol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the coefficient bound for a single factor of the rational polynomial <var class="Arg">pol</var>.</p>

<p><a id="X844B3C6C87A0E7E0" name="X844B3C6C87A0E7E0"></a></p>

<h4>66.13 <span class="Heading">Laurent Polynomials</span></h4>

<p>A univariate polynomial can be written in the form <span class="SimpleMath">r_0 + r_1 x + ⋯ + r_n x^n</span>, with <span class="SimpleMath">r_i ∈ R</span>. Formally, there is no reason to start with 0, if <span class="SimpleMath">m</span> is an integer, we can consider objects of the form <span class="SimpleMath">r_m x^m + r_{m+1} x^{m+1} + ⋯ + r_n x^n</span>. We call these <em>Laurent polynomials</em>. 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).</p>

<p><a id="X8467263B7EFA013E" name="X8467263B7EFA013E"></a></p>

<h5>66.13-1 LaurentPolynomialByCoefficients</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LaurentPolynomialByCoefficients</code>( <var class="Arg">fam</var>, <var class="Arg">cofs</var>, <var class="Arg">val</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>constructs a Laurent polynomial over the coefficients family <var class="Arg">fam</var> and in the indeterminate <var class="Arg">ind</var> (defaulting to 1) with the coefficients given by <var class="Arg">coefs</var> and valuation <var class="Arg">val</var>.</p>

<p><a id="X86D58AB67F86469F" name="X86D58AB67F86469F"></a></p>

<h5>66.13-2 CoefficientsOfLaurentPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoefficientsOfLaurentPolynomial</code>( <var class="Arg">laurent</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a Laurent polynomial <var class="Arg">laurent</var>, this function returns a pair <code class="code">[<var class="Arg">cof</var>, <var class="Arg">val</var>]</code>, consisting of the coefficient list (in ascending order) <var class="Arg">cof</var> and the valuation <var class="Arg">val</var> of <var class="Arg">laurent</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">p:=LaurentPolynomialByCoefficients(FamilyObj(1),</span>
<span class="GAPprompt">&gt;</span> <span class="GAPinput">[1,2,3,4,5],-2);</span>
5*x^2+4*x+3+2*x^-1+x^-2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NumeratorOfRationalFunction(p);DenominatorOfRationalFunction(p);</span>
5*x^4+4*x^3+3*x^2+2*x+1
x^2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CoefficientsOfLaurentPolynomial(p*p);</span>
[ [ 1, 4, 10, 20, 35, 44, 46, 40, 25 ], -4 ]
</pre></div>

<p><a id="X8381E1B582F38C85" name="X8381E1B582F38C85"></a></p>

<h5>66.13-3 IndeterminateNumberOfLaurentPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminateNumberOfLaurentPolynomial</code>( <var class="Arg">pol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Is a synonym for <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>).</p>

<p><a id="X7C1708D27F97B05F" name="X7C1708D27F97B05F"></a></p>

<h4>66.14 <span class="Heading">Univariate Rational Functions</span></h4>

<p><a id="X83DD411179888783" name="X83DD411179888783"></a></p>

<h5>66.14-1 UnivariateRationalFunctionByCoefficients</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariateRationalFunctionByCoefficients</code>( <var class="Arg">fam</var>, <var class="Arg">ncof</var>, <var class="Arg">dcof</var>, <var class="Arg">val</var>[, <var class="Arg">ind</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>constructs a univariate rational function over the coefficients family <var class="Arg">fam</var> and in the indeterminate <var class="Arg">ind</var> (defaulting to 1) with numerator and denominator coefficients given by <var class="Arg">ncof</var> and <var class="Arg">dcof</var> and valuation <var class="Arg">val</var>.</p>

<p><a id="X7C59471783C3FEDC" name="X7C59471783C3FEDC"></a></p>

<h4>66.15 <span class="Heading">Polynomial Rings and Function Fields</span></h4>

<p>While polynomials depend only on the family of the coefficients, polynomial rings <span class="SimpleMath">A</span> are defined over a base ring <span class="SimpleMath">R</span>. A polynomial is an element of <span class="SimpleMath">A</span> if and only if all its coefficients are contained in <span class="SimpleMath">R</span>. Besides providing domains and an easy way to create polynomials, polynomial rings can affect the behavior of operations like factorization into irreducibles.</p>

<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 <a href="chap66.html#X7A8FADCD875826DA"><span class="RefLink">66.1</span></a> for details about the internal numbering): Either, first create the ring and then get the indeterminates with <code class="func">IndeterminatesOfPolynomialRing</code> (<a href="chap66.html#X80D585E1793D4552"><span class="RefLink">66.15-2</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r := PolynomialRing(Rationals,["a","b"]);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">indets := IndeterminatesOfPolynomialRing(r);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a := indets[1]; a := indets[2];</span>
a
b
</pre></div>

<p>Alternatively, first create the indeterminates and then create the ring including these indeterminates.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:=Indeterminate(Rationals,"a":old);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">b:=Indeterminate(Rationals,"b":old);;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PolynomialRing(Rationals,[a,b]);;</span>
</pre></div>

<p>As a convenient shortcut, intended mainly for interactive working, the <span class="SimpleMath">i</span>-th indeterminate of a polynomial ring <span class="SimpleMath">R</span> can be accessed as <span class="SimpleMath">R.i</span>, which corresponds exactly to <code class="code">IndeterminatesOfPolynomialRing</code><span class="SimpleMath">( R )[i]</span> or, if it has the name <code class="code">nam</code>, as <span class="SimpleMath">R</span><code class="code">.nam</code>. <em>Note</em> that the number <span class="SimpleMath">i</span> is in general <em>not</em> the indeterminate number, but simply an index into the indeterminates list of <span class="SimpleMath">R</span>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r := PolynomialRing(Rationals, ["a", "b"]:old );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r.1; r.2; r.a; r.b;</span>
a
b
a
b
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminateNumberOfLaurentPolynomial(r.1);</span>
3
</pre></div>

<p>Polynomials as <strong class="pkg">GAP</strong> 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>

<p><a id="X7D2F16E480060330" name="X7D2F16E480060330"></a></p>

<h5>66.15-1 <span class="Heading">PolynomialRing</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialRing</code>( <var class="Arg">R</var>, <var class="Arg">rank</var>[, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialRing</code>( <var class="Arg">R</var>, <var class="Arg">names</var>[, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialRing</code>( <var class="Arg">R</var>, <var class="Arg">indets</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialRing</code>( <var class="Arg">R</var>, <var class="Arg">indetnums</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>creates a polynomial ring over the ring <var class="Arg">R</var>. If a positive integer <var class="Arg">rank</var> is given, this creates the polynomial ring in <var class="Arg">rank</var> indeterminates. These indeterminates will have the internal index numbers 1 to <var class="Arg">rank</var>. The second usage takes a list <var class="Arg">names</var> of strings and returns a polynomial ring in indeterminates labelled by <var class="Arg">names</var>. These indeterminates have "new" internal index numbers as if they had been created by calls to <code class="func">Indeterminate</code> (<a href="chap66.html#X79D0380D7FA39F7D"><span class="RefLink">66.1-1</span></a>). (If the argument <var class="Arg">avoid</var> is given it contains indeterminates that should be avoided, in this case internal index numbers are incremented to skip these variables.) In the third version, a list of indeterminates <var class="Arg">indets</var> is given. This creates the polynomial ring in the indeterminates <var class="Arg">indets</var>. Finally, the fourth version specifies indeterminates by their index numbers.</p>

<p>To get the indeterminates of a polynomial ring use <code class="func">IndeterminatesOfPolynomialRing</code> (<a href="chap66.html#X80D585E1793D4552"><span class="RefLink">66.15-2</span></a>). (Indeterminates created independently with <code class="func">Indeterminate</code> (<a href="chap66.html#X79D0380D7FA39F7D"><span class="RefLink">66.1-1</span></a>) will usually differ, though they might be given the same name and display identically, see Section <a href="chap66.html#X7A8FADCD875826DA"><span class="RefLink">66.1</span></a>.)</p>

<p><a id="X80D585E1793D4552" name="X80D585E1793D4552"></a></p>

<h5>66.15-2 IndeterminatesOfPolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminatesOfPolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IndeterminatesOfFunctionField</code>( <var class="Arg">ffield</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns a list of the indeterminates of the polynomial ring <var class="Arg">pring</var>, respectively the function field <var class="Arg">ffield</var>.</p>

<p><a id="X8235D10781BE8003" name="X8235D10781BE8003"></a></p>

<h5>66.15-3 CoefficientsRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoefficientsRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the ring of coefficients of the polynomial ring <var class="Arg">pring</var>, that is the ring over which <var class="Arg">pring</var> was defined.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=PolynomialRing(GF(7));</span>
GF(7)[x_1]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=PolynomialRing(GF(7),3);</span>
GF(7)[x_1,x_2,x_3]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IndeterminatesOfPolynomialRing(r);</span>
[ x_1, x_2, x_3 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r2:=PolynomialRing(GF(7),[5,7,12]);</span>
GF(7)[x_5,x_7,x_12]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CoefficientsRing(r);</span>
GF(7)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=PolynomialRing(GF(7),3);</span>
GF(7)[x_1,x_2,x_3]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r2:=PolynomialRing(GF(7),3,IndeterminatesOfPolynomialRing(r));</span>
GF(7)[x_4,x_5,x_6]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=PolynomialRing(GF(7),["x","y","z","z2"]);</span>
GF(7)[x,y,z,z2]
</pre></div>

<p><a id="X7D631ACC86C584B7" name="X7D631ACC86C584B7"></a></p>

<h5>66.15-4 IsPolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of polynomial rings</p>

<p><a id="X86F391237A76D804" name="X86F391237A76D804"></a></p>

<h5>66.15-5 IsFiniteFieldPolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsFiniteFieldPolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of polynomial rings over a finite field (see Chapter <a href="chap59.html#X7893ABF67A028802"><span class="RefLink">59</span></a>).</p>

<p><a id="X782D07F77BCF67C1" name="X782D07F77BCF67C1"></a></p>

<h5>66.15-6 IsAbelianNumberFieldPolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAbelianNumberFieldPolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of polynomial rings over a field of cyclotomics (see the chapters <a href="chap18.html#X7DFC03C187DE4841"><span class="RefLink">18</span></a> and <a href="chap60.html#X80510B5880521FDC"><span class="RefLink">60</span></a>).</p>

<p><a id="X7D45213A8642033B" name="X7D45213A8642033B"></a></p>

<h5>66.15-7 IsRationalsPolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRationalsPolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of polynomial rings over the rationals (see Chapter <a href="chap17.html#X87003045878E74DF"><span class="RefLink">17</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r := PolynomialRing(Rationals, ["a", "b"] );;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsPolynomialRing(r);</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsFiniteFieldPolynomialRing(r);</span>
false
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsRationalsPolynomialRing(r);</span>
true
</pre></div>

<p><a id="X812E801484E3624E" name="X812E801484E3624E"></a></p>

<h5>66.15-8 <span class="Heading">FunctionField</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FunctionField</code>( <var class="Arg">R</var>, <var class="Arg">rank</var>[, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FunctionField</code>( <var class="Arg">R</var>, <var class="Arg">names</var>[, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FunctionField</code>( <var class="Arg">R</var>, <var class="Arg">indets</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; FunctionField</code>( <var class="Arg">R</var>, <var class="Arg">indetnums</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>creates a function field over the integral ring <var class="Arg">R</var>. If a positive integer <var class="Arg">rank</var> is given, this creates the function field in <var class="Arg">rank</var> indeterminates. These indeterminates will have the internal index numbers 1 to <var class="Arg">rank</var>. The second usage takes a list <var class="Arg">names</var> of strings and returns a function field in indeterminates labelled by <var class="Arg">names</var>. These indeterminates have "new" internal index numbers as if they had been created by calls to <code class="func">Indeterminate</code> (<a href="chap66.html#X79D0380D7FA39F7D"><span class="RefLink">66.1-1</span></a>). (If the argument <var class="Arg">avoid</var> is given it contains indeterminates that should be avoided, in this case internal index numbers are incremented to skip these variables.) In the third version, a list of indeterminates <var class="Arg">indets</var> is given. This creates the function field in the indeterminates <var class="Arg">indets</var>. Finally, the fourth version specifies indeterminates by their index number.</p>

<p>To get the indeterminates of a function field use <code class="func">IndeterminatesOfFunctionField</code> (<a href="chap66.html#X80D585E1793D4552"><span class="RefLink">66.15-2</span></a>). (Indeterminates created independently with <code class="func">Indeterminate</code> (<a href="chap66.html#X79D0380D7FA39F7D"><span class="RefLink">66.1-1</span></a>) will usually differ, though they might be given the same name and display identically, see Section <a href="chap66.html#X7A8FADCD875826DA"><span class="RefLink">66.1</span></a>.)</p>

<p><a id="X8090C9EC85201AAC" name="X8090C9EC85201AAC"></a></p>

<h5>66.15-9 IsFunctionField</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsFunctionField</code>( <var class="Arg">ffield</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of function fields</p>

<p><a id="X85CA757B844F12AE" name="X85CA757B844F12AE"></a></p>

<h4>66.16 <span class="Heading">Univariate Polynomial Rings</span></h4>

<p><a id="X84DC2A59797A26DE" name="X84DC2A59797A26DE"></a></p>

<h5>66.16-1 <span class="Heading">UnivariatePolynomialRing</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariatePolynomialRing</code>( <var class="Arg">R</var>[, <var class="Arg">nr</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnivariatePolynomialRing</code>( <var class="Arg">R</var>[, <var class="Arg">name</var>][, <var class="Arg">avoid</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns a univariate polynomial ring in the indeterminate <var class="Arg">nr</var> over the base ring <var class="Arg">R</var>. If <var class="Arg">nr</var> is not given it defaults to 1.</p>

<p>If the number is not specified a list <var class="Arg">avoid</var> of indeterminates may be given. Then the function will return a ring in an indeterminate that is guaranteed to be different from all the indeterminates in <var class="Arg">avoid</var>.</p>

<p>Also a string <var class="Arg">name</var> can be prescribed as the name of the indeterminate chosen (also avoiding the indeterminates in the list <var class="Arg">avoid</var> if given).</p>

<p><a id="X7A43D74B812401CA" name="X7A43D74B812401CA"></a></p>

<h5>66.16-2 IsUnivariatePolynomialRing</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsUnivariatePolynomialRing</code>( <var class="Arg">pring</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>is the category of polynomial rings with one indeterminate.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=UnivariatePolynomialRing(Rationals,"p");</span>
Rationals[p]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r2:=PolynomialRing(Rationals,["q"]);</span>
Rationals[q]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsUnivariatePolynomialRing(r);</span>
true
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsUnivariatePolynomialRing(r2);</span>
true
</pre></div>

<p><a id="X86E2ADEA784AD163" name="X86E2ADEA784AD163"></a></p>

<h4>66.17 <span class="Heading">Monomial Orderings</span></h4>

<p>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 <em>monomial ordering</em> if it is total, invariant under multiplication with other monomials and admits no infinite descending chains. For details on monomial orderings see <a href="chapBib.html#biBcoxlittleoshea">[CLO97]</a>.</p>

<p>In <strong class="pkg">GAP</strong>, monomial orderings are represented by objects that provide a way to compare monomials (as polynomials as well as –for efficiency purposes within algorithms– in the internal representation as lists).</p>

<p>Normally the ordering chosen should be <em>admissible</em>, i.e. it must be compatible with products: If <span class="SimpleMath">a &lt; b</span> then <span class="SimpleMath">ca &lt; cb</span> for all monomials <span class="SimpleMath">a, b</span> and <span class="SimpleMath">c</span>.</p>

<p>Each monomial ordering provides the two functions <code class="func">MonomialComparisonFunction</code> (<a href="chap66.html#X7EDE941781BA7F8B"><span class="RefLink">66.17-5</span></a>) and <code class="func">MonomialExtrepComparisonFun</code> (<a href="chap66.html#X7EDC3A457E7B591E"><span class="RefLink">66.17-6</span></a>) to compare monomials. These functions work as "is less than", i.e. they return <code class="keyw">true</code> if and only if the left argument is smaller.</p>

<p><a id="X79D4CBBF820EA204" name="X79D4CBBF820EA204"></a></p>

<h5>66.17-1 IsMonomialOrdering</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsMonomialOrdering</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A monomial ordering is an object representing a monomial ordering. Its attributes <code class="func">MonomialComparisonFunction</code> (<a href="chap66.html#X7EDE941781BA7F8B"><span class="RefLink">66.17-5</span></a>) and <code class="func">MonomialExtrepComparisonFun</code> (<a href="chap66.html#X7EDC3A457E7B591E"><span class="RefLink">66.17-6</span></a>) are actual comparison functions.</p>

<p><a id="X7D052A017A73E91E" name="X7D052A017A73E91E"></a></p>

<h5>66.17-2 LeadingMonomialOfPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeadingMonomialOfPolynomial</code>( <var class="Arg">pol</var>, <var class="Arg">ord</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the leading monomial (with respect to the ordering <var class="Arg">ord</var>) of the polynomial <var class="Arg">pol</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">x:=Indeterminate(Rationals,"x");;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">y:=Indeterminate(Rationals,"y");;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">z:=Indeterminate(Rationals,"z");;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">lexord:=MonomialLexOrdering();grlexord:=MonomialGrlexOrdering();</span>
MonomialLexOrdering()
MonomialGrlexOrdering()
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=2*x+3*y+4*z+5*x^2-6*z^2+7*y^3;          </span>
7*y^3+5*x^2-6*z^2+2*x+3*y+4*z
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingMonomialOfPolynomial(f,lexord);</span>
x^2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingMonomialOfPolynomial(f,grlexord);</span>
y^3
</pre></div>

<p><a id="X7B6231137BA8B95F" name="X7B6231137BA8B95F"></a></p>

<h5>66.17-3 LeadingTermOfPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeadingTermOfPolynomial</code>( <var class="Arg">pol</var>, <var class="Arg">ord</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the leading term (with respect to the ordering <var class="Arg">ord</var>) of the polynomial <var class="Arg">pol</var>, i.e. the product of leading coefficient and leading monomial.</p>

<p><a id="X798E707D86141087" name="X798E707D86141087"></a></p>

<h5>66.17-4 LeadingCoefficientOfPolynomial</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeadingCoefficientOfPolynomial</code>( <var class="Arg">pol</var>, <var class="Arg">ord</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the leading coefficient (that is the coefficient of the leading monomial, see <code class="func">LeadingMonomialOfPolynomial</code> (<a href="chap66.html#X7D052A017A73E91E"><span class="RefLink">66.17-2</span></a>)) of the polynomial <var class="Arg">pol</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingTermOfPolynomial(f,lexord);</span>
5*x^2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingTermOfPolynomial(f,grlexord);</span>
7*y^3
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LeadingCoefficientOfPolynomial(f,lexord);</span>
5
</pre></div>

<p><a id="X7EDE941781BA7F8B" name="X7EDE941781BA7F8B"></a></p>

<h5>66.17-5 MonomialComparisonFunction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialComparisonFunction</code>( <var class="Arg">O</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If <var class="Arg">O</var> is an object representing a monomial ordering, this attribute returns a <em>function</em> that can be used to compare or sort monomials (and polynomials which will be compared by their monomials in decreasing order) in this order.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">MonomialComparisonFunction(lexord);</span>
function( a, b ) ... end
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[f,Derivative(f,x),Derivative(f,y),Derivative(f,z)];;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(lexord));l;</span>
[ -12*z+4, 21*y^2+3, 10*x+2, 7*y^3+5*x^2-6*z^2+2*x+3*y+4*z ]
</pre></div>

<p><a id="X7EDC3A457E7B591E" name="X7EDC3A457E7B591E"></a></p>

<h5>66.17-6 MonomialExtrepComparisonFun</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialExtrepComparisonFun</code>( <var class="Arg">O</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If <var class="Arg">O</var> is an object representing a monomial ordering, this attribute returns a <em>function</em> that can be used to compare or sort monomials <em>in their external representation</em> (as lists). This comparison variant is used inside algorithms that manipulate the external representation.</p>

<p><a id="X852D7BB37ECE98E1" name="X852D7BB37ECE98E1"></a></p>

<h5>66.17-7 MonomialLexOrdering</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialLexOrdering</code>( [<var class="Arg">vari</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function creates a lexicographic ordering for monomials. Monomials are compared first by the exponents of the largest variable, then the exponents of the second largest variable and so on.</p>

<p>The variables are ordered according to their (internal) index, i.e., <span class="SimpleMath">x_1</span> is larger than <span class="SimpleMath">x_2</span> and so on. If <var class="Arg">vari</var> is given, and is a list of variables or variable indices, instead this arrangement of variables (in descending order; i.e. the first variable is larger than the second) is used as the underlying order of variables.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=List(Tuples([1..3],3),i-&gt;x^(i[1]-1)*y^(i[2]-1)*z^(i[3]-1));</span>
[ 1, z, z^2, y, y*z, y*z^2, y^2, y^2*z, y^2*z^2, x, x*z, x*z^2, x*y, 
  x*y*z, x*y*z^2, x*y^2, x*y^2*z, x*y^2*z^2, x^2, x^2*z, x^2*z^2, 
  x^2*y, x^2*y*z, x^2*y*z^2, x^2*y^2, x^2*y^2*z, x^2*y^2*z^2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialLexOrdering()));l;</span>
[ 1, z, z^2, y, y*z, y*z^2, y^2, y^2*z, y^2*z^2, x, x*z, x*z^2, x*y, 
  x*y*z, x*y*z^2, x*y^2, x*y^2*z, x*y^2*z^2, x^2, x^2*z, x^2*z^2, 
  x^2*y, x^2*y*z, x^2*y*z^2, x^2*y^2, x^2*y^2*z, x^2*y^2*z^2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialLexOrdering([y,z,x])));l;</span>
[ 1, x, x^2, z, x*z, x^2*z, z^2, x*z^2, x^2*z^2, y, x*y, x^2*y, y*z, 
  x*y*z, x^2*y*z, y*z^2, x*y*z^2, x^2*y*z^2, y^2, x*y^2, x^2*y^2, 
  y^2*z, x*y^2*z, x^2*y^2*z, y^2*z^2, x*y^2*z^2, x^2*y^2*z^2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialLexOrdering([z,x,y])));l;</span>
[ 1, y, y^2, x, x*y, x*y^2, x^2, x^2*y, x^2*y^2, z, y*z, y^2*z, x*z, 
  x*y*z, x*y^2*z, x^2*z, x^2*y*z, x^2*y^2*z, z^2, y*z^2, y^2*z^2, 
  x*z^2, x*y*z^2, x*y^2*z^2, x^2*z^2, x^2*y*z^2, x^2*y^2*z^2 ]
</pre></div>

<p><a id="X786C866C824D2688" name="X786C866C824D2688"></a></p>

<h5>66.17-8 MonomialGrlexOrdering</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialGrlexOrdering</code>( [<var class="Arg">vari</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function creates a degree/lexicographic ordering. In this ordering monomials are compared first by their total degree, then lexicographically (see <code class="func">MonomialLexOrdering</code> (<a href="chap66.html#X852D7BB37ECE98E1"><span class="RefLink">66.17-7</span></a>)).</p>

<p>The variables are ordered according to their (internal) index, i.e., <span class="SimpleMath">x_1</span> is larger than <span class="SimpleMath">x_2</span> and so on. If <var class="Arg">vari</var> is given, and is a list of variables or variable indices, instead this arrangement of variables (in descending order; i.e. the first variable is larger than the second) is used as the underlying order of variables.</p>

<p><a id="X8094C733808D1799" name="X8094C733808D1799"></a></p>

<h5>66.17-9 MonomialGrevlexOrdering</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialGrevlexOrdering</code>( [<var class="Arg">vari</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function creates a "grevlex" ordering. In this ordering monomials are compared first by total degree and then backwards lexicographically. (This is different than "grlex" ordering with variables reversed.)</p>

<p>The variables are ordered according to their (internal) index, i.e., <span class="SimpleMath">x_1</span> is larger than <span class="SimpleMath">x_2</span> and so on. If <var class="Arg">vari</var> is given, and is a list of variables or variable indices, instead this arrangement of variables (in descending order; i.e. the first variable is larger than the second) is used as the underlying order of variables.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialGrlexOrdering()));l;</span>
[ 1, z, y, x, z^2, y*z, y^2, x*z, x*y, x^2, y*z^2, y^2*z, x*z^2, 
  x*y*z, x*y^2, x^2*z, x^2*y, y^2*z^2, x*y*z^2, x*y^2*z, x^2*z^2, 
  x^2*y*z, x^2*y^2, x*y^2*z^2, x^2*y*z^2, x^2*y^2*z, x^2*y^2*z^2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialGrevlexOrdering()));l;</span>
[ 1, z, y, x, z^2, y*z, x*z, y^2, x*y, x^2, y*z^2, x*z^2, y^2*z, 
  x*y*z, x^2*z, x*y^2, x^2*y, y^2*z^2, x*y*z^2, x^2*z^2, x*y^2*z, 
  x^2*y*z, x^2*y^2, x*y^2*z^2, x^2*y*z^2, x^2*y^2*z, x^2*y^2*z^2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Sort(l,MonomialComparisonFunction(MonomialGrlexOrdering([z,y,x])));l;</span>
[ 1, x, y, z, x^2, x*y, y^2, x*z, y*z, z^2, x^2*y, x*y^2, x^2*z, 
  x*y*z, y^2*z, x*z^2, y*z^2, x^2*y^2, x^2*y*z, x*y^2*z, x^2*z^2, 
  x*y*z^2, y^2*z^2, x^2*y^2*z, x^2*y*z^2, x*y^2*z^2, x^2*y^2*z^2 ]
</pre></div>

<p><a id="X84AC871283A74EC0" name="X84AC871283A74EC0"></a></p>

<h5>66.17-10 EliminationOrdering</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EliminationOrdering</code>( <var class="Arg">elim</var>[, <var class="Arg">rest</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function creates an elimination ordering for eliminating the variables in <var class="Arg">elim</var>. Two monomials are compared first by the exponent vectors for the variables listed in <var class="Arg">elim</var> (a lexicographic comparison with respect to the ordering indicated in <var class="Arg">elim</var>). If these submonomial are equal, the submonomials given by the other variables are compared by a graded lexicographic ordering (with respect to the variable order given in <var class="Arg">rest</var>, if called with two parameters).</p>

<p>Both <var class="Arg">elim</var> and <var class="Arg">rest</var> may be a list of variables or a list of variable indices.</p>

<p><a id="X7C99593584D478D7" name="X7C99593584D478D7"></a></p>

<h5>66.17-11 PolynomialReduction</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialReduction</code>( <var class="Arg">poly</var>, <var class="Arg">gens</var>, <var class="Arg">order</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>reduces the polynomial <var class="Arg">poly</var> by the ideal generated by the polynomials in <var class="Arg">gens</var>, using the order <var class="Arg">order</var> of monomials. Unless <var class="Arg">gens</var> is a Gröbner basis the result is not guaranteed to be unique.</p>

<p>The operation returns a list of length two, the first entry is the remainder after the reduction. The second entry is a list of quotients corresponding to <var class="Arg">gens</var>.</p>

<p>Note that the strategy used by <code class="func">PolynomialReduction</code> differs from the standard textbook reduction algorithm, which is provided by <code class="func">PolynomialDivisionAlgorithm</code> (<a href="chap66.html#X7C8239057FD4EC03"><span class="RefLink">66.17-13</span></a>).</p>

<p><a id="X7DE7D4467EBAD916" name="X7DE7D4467EBAD916"></a></p>

<h5>66.17-12 PolynomialReducedRemainder</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialReducedRemainder</code>( <var class="Arg">poly</var>, <var class="Arg">gens</var>, <var class="Arg">order</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>this operation does the same way as <code class="func">PolynomialReduction</code> (<a href="chap66.html#X7C99593584D478D7"><span class="RefLink">66.17-11</span></a>) but does not keep track of the actual quotients and returns only the remainder (it is therefore slightly faster).</p>

<p><a id="X7C8239057FD4EC03" name="X7C8239057FD4EC03"></a></p>

<h5>66.17-13 PolynomialDivisionAlgorithm</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialDivisionAlgorithm</code>( <var class="Arg">poly</var>, <var class="Arg">gens</var>, <var class="Arg">order</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function implements the division algorithm for multivariate polynomials as given in <a href="chapBib.html#biBcoxlittleoshea">[CLO97, Theorem 3 in Chapter 2]</a>. (It might be slower than <code class="func">PolynomialReduction</code> (<a href="chap66.html#X7C99593584D478D7"><span class="RefLink">66.17-11</span></a>) but the remainders are guaranteed to agree with the textbook.)</p>

<p>The operation returns a list of length two, the first entry is the remainder after the reduction. The second entry is a list of quotients corresponding to <var class="Arg">gens</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">bas:=[x^3*y*z,x*y^2*z,z*y*z^3+x];;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">pol:=x^7*z*bas[1]+y^5*bas[3]+x*z;;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PolynomialReduction(pol,bas,MonomialLexOrdering()); </span>
[ -y*z^5, [ x^7*z, 0, y^5+z ] ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PolynomialReducedRemainder(pol,bas,MonomialLexOrdering());</span>
-y*z^5
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PolynomialDivisionAlgorithm(pol,bas,MonomialLexOrdering());</span>
[ -y*z^5, [ x^7*z, 0, y^5+z ] ]
</pre></div>

<p><a id="X7A30E10B820311D1" name="X7A30E10B820311D1"></a></p>

<h5>66.17-14 MonomialExtGrlexLess</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MonomialExtGrlexLess</code>( <var class="Arg">a</var>, <var class="Arg">b</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>implements comparison of monomial in their external representation by a "grlex" order with <span class="SimpleMath">x_1&gt;x_2</span> (This is exactly the same as the ordering by <code class="func">MonomialGrlexOrdering</code> (<a href="chap66.html#X786C866C824D2688"><span class="RefLink">66.17-8</span></a>), see  <a href="chap66.html#X86E2ADEA784AD163"><span class="RefLink">66.17</span></a>). The function takes two monomials <var class="Arg">a</var> and <var class="Arg">b</var> in expanded form and returns whether the first is smaller than the second. (This ordering is also used by <strong class="pkg">GAP</strong> internally for representing polynomials as a linear combination of monomials.)</p>

<p>See section <a href="chap66.html#X7F44CF87801DB965"><span class="RefLink">66.21</span></a> for details on the expanded form of monomials.</p>

<p><a id="X79BAB2937E6085D6" name="X79BAB2937E6085D6"></a></p>

<h4>66.18 <span class="Heading">Groebner Bases</span></h4>

<p>A <em>Groebner Basis</em> of an ideal <span class="SimpleMath">I</span>i, in a polynomial ring <span class="SimpleMath">R</span>, with respect to a monomial ordering, is a set of ideal generators <var class="Arg">G</var> such that the ideal generated by the leading monomials of all polynomials in <var class="Arg">G</var> is equal to the ideal generated by the leading monomials of all polynomials in <var class="Arg">I</var>.</p>

<p>For more details on Groebner bases see <a href="chapBib.html#biBcoxlittleoshea">[CLO97]</a>.</p>

<p><a id="X7A43611E876B7560" name="X7A43611E876B7560"></a></p>

<h5>66.18-1 <span class="Heading">GroebnerBasis</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GroebnerBasis</code>( <var class="Arg">L</var>, <var class="Arg">O</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GroebnerBasis</code>( <var class="Arg">I</var>, <var class="Arg">O</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GroebnerBasisNC</code>( <var class="Arg">L</var>, <var class="Arg">O</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">O</var> be a monomial ordering and <var class="Arg">L</var> be a list of polynomials that generate an ideal <var class="Arg">I</var>. This operation returns a Groebner basis of <var class="Arg">I</var> with respect to the ordering <var class="Arg">O</var>.</p>

<p><code class="func">GroebnerBasisNC</code> works like <code class="func">GroebnerBasis</code> with the only distinction that the first argument has to be a list of polynomials and that no test is performed to check whether the ordering is defined for all occuring variables.</p>

<p>Note that <strong class="pkg">GAP</strong> at the moment only includes a naïve implementation of Buchberger's algorithm (which is mainly intended as a teaching tool). It might not be sufficient for serious problems.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[x^2+y^2+z^2-1,x^2+z^2-y,x-y];;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GroebnerBasis(l,MonomialLexOrdering());</span>
[ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1, 
  1/2*z^4+2*z^2-1/2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GroebnerBasis(l,MonomialLexOrdering([z,x,y]));</span>
[ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GroebnerBasis(l,MonomialGrlexOrdering());</span>
[ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1 ]
</pre></div>

<p><a id="X7DEF286384967C9E" name="X7DEF286384967C9E"></a></p>

<h5>66.18-2 <span class="Heading">ReducedGroebnerBasis</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReducedGroebnerBasis</code>( <var class="Arg">L</var>, <var class="Arg">O</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReducedGroebnerBasis</code>( <var class="Arg">I</var>, <var class="Arg">O</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>a Groebner basis <span class="SimpleMath">B</span> (see <code class="func">GroebnerBasis</code> (<a href="chap66.html#X7A43611E876B7560"><span class="RefLink">66.18-1</span></a>)) is <em>reduced</em> if no monomial in a polynomial in <var class="Arg">B</var> is divisible by the leading monomial of another polynomial in <span class="SimpleMath">B</span>. This operation computes a Groebner basis with respect to the monomial ordering <var class="Arg">O</var> and then reduces it.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ReducedGroebnerBasis(l,MonomialGrlexOrdering());</span>
[ x-y, z^2-2*y+1, y^2+y-1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ReducedGroebnerBasis(l,MonomialLexOrdering());    </span>
[ z^4+4*z^2-1, -1/2*z^2+y-1/2, -1/2*z^2+x-1/2 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ReducedGroebnerBasis(l,MonomialLexOrdering([y,z,x]));</span>
[ x^2+x-1, z^2-2*x+1, -x+y ]
</pre></div>

<p>For performance reasons it can be advantageous to define monomial orderings once and then to reuse them:</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ord:=MonomialGrlexOrdering();;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GroebnerBasis(l,ord);</span>
[ x^2+y^2+z^2-1, x^2+z^2-y, x-y, -y^2-y+1, -z^2+2*y-1 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ReducedGroebnerBasis(l,ord);</span>
[ x-y, z^2-2*y+1, y^2+y-1 ]
</pre></div>

<p><a id="X7FC1EFE78498C17C" name="X7FC1EFE78498C17C"></a></p>

<h5>66.18-3 StoredGroebnerBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StoredGroebnerBasis</code>( <var class="Arg">I</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For an ideal <var class="Arg">I</var> in a polynomial ring, this attribute holds a list <span class="SimpleMath">[ B, O ]</span> where <span class="SimpleMath">B</span> is a Groebner basis for the monomial ordering <span class="SimpleMath">O</span>. this can be used to test membership or canonical coset representatives.</p>

<p><a id="X7C55702786D284A7" name="X7C55702786D284A7"></a></p>

<h5>66.18-4 InfoGroebner</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoGroebner</code></td><td class="tdright">( info class )</td></tr></table></div>
<p>This info class gives information about Groebner basis calculations.</p>

<p><a id="X8113DD9B781CA6C1" name="X8113DD9B781CA6C1"></a></p>

<h4>66.19 <span class="Heading">Rational Function Families</span></h4>

<p>All rational functions defined over a ring lie in the same family, the rational functions family over this ring.</p>

<p>In <strong class="pkg">GAP</strong> therefore the family of a polynomial depends only on the family of the coefficients, all polynomials whose coefficients lie in the same family are "compatible".</p>

<p><a id="X855DD73C78A90BC3" name="X855DD73C78A90BC3"></a></p>

<h5>66.19-1 RationalFunctionsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RationalFunctionsFamily</code>( <var class="Arg">fam</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>creates a family containing rational functions with coefficients in <var class="Arg">fam</var>. All elements of the <code class="func">RationalFunctionsFamily</code> are rational functions (see <code class="func">IsRationalFunction</code> (<a href="chap66.html#X86C92F677DA9347F"><span class="RefLink">66.4-1</span></a>)).</p>

<p><a id="X86E097307D188D3B" name="X86E097307D188D3B"></a></p>

<h5>66.19-2 IsPolynomialFunctionsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPolynomialFunctionsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRationalFunctionsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p><code class="func">IsPolynomialFunctionsFamily</code> is the category of a family of polynomials. For families over an UFD, the category becomes <code class="func">IsRationalFunctionsFamily</code> (as rational functions and quotients are only provided for families over an UFD.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">fam:=RationalFunctionsFamily(FamilyObj(1));</span>
NewFamily( "RationalFunctionsFamily(...)", [ 618, 620 ],
[ 82, 85, 89, 93, 97, 100, 103, 107, 111, 618, 620 ] )
</pre></div>

<p><a id="X7AADCA45826866FB" name="X7AADCA45826866FB"></a></p>

<h5>66.19-3 CoefficientsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoefficientsFamily</code>( <var class="Arg">rffam</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If <var class="Arg">rffam</var> has been created as <code class="code">RationalFunctionsFamily(<var class="Arg">cfam</var>)</code> this attribute holds the coefficients family <var class="Arg">cfam</var>.</p>

<p><strong class="pkg">GAP</strong> does <em>not</em> embed the base ring in the polynomial ring. While multiplication and addition of base ring elements to rational functions return the expected results, polynomials and rational functions are not equal.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">1=Indeterminate(Rationals)^0;</span>
false
</pre></div>

<p><a id="X7E360788785DE530" name="X7E360788785DE530"></a></p>

<h4>66.20 <span class="Heading">The Representations of Rational Functions</span></h4>

<p><strong class="pkg">GAP</strong> 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>

<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 <a href="chap66.html#X7D871EA180E9486C"><span class="RefLink">66.4</span></a> will find this out.</p>

<p>Each representation is associated one or several "defining attributes" that give an "external" representation (see <a href="chap66.html#X7F44CF87801DB965"><span class="RefLink">66.21</span></a>) of the representation in the form of lists and are the defining information that tells a rational function what it is.</p>

<p><strong class="pkg">GAP</strong> also implements methods to compute these attributes for rational functions in <em>other</em> representations, provided it would be possible to express an <em>mathematically equal</em> 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>

<p>Therefore these attributes can be thought of as "conceptual" representations that allow us –as far as possible– 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>

<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>

<p>Consequentially, methods for rational functions are installed for properties and not for representations.</p>

<p>When <em>creating</em> 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 "conceptual" representation in which the calculation was done is the defining attribute.</p>

<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.</p>

<p><a id="X7F44CF87801DB965" name="X7F44CF87801DB965"></a></p>

<h4>66.21 <span class="Heading">The Defining Attributes of Rational Functions</span></h4>

<p>In general, rational functions are given in terms of monomials. They are represented by lists, using numbers (see <a href="chap66.html#X7A8FADCD875826DA"><span class="RefLink">66.1</span></a>) for the indeterminates.</p>

<p>A monomial is a product of powers of indeterminates. A monomial is stored as a list (we call this the <em>expanded form</em> of the monomial) of the form <code class="code">[<var class="Arg">inum</var>,<var class="Arg">exp</var>,<var class="Arg">inum</var>,<var class="Arg">exp</var>,...]</code> where each <var class="Arg">inum</var> is the number of an indeterminate and <var class="Arg">exp</var> the corresponding exponent. The list must be sorted according to the numbers of the indeterminates. Thus for example, if <span class="SimpleMath">x</span>, <span class="SimpleMath">y</span> and <span class="SimpleMath">z</span> are the first three indeterminates, the expanded form of the monomial <span class="SimpleMath">x^5 z^8 = z^8 x^5</span> is <code class="code">[ 1, 5, 3, 8 ]</code>. The representation of a polynomials is a list of the form <code class="code">[<var class="Arg">mon</var>,<var class="Arg">coeff</var>,<var class="Arg">mon</var>,<var class="Arg">coeff</var>,...]</code> where <var class="Arg">mon</var> is a monomial in expanded form (that is given as list) and <var class="Arg">coeff</var> its coefficient. The monomials must be sorted according to the total degree/lexicographic order (This is the same as given by the "grlex" monomial ordering, see <code class="func">MonomialGrlexOrdering</code> (<a href="chap66.html#X786C866C824D2688"><span class="RefLink">66.17-8</span></a>)). We call this the <em>external representation</em> of a polynomial. (The reason for ordering is that addition of polynomials becomes linear in the number of monomials instead of quadratic; the reason for the particular ordering chose is that it is compatible with multiplication and thus gives acceptable performance for quotient calculations.)</p>

<p>The attributes that give a representation of a a rational function as a Laurent polynomial are <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>) and <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>).</p>

<p>Algorithms should use only the attributes <code class="func">ExtRepNumeratorRatFun</code> (<a href="chap66.html#X7DF955C87CBFC12B"><span class="RefLink">66.21-2</span></a>), <code class="func">ExtRepDenominatorRatFun</code> (<a href="chap66.html#X8059E74D7DCABDBC"><span class="RefLink">66.21-3</span></a>), <code class="func">ExtRepPolynomialRatFun</code> (<a href="chap66.html#X8406EE2E8775FBAB"><span class="RefLink">66.21-6</span></a>), <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>) and –if the univariate function is not constant– <code class="func">IndeterminateNumberOfUnivariateRationalFunction</code> (<a href="chap66.html#X816C8D797C804380"><span class="RefLink">66.1-2</span></a>) as the low-level interface to work with a polynomial. They should not refer to the actual representation used.</p>

<p><a id="X791E16C67A352263" name="X791E16C67A352263"></a></p>

<h5>66.21-1 IsRationalFunctionDefaultRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRationalFunctionDefaultRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>is the default representation of rational functions. A rational function in this representation is defined by the attributes <code class="func">ExtRepNumeratorRatFun</code> (<a href="chap66.html#X7DF955C87CBFC12B"><span class="RefLink">66.21-2</span></a>) and <code class="func">ExtRepDenominatorRatFun</code> (<a href="chap66.html#X8059E74D7DCABDBC"><span class="RefLink">66.21-3</span></a>), the values of which are external representations of polynomials.</p>

<p><a id="X7DF955C87CBFC12B" name="X7DF955C87CBFC12B"></a></p>

<h5>66.21-2 ExtRepNumeratorRatFun</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExtRepNumeratorRatFun</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the external representation of the numerator polynomial of the rational function <var class="Arg">ratfun</var>. Numerator and denominator are not guaranteed to be cancelled against each other.</p>

<p><a id="X8059E74D7DCABDBC" name="X8059E74D7DCABDBC"></a></p>

<h5>66.21-3 ExtRepDenominatorRatFun</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExtRepDenominatorRatFun</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the external representation of the denominator polynomial of the rational function <var class="Arg">ratfun</var>. Numerator and denominator are not guaranteed to be cancelled against each other.</p>

<p><a id="X84F546F87B5ECFE0" name="X84F546F87B5ECFE0"></a></p>

<h5>66.21-4 ZeroCoefficientRatFun</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ZeroCoefficientRatFun</code>( <var class="Arg">ratfun</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the zero of the coefficient ring. This might be needed to represent the zero polynomial for which the external representation of the numerator is the empty list.</p>

<p><a id="X833CE16579AB26E0" name="X833CE16579AB26E0"></a></p>

<h5>66.21-5 IsPolynomialDefaultRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPolynomialDefaultRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>is the default representation of polynomials. A polynomial in this representation is defined by the components and <code class="func">ExtRepNumeratorRatFun</code> (<a href="chap66.html#X7DF955C87CBFC12B"><span class="RefLink">66.21-2</span></a>) where <code class="func">ExtRepNumeratorRatFun</code> (<a href="chap66.html#X7DF955C87CBFC12B"><span class="RefLink">66.21-2</span></a>) is the external representation of the polynomial.</p>

<p><a id="X8406EE2E8775FBAB" name="X8406EE2E8775FBAB"></a></p>

<h5>66.21-6 ExtRepPolynomialRatFun</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExtRepPolynomialRatFun</code>( <var class="Arg">polynomial</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the external representation of a polynomial. The difference to <code class="func">ExtRepNumeratorRatFun</code> (<a href="chap66.html#X7DF955C87CBFC12B"><span class="RefLink">66.21-2</span></a>) is that rational functions might know to be a polynomial but can still have a non-vanishing denominator. In this case <code class="func">ExtRepPolynomialRatFun</code> has to call a quotient routine.</p>

<p><a id="X7E1B98CC7BADAF56" name="X7E1B98CC7BADAF56"></a></p>

<h5>66.21-7 IsLaurentPolynomialDefaultRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsLaurentPolynomialDefaultRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>This representation is used for Laurent polynomials and univariate polynomials. It represents a Laurent polynomial via the attributes <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>) and <code class="func">IndeterminateNumberOfLaurentPolynomial</code> (<a href="chap66.html#X8381E1B582F38C85"><span class="RefLink">66.13-3</span></a>).</p>

<p><a id="X791FADD278A2F32F" name="X791FADD278A2F32F"></a></p>

<h4>66.22 <span class="Heading">Creation of Rational Functions</span></h4>

<p>The operations <code class="func">LaurentPolynomialByCoefficients</code> (<a href="chap66.html#X8467263B7EFA013E"><span class="RefLink">66.13-1</span></a>), <code class="func">PolynomialByExtRep</code> (<a href="chap66.html#X79E445AF7849F48A"><span class="RefLink">66.22-2</span></a>) and <code class="func">RationalFunctionByExtRep</code> (<a href="chap66.html#X81297E4587A9F2A6"><span class="RefLink">66.22-1</span></a>) are used to construct objects in the three basic representations for rational functions.</p>

<p><a id="X81297E4587A9F2A6" name="X81297E4587A9F2A6"></a></p>

<h5>66.22-1 RationalFunctionByExtRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RationalFunctionByExtRep</code>( <var class="Arg">rfam</var>, <var class="Arg">num</var>, <var class="Arg">den</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RationalFunctionByExtRepNC</code>( <var class="Arg">rfam</var>, <var class="Arg">num</var>, <var class="Arg">den</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>constructs a rational function (in the representation <code class="func">IsRationalFunctionDefaultRep</code> (<a href="chap66.html#X791E16C67A352263"><span class="RefLink">66.21-1</span></a>)) in the rational function family <var class="Arg">rfam</var>, the rational function itself is given by the external representations <var class="Arg">num</var> and <var class="Arg">den</var> for numerator and denominator. No cancellation takes place.</p>

<p>The variant <code class="func">RationalFunctionByExtRepNC</code> does not perform any test of the arguments and thus potentially can create illegal objects. It only should be used if speed is required and the arguments are known to be in correct form.</p>

<p><a id="X79E445AF7849F48A" name="X79E445AF7849F48A"></a></p>

<h5>66.22-2 PolynomialByExtRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialByExtRep</code>( <var class="Arg">rfam</var>, <var class="Arg">extrep</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PolynomialByExtRepNC</code>( <var class="Arg">rfam</var>, <var class="Arg">extrep</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>constructs a polynomial (in the representation <code class="func">IsPolynomialDefaultRep</code> (<a href="chap66.html#X833CE16579AB26E0"><span class="RefLink">66.21-5</span></a>)) in the rational function family <var class="Arg">rfam</var>, the polynomial itself is given by the external representation <var class="Arg">extrep</var>.</p>

<p>The variant <code class="func">PolynomialByExtRepNC</code> does not perform any test of the arguments and thus potentially can create invalid objects. It only should be used if speed is required and the arguments are known to be in correct form.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">fam:=RationalFunctionsFamily(FamilyObj(1));;</span>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">p:=PolynomialByExtRep(fam,[[1,2],1,[2,1,15,7],3]);</span>
3*y*x_15^7+x^2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">q:=p/(p+1);</span>
(3*y*x_15^7+x^2)/(3*y*x_15^7+x^2+1)
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ExtRepNumeratorRatFun(q);</span>
[ [ 1, 2 ], 1, [ 2, 1, 15, 7 ], 3 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ExtRepDenominatorRatFun(q);</span>
[ [  ], 1, [ 1, 2 ], 1, [ 2, 1, 15, 7 ], 3 ]
</pre></div>

<p><a id="X7E2A46D68472F492" name="X7E2A46D68472F492"></a></p>

<h5>66.22-3 LaurentPolynomialByExtRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LaurentPolynomialByExtRep</code>( <var class="Arg">fam</var>, <var class="Arg">cofs</var>, <var class="Arg">val</var>, <var class="Arg">ind</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LaurentPolynomialByExtRepNC</code>( <var class="Arg">fam</var>, <var class="Arg">cofs</var>, <var class="Arg">val</var>, <var class="Arg">ind</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>creates a Laurent polynomial in the family <var class="Arg">fam</var> with [<var class="Arg">cofs</var>,<var class="Arg">val</var>] as value of <code class="func">CoefficientsOfLaurentPolynomial</code> (<a href="chap66.html#X86D58AB67F86469F"><span class="RefLink">66.13-2</span></a>). No coefficient shifting is performed. This is the lowest level function to create a Laurent polynomial but will rely on the coefficients being shifted properly and will not perform any tests. Unless this is guaranteed for the parameters, <code class="func">LaurentPolynomialByCoefficients</code> (<a href="chap66.html#X8467263B7EFA013E"><span class="RefLink">66.13-1</span></a>) should be used.</p>

<p><a id="X809028CD7C0EA7CE" name="X809028CD7C0EA7CE"></a></p>

<h4>66.23 <span class="Heading">Arithmetic for External Representations of Polynomials</span></h4>

<p>The following operations are used internally to perform the arithmetic for polynomials in their "external" representation (see <a href="chap66.html#X7F44CF87801DB965"><span class="RefLink">66.21</span></a>) as lists.</p>

<p>Functions to perform arithmetic with the coefficient lists of Laurent polynomials are described in Section <a href="chap23.html#X85C68AED805E4B9C"><span class="RefLink">23.4</span></a>.</p>

<p><a id="X855094857A78ABF9" name="X855094857A78ABF9"></a></p>

<h5>66.23-1 ZippedSum</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ZippedSum</code>( <var class="Arg">z1</var>, <var class="Arg">z2</var>, <var class="Arg">czero</var>, <var class="Arg">funcs</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>computes the sum of two external representations of polynomials <var class="Arg">z1</var> and <var class="Arg">z2</var>. <var class="Arg">czero</var> is the appropriate coefficient zero and <var class="Arg">funcs</var> a list [ <var class="Arg">monomial_less</var>, <var class="Arg">coefficient_sum</var> ] containing a monomial comparison and a coefficient addition function. This list can be found in the component <var class="Arg">fam</var><code class="code">!.zippedSum</code> of the rational functions family.</p>

<p>Note that <var class="Arg">coefficient_sum</var> must be a proper "summation" function, not a function computing differences.</p>

<p><a id="X7B911136782F0F6D" name="X7B911136782F0F6D"></a></p>

<h5>66.23-2 ZippedProduct</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ZippedProduct</code>( <var class="Arg">z1</var>, <var class="Arg">z2</var>, <var class="Arg">czero</var>, <var class="Arg">funcs</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>computes the product of two external representations of polynomials <var class="Arg">z1</var> and <var class="Arg">z2</var>. <var class="Arg">czero</var> is the appropriate coefficient zero and <var class="Arg">funcs</var> a list [ <var class="Arg">monomial_prod</var>, <var class="Arg">monomial_less</var>, <var class="Arg">coefficient_sum</var>, <var class="Arg">coefficient_prod</var>] containing functions to multiply and compare monomials, to add and to multiply coefficients. This list can be found in the component <code class="code"><var class="Arg">fam</var>!.zippedProduct</code> of the rational functions family.</p>

<p><a id="X87E5EB8985AF04CD" name="X87E5EB8985AF04CD"></a></p>

<h5>66.23-3 QuotientPolynomialsExtRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; QuotientPolynomialsExtRep</code>( <var class="Arg">fam</var>, <var class="Arg">a</var>, <var class="Arg">b</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Let <var class="Arg">a</var> and <var class="Arg">b</var> the external representations of two polynomials in the rational functions family <var class="Arg">fam</var>. This function computes the external representation of the quotient of both polynomials, it returns <code class="keyw">fail</code> if the polynomial described by <var class="Arg">b</var> does not divide the polynomial described by <var class="Arg">a</var>.</p>

<p><a id="X811B7D8E79E4BD46" name="X811B7D8E79E4BD46"></a></p>

<h4>66.24 <span class="Heading">Cancellation Tests for Rational Functions</span></h4>

<p>The operation <code class="func">Gcd</code> (<a href="chap56.html#X7DE207718456F98F"><span class="RefLink">56.7-1</span></a>) 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</p>

<p><a id="X878A1AC87B492E3D" name="X878A1AC87B492E3D"></a></p>

<h5>66.24-1 RationalFunctionByExtRepWithCancellation</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RationalFunctionByExtRepWithCancellation</code>( <var class="Arg">rfam</var>, <var class="Arg">num</var>, <var class="Arg">den</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>constructs a rational function as <code class="func">RationalFunctionByExtRep</code> (<a href="chap66.html#X81297E4587A9F2A6"><span class="RefLink">66.22-1</span></a>) does but tries to cancel out common factors of numerator and denominator, calling <code class="func">TryGcdCancelExtRepPolynomials</code> (<a href="chap66.html#X7BFB55887A153003"><span class="RefLink">66.24-2</span></a>).</p>

<p><a id="X7BFB55887A153003" name="X7BFB55887A153003"></a></p>

<h5>66.24-2 TryGcdCancelExtRepPolynomials</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TryGcdCancelExtRepPolynomials</code>( <var class="Arg">fam</var>, <var class="Arg">a</var>, <var class="Arg">b</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Let <var class="Arg">a</var> and <var class="Arg">b</var> be the external representations of two polynomials. This function tries to cancel common factors between the corresponding polynomials and returns a list <span class="SimpleMath">[ a', b' ]</span> of external representations of cancelled polynomials. As there is no proper multivariate GCD cancellation is not guaranteed to be optimal.</p>

<p><a id="X81CC7D9B819A9332" name="X81CC7D9B819A9332"></a></p>

<h5>66.24-3 HeuristicCancelPolynomials</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; HeuristicCancelPolynomials</code>( <var class="Arg">fam</var>, <var class="Arg">ext1</var>, <var class="Arg">ext2</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>is called by <code class="func">TryGcdCancelExtRepPolynomials</code> (<a href="chap66.html#X7BFB55887A153003"><span class="RefLink">66.24-2</span></a>) to perform the actual work. It will return either <code class="keyw">fail</code> or a new list of of external representations of cancelled polynomials. The cancellation performed is not necessarily optimal.</p>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap65.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap67.html">[Next Chapter]</a>&nbsp;  </div>


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>