[go: up one dir, main page]

Menu

[9a0086]: / man / man3 / Polynomial.3  Maximize  Restore  History

Download this file

2415 lines (2371 with data), 45.1 kB

   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
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
.TH "polynom" 3 "Mar 12, 2023"
.SH Polynomial
.PP
.B
Inherits from:
CAObject
.PP
.B
Maturity Index:
Relatively mature
.SH Class Description
.PP
Polynomials are sums of products of
.I
scalar
objects and
.I
symbols
raised to small, non-negative integer
.I
exponents
\&. The scalars and symbols can be arbitrary Computer Algebra Kit objects\&. Polynomial supports arithmetic over floating-point scalars, or elements of a field (see
.B
inField
), or scalars that are elements of an integral domain (see
.B
inIntegralDomain
)\&.
.SH Representations
.PP
All together, the Polynomial object presents eight different representations for polynomial arithmetic\&. A
.I
recursive
polynomial is a sum of
.I
terms
, where each term consists of a
.I
coefficient
, that is either a scalar object or again a polynomial, multiplied by a symbol raised to an exponent (see
.B
Term
)\&. An
.I
expanded
polynomial is a sum of
.I
monomials
, each monomial consists of a
.I
scalar
multiplied by a product of terms (see
.B
Monomial
)\&. If the polynomial is
.I
variable dense
, the collection of possible symbols is fixed and symbols raised to the exponent zero are internally stored; if the polynomial is
.I
variable sparse
, it\&'s not defined a priori what symbols are allowed to occur in the polynomial\&. A polynomial can be either
.I
degree dense
or
.I
degree sparse
\&. If the polynomial is degree dense, terms or monomials can have a zero coefficient, otherwise the polynomial is internally stored as a linked list of non-zero terms or monomials\&.
.PP
As an example, consider the recursive polynomial in two variables (2
.I
x
^2 + 1)
.I
y
^3 +
.I
x
.I
y
; it\&'s a sum of two terms\&. The same polynomial in expanded representation is the sum of three monomials : 2
.I
x
^2
.I
y
^3 +
.I
y
^3 +
.I
x
.I
y
\&.
.PP
Not all representations are implemented\&. Some representations (notably the variable sparse ones) are implemented in Objective C, and can already be used, but may be slow\&. The following table summarizes the current state of implementation of Polynomial :
.RS 3
.br
* variable sparse, recursive and degree sparse : temporary implementation
.br
* variable sparse, recursive and degree dense : not implemented
.br
* variable dense, recursive and degree sparse : implemented over objects, integers and integers modulo a small prime
.br
* variable dense, recursive and degree dense : implemented over objects, integers and integers modulo a small prime
.br
* variable sparse, expanded and degree sparse : temporary implementation
.br
* variable sparse, expanded and degree dense : not implemented
.br
* variable dense, expanded and degree sparse : implemented over objects, integers and integers modulo a small prime
.br
* variable dense, expanded and degree dense : not implemented
.RE
.PP
Depending on the type of algorithm you\&'re implementing or using, a different representation is preferred\&. The variable dense representation for polynomials of \&'high\&' degree in \&'few\&' variables\&. The variable sparse representation for polynomials of \&'small\&' degree in \&'many\&' variables\&. Degree dense polynomials over finite fields perform well in factorization problems\&. Degree sparse polynomials are preferred when there are many zero coefficients in the polynomial\&. The expanded representation is used in the computation of Groebner bases, recursive polynomials are preferred for greatest common divisors, resultants etc\&.
.SH Symbols and Variable Ordering
.PP
.B
Note:
Symbols can be arbitrary objects\&. Any object that implements
.B
isEqual:
, and for variable sparse polynomials,
.B
compare:
, will serve (in the variable dense case it\&'s not necessary to compare symbols because the ordering is fixed by the collection of symbols)\&. We always refer to the objects in question as
.I
symbols
, even when they are not instances of the
.B
Symbol
class\&.
.PP
For a variable dense polynomial, the collection of symbols is fixed when the monomial is created; you can\&'t insert terms in a different symbol\&. In the variable sparse case, the collection of symbols is dynamically adapted as you insert terms, but is kept sorted alphabetically\&. Note that in the variable dense case, the collection of symbols contains the actual set of symbols (those that actually occur in the polynomial with nonzero exponent) as a
.I
subset
\&. See the documentation on
.B
symbols
\&. The variable ordering imposed by the collection of symbols is called
.I
lexicographic
(currently the variable ordering is always lexicographic)\&. Note that in the variable dense case, the lexicographic order need not be alphabetical\&.
.SH Accessing Terms and Monomials in a Polynomial
.PP
The methods
.B
eachTerm
,
.B
removeTerm
and
.B
insertTerm:
apply to recursive polynomials\&. For example, to obtain a collection of
.I
non-zero
terms from a polynomial :
.RS 3
while (aTerm = [aRecursivePolynomial removeTerm]) [aCollection add:aTerm];
.br
.RE
.PP
If the polynomial is variable sparse, the coefficients of the terms are either scalar objects or again variable sparse polynomials and each symbol can be different\&. If the polynomial is variable dense, all symbols of all terms are equal, and the coefficients are either all scalar objects or again all variable dense polynomials\&. In a degree dense polynomial, the coefficients of the terms can be zero;
.B
eachTerm
might in effect return a zero term\&. It never does so for a degree sparse polynomial\&.
.PP
The methods
.B
eachMonomial
,
.B
removeMonomial
and
.B
insertMonomial:
apply to polynomials in expanded representation\&. For example, to obtain a collection of monomials from a polynomial :
.RS 3
aSequence = [anExpandedPolynomial eachMonomial];
.br
while (aMonomial = [aSequence next]) [aCollection add:aMonomial];
.br
.RE
.PP
The coefficients of the monomials are scalar objects\&. If the polynomial is variable sparse, the monomials are too\&. For degree dense polynomials
.B
eachMonomial
also returns monomials with a zero coefficient\&. The leading monomial, returned by
.B
removeMonomial
is never zero\&.
.SH Greatest Common Divisors
.PP
There is an implementation of an algorithm to compute the GCD of (multivariate) polynomials\&. For univariate polynomials over a field, the Euclidean algorithm is being used\&. See
.B
gcd:
for more details\&.
.SH Counting Real Roots
.PP
Polynomial implements for univariate polynomials with coefficients taken from an ordered domain (such as the integers) an algorithm to count the (total) number of real roots of the polynomial\&. See the documentation on
.B
numRealRoots
\&.
.SH Factorization
.PP
Polynomial implements a method to factor a polynomial into its squarefree parts, over fields or integral domains (zero or non-zero characteristic)\&. See
.B
factorSquareFree
for more details\&. There is also an implementation of an algorithm to factor a polynomial over a finite field into its irreducible factors\&. See the documentation on
.B
factor
\&.
.SH Method types
.PP
.B
Creation
.RS 3
.br
* scalar:
.br
* copy
.br
* deepCopy
.br
* empty
.RE
.PP
.B
Identity
.RS 3
.br
* scalarZero
.br
* termZero
.br
* monomialZero
.br
* hash
.br
* isEqual:
.br
* isRecursive
.br
* isExpanded
.br
* isVariableSparse
.br
* isVariableDense
.br
* isDegreeDense
.br
* isDegreeSparse
.br
* isUnivariate
.br
* inUnivariateDomain
.br
* isMultivariate
.RE
.PP
.B
Coercion
.RS 3
.br
* intValue
.br
* intValue:
.br
* floatValue
.br
* floatValue:
.br
* asScalar
.br
* asSymbol
.br
* asTerm
.br
* asMonomial
.br
* asCoefficient
.br
* asNumerical
.br
* asModp:
.RE
.PP
.B
Symbols and Variables
.RS 3
.br
* symbols
.RE
.PP
.B
Degree and Order
.RS 3
.br
* degree
.br
* order
.RE
.PP
.B
Number of Terms and Monomials
.RS 3
.br
* numTerms
.br
* numMonomials
.RE
.PP
.B
Removing and Inserting
.RS 3
.br
* removeTerm
.br
* insertTerm:
.br
* removeMonomial
.br
* insertMonomial:
.RE
.PP
.B
Sequences
.RS 3
.br
* eachTerm
.br
* eachMonomial
.br
* eachSequence
.br
* eachScalar
.br
* eachCoefficient
.RE
.PP
.B
Representation
.RS 3
.br
* makeDegreeDense
.br
* makeDegreeSparse
.br
* makeRecursive
.br
* makeExpanded
.br
* makeVariableSparse
.br
* makeVariableDense
.br
* collect:
.RE
.PP
.B
Leading Term or Monomial
.RS 3
.br
* leadingTerm
.br
* leadingCoefficient
.br
* leadingSign
.br
* leadingMonomial
.br
* leadingScalar
.RE
.PP
.B
Monic Polynomials
.RS 3
.br
* isMonic
.br
* notMonic
.br
* makeMonic
.RE
.PP
.B
Addition
.RS 3
.br
* zero
.br
* isZero
.br
* isOpposite:
.br
* negate
.br
* double
.br
* add:
.br
* subtract:
.br
* addScalar:
.br
* subtractScalar:
.RE
.PP
.B
Multiplication
.RS 3
.br
* one
.br
* isOne
.br
* isMinusOne
.br
* multiply:
.br
* square
.br
* inverse
.br
* multiplyScalar:
.br
* divideScalar:
.br
* multiplyCoefficient:
.br
* divideCoefficient:
.br
* multiplyTerm:
.br
* divideTerm:
.br
* multiplyMonomial:
.br
* divideMonomial:
.RE
.PP
.B
Polynomial Division
.RS 3
.br
* remainder:quotient:
.br
* divide:
.RE
.PP
.B
Pseudo Division
.RS 3
.br
* pseudoRemainder:quotient:
.br
* pseudoRemainder:
.RE
.PP
.B
Contents and Primitive Parts
.RS 3
.br
* content
.br
* divideContent
.br
* coefficientContent
.br
* divideCoefficientContent
.br
* termContent
.br
* monomialContent
.RE
.PP
.B
Resultant and Greatest Common Divisor
.RS 3
.br
* gcd:
.br
* resultant:
.br
* resultant:wrt:
.br
* discriminant
.RE
.PP
.B
Counting Real Roots
.RS 3
.br
* numRealRoots
.br
* varRealRoots:
.RE
.PP
.B
Factoring
.RS 3
.br
* isSquareFree
.br
* factorSquareFree
.RE
.PP
.B
Truncation
.RS 3
.br
* truncateAtDegree:
.RE
.PP
.B
Characteristic
.RS 3
.br
* frobenius
.br
* frobeniusInverse
.RE
.PP
.B
Evaluation and Substitution
.RS 3
.br
* evaluate:
.br
* evaluate:at:
.br
* evaluateAll:
.br
* substitute:
.br
* substitute:by:
.br
* substituteAll:
.RE
.PP
.B
Derivation and Integration
.RS 3
.br
* derive
.br
* deriveWrt:
.br
* integrate
.br
* integrateWrt:
.RE
.PP
.B
Printing
.RS 3
.br
* printsLeadingSign
.br
* printsSum
.br
* printsProduct
.br
* printOn:
.RE
.SH Methods
.PP
scalar:
.RS 1
+
.B
scalar
:
.I
aScalar
.RE
.PP
Creates and returns a polynomial in the recursive, variable sparse and degree sparse representation, containing the scalar object
.I
aScalar
\&.
.PP
copy
.RS 1
-
.B
copy
.RE
.PP
Makes a copy of all the terms or monomials of the polynomial\&. The original polynomial and the copy don\&'t share any terms or monomials\&.
.PP
deepCopy
.RS 1
-
.B
deepCopy
.RE
.PP
Makes a full independent copy of the polynomial by copying all terms or monomials and by sending
.B
deepCopy
messages to the scalar objects\&. The original polynomial and the copy don\&'t share any scalars, terms or monomials\&.
.PP
empty
.RS 1
-
.B
empty
.RE
.PP
Returns a new empty polynomial i\&.e\&. a polynomial that is equal to zero and not a copy of another polynomial\&. The representation of the new polynomial is the same as the representation of the object that received the message\&.
.PP
scalarZero
.RS 1
-
.B
scalarZero
.RE
.PP
Returns the zero (base) scalar element\&.
.PP
termZero
.RS 1
-
.B
termZero
.RE
.PP
Returns the zero term for a recursive polynomial\&. In the variable dense case, you may depend upon the fact that the symbol of this term is set to the main symbol of the polynomial (the exponent is set to one)\&.
.PP
monomialZero
.RS 1
-
.B
monomialZero
.RE
.PP
Returns the zero monomial for an expanded polynomial\&.
.PP
hash
.RS 1
- (
unsigned
)
.B
hash
.RE
.PP
Returns a small integer that is the same for objects that are equal (in the sense of
.B
isEqual:
)\&.
.PP
isEqual:
.RS 1
- (
BOOL
)
.B
isEqual
:
.I
b
.RE
.PP
Whether the two objects are equal\&. Returns YES if the objects are pointer equal\&.
.PP
isRecursive
.RS 1
- (
BOOL
)
.B
isRecursive
.RE
.PP
Returns YES if the polynomial is in recursive representation\&. Implies that the polynomial is not in expanded representation\&.
.PP
isExpanded
.RS 1
- (
BOOL
)
.B
isExpanded
.RE
.PP
Returns YES if the polynomial is in expanded representation\&. Implies that the polynomial is not in recursive representation\&.
.PP
isVariableSparse
.RS 1
- (
BOOL
)
.B
isVariableSparse
.RE
.PP
Returns YES if the polynomial is variable sparse\&. Implies that the polynomial is not variable dense\&.
.PP
isVariableDense
.RS 1
- (
BOOL
)
.B
isVariableDense
.RE
.PP
Returns YES if the polynomial is variable dense\&. Implies that the polynomial is not variable sparse\&.
.PP
isDegreeDense
.RS 1
- (
BOOL
)
.B
isDegreeDense
.RE
.PP
Returns YES if the polynomial is degree dense\&. Implies that the polynomial is not degree sparse\&.
.PP
isDegreeSparse
.RS 1
- (
BOOL
)
.B
isDegreeSparse
.RE
.PP
Returns YES if the polynomial is degree sparse\&. Implies that the polynomial is not degree dense\&.
.PP
isUnivariate
.RS 1
- (
BOOL
)
.B
isUnivariate
.RE
.PP
Whether the number of symbols equals one\&.
.PP
inUnivariateDomain
.RS 1
- (
BOOL
)
.B
inUnivariateDomain
.RE
.PP
Whether the polynomial is variable dense and the number of symbols equals one\&.
.PP
isMultivariate
.RS 1
- (
BOOL
)
.B
isMultivariate
.RE
.PP
intValue
.RS 1
- (
int
)
.B
intValue
.RE
.PP
Returns zero if the polynomial is zero\&. If the polynomial consists of a single term or monomial, returns the int value of that object\&. Otherwise generates an error\&.
.PP
intValue:
.RS 1
-
.B
intValue
:(int)
.I
aValue
.RE
.PP
Returns a polynomial (of the same representation as the polynomial that receives the message) with value equal to
.I
aValue
\&.
.PP
floatValue
.RS 1
- (
float
)
.B
floatValue
.RE
.PP
Returns zero if the polynomial is zero\&. If the polynomial consists of a single term or monomial, returns the float value of that object\&. Otherwise generates an error\&.
.PP
floatValue:
.RS 1
-
.B
floatValue
:(float)
.I
aValue
.RE
.PP
Returns a polynomial (of the same representation as the polynomial that receives the message) with value equal to
.I
aValue
\&.
.PP
asScalar
.RS 1
-
.B
asScalar
.RE
.PP
If the polynomial consists of just one term or monomial that is a scalar, this method returns a copy of the scalar\&. Otherwise it returns
.B
nil
\&.
.PP
asSymbol
.RS 1
-
.B
asSymbol
.RE
.PP
If the polynomial consists of a single symbol (with exponent one and coefficient one), this method returns a copy of the symbol\&. Otherwise it returns
.B
nil
\&. The method returns
.B
nil
if the polynomial is a scalar that is a symbol\&.\&.\&.
.PP
asTerm
.RS 1
-
.B
asTerm
.RE
.PP
Returns, for a recursive polynomial that consists of a single term, a copy of that term\&. Returns
.B
nil
if the polynomial is zero (not considered to be a term) or a polynomial that consists of two or more terms\&.
.PP
asMonomial
.RS 1
-
.B
asMonomial
.RE
.PP
Returns, for an expanded polynomial that consists of a single monomial, a copy of that monomial\&. Returns
.B
nil
if the polynomial is zero (not considered to be a monomial) or a polynomial that consists of two or more monomials\&.
.PP
asCoefficient
.RS 1
-
.B
asCoefficient
.RE
.PP
This method applies only to recursive polynomials\&. If the polynomial is a term, this method returns a copy of its coefficient\&. Otherwise it returns
.B
nil
\&.
.PP
asNumerical
.RS 1
-
.B
asNumerical
.RE
.PP
Returns a numerical polynomial, ie\&. a polynomial in the same representation as the original polynomial but with the scalars are replaced by their numerical value\&. For example, for a polynomial with integer coefficients, this method returns a polynomial with floating-point objects as coefficients\&.
.PP
asModp:
.RS 1
-
.B
asModp
:(unsigned short)
.I
p
.RE
.PP
Returns a new polynomial, of the same representation as the original polynomial, but with the scalars replaced by their value modulo
.I
p
, a small prime number\&.
.PP
symbols
.RS 1
-
.B
symbols
.RE
.PP
Returns a collection of symbols\&. If the polynomial is variable dense, beware that some symbols may occur with a zero exponent in the polynomial\&. If the polynomial is variable sparse, this method returns an alphabetically sorted collection of all the symbols that occur in the polynomial with non-zero exponent\&. Don\&' modify the collection returned by this method; do not attempt to insert new symbols, or change their order\&.
.PP
degree
.RS 1
- (
int
)
.B
degree
.RE
.PP
For a recursive polynomial, returns the maximum of the exponents of the terms\&. For an expanded polynomial, returns the maximum of the degrees of the monomials (the method first checks whether the variable order is degree or reverse degree compatible, because if it is, the maximum is not really computed)\&. Returns minus one if the polynomial is equal to zero\&.
.PP
order
.RS 1
- (
int
)
.B
order
.RE
.PP
For a recursive polynomial, returns the minimum of the exponents of the terms\&. For an expanded polynomial, returns the minimum of the degrees of the monomials (the method first checks whether the variable order is degree or reverse degree compatible, because if it is, the minimum is not really computed)\&. Returns minus one if the polynomial is equal to zero\&.
.PP
.B
See also:
termContent, monomialContent
.PP
numTerms
.RS 1
- (
int
)
.B
numTerms
.RE
.PP
Returns the number of nonzero terms in the polynomial\&. Returns zero if the polynomial is equal to zero\&. In the case of a degree dense polynomial, the actual number of terms (including zero terms) can be obtained as the number of members of the associated sequence, or, for a univariate polynomial, as the degree of the polynomial plus one\&.
.PP
numMonomials
.RS 1
- (
int
)
.B
numMonomials
.RE
.PP
Returns the number of a non-zero monomials in the polynomial\&. Returns zero if the polynomial is equal to zero\&. In the case of a degree dense polynomial, the actual number of monomials (including zero monomials) can be obtained as the number of members of the associated sequence\&.
.PP
removeTerm
.RS 1
-
.B
removeTerm
.RE
.PP
Removes (and returns) the leading non-zero term of the polynomial\&. Returns
.B
nil
if the polynomial is equal to zero\&. The polynomial must be in recursive representation, but may be either degree sparse or degree dense, variable sparse or variable dense\&. To remove a term, the polynomial may not be a copy of another polynomial\&.
.PP
If the polynomial is variable dense, the coefficient of the term is either a scalar, or a variable dense polynomial in a variable less\&. If the polynomial is variable sparse, the coefficient of the term is the same kind of variable sparse polynomial as the original ie\&., there is no difference between coefficient domain and polynomial domain in the variable sparse case\&.
.PP
If the polynomial is degree dense, this method cannot be used to obtain the zero terms in the polynomial (because the leading term is defined as the first non-zero term in the sequence of terms)\&. The method
.B
eachTerm
returns all terms, including zero terms\&.
.PP
insertTerm:
.RS 1
-
.B
insertTerm
:
.I
aTerm
.RE
.PP
Inserts
.I
aTerm
into the recursive polynomial and returns
.B
self
\&. If the polynomial already contains a term with the same exponent, then the coefficients of the terms are added together\&. Otherwise,
.I
aTerm
is inserted in the collection of terms\&. In any case, after insertion,
.I
aTerm
belongs to the polynomial\&. To insert a term, the polynomial may not be a copy of another polynomial\&.
.PP
As always, if the exponent of the term is zero, the symbol of the term must be
.B
nil
\&. If the polynomial is variable sparse, the coefficient of the term must be either a scalar object or a <<non-scalar>> variable sparse polynomial\&. In the variable dense case, the symbol of the term must be equal to the main symbol of the variable dense polynomial; the coefficient domain of the polynomial must match the coefficient of the term; it may be either a scalar object or a variable dense polynomial\&.
.PP
If the polynomial is degree sparse, insertion is fast at head or tail of the linked list of terms\&. If the polynomial is degree dense, the array of coefficients is automatically expanded to make room for new terms\&. Therefore, it\&'s better to insert terms of higher degree before terms of smaller degree in the degree dense case\&.
.PP
removeMonomial
.RS 1
-
.B
removeMonomial
.RE
.PP
Removes the leading monomial of the polynomial\&. Returns
.B
nil
if the polynomial is equal to zero\&. The polynomial may be variable sparse or variable dense, degree sparse or degree dense, but must be in expanded representation\&. To remove a monomial, the polynomial may not be a copy of another polynomial\&.
.PP
insertMonomial:
.RS 1
-
.B
insertMonomial
:
.I
aMonomial
.RE
.PP
Inserts
.I
aMonomial
into the expanded polynomial and returns
.B
self
\&. If the polynomial already contains a monomial with the same terms, then the scalars of the monomials are added together\&. Otherwise,
.I
aMonomial
is inserted in the collection of monomials\&. In any case, after insertion,
.I
aMonomial
belongs to the polynomial\&. The polynomial may not be a copy of another polynomial\&.
.PP
eachTerm
.RS 1
-
.B
eachTerm
.RE
.PP
Returns, for a recursive polynomial, a sequence of terms\&. You may not modify the terms in the sequence or alter the polynomial in any other way while sequencing over its contents\&. A zero polynomial is represented by an empty sequence\&. If the polynomial is variable dense, all the terms in the sequence have the same symbol; if it is variable sparse, the symbols may be different\&. The terms are ordered with decreasing exponents (and in the variable sparse case, with respect to the symbols)\&. The first member of the sequence is the leading term of the polynomial; this term is never equal to zero\&. If the polynomial is degree sparse, the sequence doesn\&'t contain any terms with zero coefficient\&. If the polynomial is degree dense, the sequence also contains the terms with zero coefficient (unlike
.B
removeTerm
)\&.
.PP
.B
See also:
CASequence
.PP
eachMonomial
.RS 1
-
.B
eachMonomial
.RE
.PP
Like
.B
eachTerm
but for expanded polynomial; returns a sequence of monomials\&. A zero polynomial is represented by an empty sequence\&. If the polynomial is variable dense, all the monomials in the sequence are variable dense; they are variable sparse if the polynomial is variable sparse\&. The monomials are ordered with respect to Monomials
.B
compareTerms:
method\&. The first member of the sequence is the leading monomial of the polynomial; it\&'s never equal to zero\&. If the polynomial is degree sparse, the sequence doesn\&'t contain any monomials with zero coefficient\&. If the polynomial is degree dense, the sequence also contains the monomials with zero coefficient (unlike
.B
removeMonomial
)\&.
.PP
.B
See also:
CASequence
.PP
eachSequence
.RS 1
-
.B
eachSequence
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Returns, for recursive or expanded polynomials, a sequence whose members are either monomials or again sequences\&. At the deepest level of recursion the members of this sequence are
.I
monomials
, even for recursive polynomials\&.
.PP
The following example shows how to access the leading monomial of a recursive, non-zero polynomial (such a polynomial is
.I
not
a sum of monomials) :
.RS 3
aSequence = [aRecursivePolynomial eachSequence];
.br
aMember = [aSequence firstElement];
.br
while ([aMember isKindOfSequence]) aMember = [aMember firstElement];
.br
printf(\&"leading monomial is %s\&",[aMember str]);
.br
.RE
.PP
eachScalar
.RS 1
-
.B
eachScalar
.RE
.PP
Returns a sequence of the scalar objects in the polynomial\&. If the polynomial is in expanded representation, this sequence contains the scalars of the monomials in the polynomial\&. If it is recursive, then the sequence contains the (base) scalars in the polynomial\&.
.PP
.B
Note:
The sequence returned by this method doesn\&'t respond to
.B
at:
messages\&.
.PP
eachCoefficient
.RS 1
-
.B
eachCoefficient
.RE
.PP
Returns, for a recursive and variable dense polynomial, a sequence of the coefficients of the terms in the polynomial\&.
.PP
makeDegreeDense
.RS 1
-
.B
makeDegreeDense
.RE
.PP
If the polynomial is degree dense, this method merely returns a copy of
.B
self
\&. Otherwise, it creates a new degree dense polynomial and converts the polynomial into this new representation (making copies of the terms or monomials of the polynomial)\&. The resulting polynomial may be recursive, expanded, variable sparse or variable dense, depending on the representation of the original polynomial\&.
.PP
makeDegreeSparse
.RS 1
-
.B
makeDegreeSparse
.RE
.PP
If the polynomial is degree sparse, this method merely returns a copy of
.B
self
\&. Otherwise, it creates a new degree sparse polynomial and converts the polynomial into this new representation (making copies of the terms or monomials of the polynomial)\&. The resulting polynomial may be recursive, expanded, variable sparse or variable dense, depending on the representation of the original polynomial\&.
.PP
makeRecursive
.RS 1
-
.B
makeRecursive
.RE
.PP
Returns, for an expanded polynomial, a new polynomial over the same domain of scalars and with the same value, but in the recursive representation\&. The polynomial may be degree dense or degree sparse, variable sparse or variable dense\&.
.PP
makeExpanded
.RS 1
-
.B
makeExpanded
.RE
.PP
Returns, for a recursive polynomial, a new polynomial over the same domain of scalars and with the same value, but in the expanded representation\&. The polynomial may be degree dense or degree sparse, variable sparse or variable dense\&.
.PP
makeVariableSparse
.RS 1
-
.B
makeVariableSparse
.RE
.PP
Returns, for a variable dense polynomial, a new polynomial over the same domain of scalars and with the same value, but in the variable sparse representation\&. The polynomial may be degree dense or degree sparse, recursive or expanded\&.
.PP
makeVariableDense
.RS 1
-
.B
makeVariableDense
.RE
.PP
Returns, for a variable sparse or variable dense polynomial, a new polynomial over the same domain of scalars and with the same value, but in the variable dense representation\&. The polynomial may be degree dense or degree sparse, recursive or expanded\&. This method invokes
.B
collect:
\&.
.PP
.B
See also:
collect
.PP
collect:
.RS 1
-
.B
collect
:
.I
symbols
.RE
.PP
.B
Note:
<<The case of
.I
symbols
a collection with less members than the number of variables of the polynomial is not yet implemented\&. Currenlty
.I
symbols
must contain the same number, or more symbols than the original polynomial>>
.PP
Returns, for a variable sparse or variable dense polynomial, a new variable dense polynomial in the symbols indicated by the collection
.I
symbols
\&. The collection must contain at least one symbol\&. The original polynomial may be degree dense or degree sparse, recursive or expanded, and the resulting polynomial will be of the same representation\&.
.PP
The following examples show how to convert a variable sparse polynomial into variable dense representation, how to convert two variable sparse polynomials into the
.I
same
variable dense representation, and finally how to change the variable order of a variable dense polynomial :
.RS 3
{
.br
dense = [sparse collect:[sparse symbols]];
.br
}
.br
.br
.RE
.RS 3
{
.br
symbols = [[a symbols] union:[b symbols]];
.br
c = [a collect:symbols];
.br
d = [b collect:symbols];
.br
}
.br
.br
.RE
.RS 3
{
.br
symbols = [[b symbols] copy];
.br
/* \&.\&.\&. do something with \&"symbols\&" here\&.\&.\&. */
.br
d = [b collect:symbols];
.br
}
.br
.br
.RE
.PP
leadingTerm
.RS 1
-
.B
leadingTerm
.RE
.PP
Returns the leading term of the (recursive) polynomial\&. Returns
.B
nil
if the polynomial is equal to zero\&.
.PP
leadingCoefficient
.RS 1
-
.B
leadingCoefficient
.RE
.PP
Returns the leading coefficient of the (recursive) polynomial\&. Returns
.B
nil
if the polynomial is equal to zero\&.
.PP
leadingSign
.RS 1
- (
int
)
.B
leadingSign
.RE
.PP
For a recursive polynomial, returns the sign of the leading coefficient\&. For a polynomial in expanded representation, returns the sign of the leading scalar\&. Returns zero if the polynomial is equal to zero\&.
.PP
leadingMonomial
.RS 1
-
.B
leadingMonomial
.RE
.PP
Returns the leading monomial of the polynomial (in expanded representation)\&. Returns
.B
nil
if the polynomial is equal to zero\&.
.PP
leadingScalar
.RS 1
-
.B
leadingScalar
.RE
.PP
Returns the scalar of the leading monomial of the polynomial\&. Returns
.B
nil
if the polynomial is equal to zero\&.
.PP
isMonic
.RS 1
- (
BOOL
)
.B
isMonic
.RE
.PP
For a recursive polynomial, returns YES if the leading coefficient of the polynomial is equal to one\&. For an expanded polynomial, tests whether the leading scalar is equal to one\&. It follows that the same polynomial
.I
x
.I
y
+ 1 is monic in expanded representation, but is
.I
not
monic in recursive representation (because the leading coefficient is
.I
x
)\&. The method returns NO if the polynomial is equal to zero\&.
.PP
notMonic
.RS 1
- (
BOOL
)
.B
notMonic
.RE
.PP
Whether
.B
isMonic
returns NO\&.
.PP
makeMonic
.RS 1
-
.B
makeMonic
.RE
.PP
zero
.RS 1
-
.B
zero
.RE
.PP
Returns a copy of the zero polynomial (same representation as polynomial that receives the message)\&. The only difference with
.B
empty
is that the latter method creates a new object, while this method just returns a copy of an already existing object\&. For example, it\&'s not possible to insert terms in the polynomial returned by
.B
zero
\&.
.PP
.B
See also:
empty
.PP
isZero
.RS 1
- (
BOOL
)
.B
isZero
.RE
.PP
Whether the object is equal to zero\&.
.PP
isOpposite:
.RS 1
- (
BOOL
)
.B
isOpposite
:
.I
b
.RE
.PP
Whether the object is the opposite of
.I
b
\&.
.PP
negate
.RS 1
-
.B
negate
.RE
.PP
Returns the opposite of the object\&.
.PP
double
.RS 1
-
.B
double
.RE
.PP
Returns a new object, equal to the object multiplied by two i\&.e\&., added to itself\&.
.PP
add:
.RS 1
-
.B
add
:
.I
b
.RE
.PP
Adds
.I
b
to the object\&. Returns a new object\&.
.PP
subtract:
.RS 1
-
.B
subtract
:
.I
b
.RE
.PP
Subtracts
.I
b
from the object\&. Returns a new object\&.
.PP
addScalar:
.RS 1
-
.B
addScalar
:
.I
s
.RE
.PP
Returns a new polynomial; adds the (base) scalar
.I
s
to the original polynomial\&.
.PP
subtractScalar:
.RS 1
-
.B
subtractScalar
:
.I
s
.RE
.PP
Returns a new polynomial; subtracts the (base) scalar
.I
s
to the original polynomial\&.
.PP
one
.RS 1
-
.B
one
.RE
.PP
Returns a copy of the unity polynomial (same representation as polynomial that receives the message)\&.
.PP
isOne
.RS 1
- (
BOOL
)
.B
isOne
.RE
.PP
Whether the polynomial is equal to one\&.
.PP
isMinusOne
.RS 1
- (
BOOL
)
.B
isMinusOne
.RE
.PP
Whether the polynomial is equal to minus one\&.
.PP
multiply:
.RS 1
-
.B
multiply
:
.I
b
.RE
.PP
Returns a new polynomial\&. Computes the product of the polynomials by the classical polynomial multiplication algorithm, except if the polynomials are equal in which case the method invokes
.B
square
\&.
.PP
square
.RS 1
-
.B
square
.RE
.PP
Returns a new polynomial\&. Computes the square of the polynomial by the classical polynomial multiplication algorithm using symmetry\&.
.PP
inverse
.RS 1
-
.B
inverse
.RE
.PP
Returns a new polynomial that is the inverse of the polynomial, or
.B
nil
if the polynomial cannot be inverted\&. A polynomial over a field or integral domain can be inverted if and only if it consists of a single term that is invertible\&.
.PP
multiplyScalar:
.RS 1
-
.B
multiplyScalar
:
.I
s
.RE
.PP
Multiplies by the scalar
.I
s
\&. Returns a new object\&.
.PP
divideScalar:
.RS 1
-
.B
divideScalar
:
.I
s
.RE
.PP
Exact division by the scalar
.I
s
\&. Returns a new object, or
.B
nil
if the division is not exact\&.
.PP
multiplyCoefficient:
.RS 1
-
.B
multiplyCoefficient
:
.I
aCoefficient
.RE
.PP
Multiplies the (recursive and variable dense) polynomial by
.I
aCoefficient
and returns a new object\&. What
.I
aCoefficient
means, depends on the representation of the polynomial\&. If it is variable dense and univariate, then
.I
aCoefficient
must be a scalar object\&. If it is variable dense and multivariate, then
.I
aCoefficient
must be again a variable dense polynomial in a variable less\&. The method is
.I
not
implemented in the variable sparse case; you can use
.B
multiplyScalar:
or
.B
multiply:
for these polynomials\&.
.PP
divideCoefficient:
.RS 1
-
.B
divideCoefficient
:
.I
aCoefficient
.RE
.PP
Exact division of the (recursive and variable dense) polynomial by
.I
aCoefficient
; returns a new object or
.B
nil
if the division is not exact or if it fails\&. If the polynomial is univariate, then
.I
aCoefficient
must be a scalar object\&. If it is multivariate, then
.I
aCoefficient
must be again a variable dense polynomial in a variable less\&. The method is not implemented in the variable sparse case; there you can use
.B
divideScalar:
or
.B
divide:
\&.
.PP
multiplyTerm:
.RS 1
-
.B
multiplyTerm
:
.I
aTerm
.RE
.PP
Multiplies the (recursive) polynomial by the term
.I
aTerm
; returns a new object\&. This method is implemented for both variable sparse and variable dense
.I
recursive
polynomials\&. In the variable dense case, the symbol of the term must be equal to the main symbol of the polynomial and the coefficient classes must match\&. In the variable sparse case, the only requirement is that the domain of scalars of the term and the polynomial are equal\&.
.PP
divideTerm:
.RS 1
-
.B
divideTerm
:
.I
aTerm
.RE
.PP
(Exact) Division of the polynomial by
.I
aTerm
; returns a new polynomial\&. The division fails (and this method returns
.B
nil
) if one of the terms of the polynomial is not divisible by
.I
aTerm
\&. This method is implemented for both variable sparse and variable dense
.I
recursive
polynomials\&. In the variable dense case, the symbol of the term must be equal to the main symbol of the polynomial and the coefficient classes must match\&. In the variable sparse case, the only requirement is that the domain of scalars of the term and the polynomial are equal (and for the division not to fail, that the symbol of the term is less than or equal to the symbols of each term of the polynomial)\&.
.PP
multiplyMonomial:
.RS 1
-
.B
multiplyMonomial
:
.I
s
.RE
.PP
Multiplies by the monomial
.I
s
\&. Returns a new object\&.
.PP
divideMonomial:
.RS 1
-
.B
divideMonomial
:
.I
s
.RE
.PP
Exact division by the monomial
.I
s
\&. Returns a new object, or
.B
nil
if the division is not exact\&.
.PP
remainder:quotient:
.RS 1
-
.B
remainder
:
.I
b
.B
quotient
:(id *)
.I
q
.RE
.PP
Returns new polynomials
.I
R
and, by reference,
.I
Q
such that
.I
self
=
.I
Q b
+
.I
R
\&. If
.I
q
is a NULL pointer, the quotient
.I
Q
is not computed\&. Returns
.B
nil
(and sets the value pointed to by
.I
q
to
.B
nil
) if the polynomial division fails\&.
.RS 3
id q,r;
.br
.br
r = [self remainder:b quotient:&q];
.br
.br
/* do something with r and q */
.br
.br
.RE
.PP
If the polynomials are variable sparse, they are converted into variable dense representation\&. The division algorithm itself, works for univariate and multivariate variable dense polynomials, in recursive or expanded representation, over fields or integral domains\&. However, in the multivariate case, a non-zero remainder need not be unique\&. In the case of division of polynomials with coefficients in an integral domain (such as the integers), the division possibly fails when a coefficient division fails; it is still possible to do a pseudo-division\&. See
.B
pseudoRemainder:quotient:
for more details\&.
.PP
divide:
.RS 1
-
.B
divide
:
.I
b
.RE
.PP
Returns the exact quotient (a new polynomial) of the polynomial division\&. Returns
.B
nil
if the polynomial division fails or if the division was not exact (if there was a non-zero remainder)\&. The polynomial may be expanded or recursive\&.
.PP
pseudoRemainder:quotient:
.RS 1
-
.B
pseudoRemainder
:
.I
b
.B
quotient
:(id *)
.I
q
.RE
.PP
If the polynomials are variable sparse or expanded, they are temporarily converted into variable dense and recursive representation for this operation\&. If
.I
n
and
.I
m
are the degrees of
.B
self
and
.I
b
respectively, and if
.I
c
is the leading coefficient of
.I
b
, than this method computes the pseudo-remainder
.I
R
and, if
.I
q
is not a NULL pointer, the pseudo-quotient
.I
Q
such that
.I
c
^(n-m+1)
.I
self
=
.I
Q b
+
.I
R
\&. Returns
.B
nil
if the pseudo-division fails\&.
.PP
pseudoRemainder:
.RS 1
-
.B
pseudoRemainder
:
.I
b
.RE
.PP
Computes the pseudo-remainder of the polynomials by invoking
.B
pseudoRemainder:quotient:
with a NULL argument\&.
.PP
content
.RS 1
-
.B
content
.RE
.PP
Returns the content of the sequence of scalars of the polynomial (the greatest common divisor of the scalars in the polynomial); the result is a new scalar object\&. If the polynomial is zero, this method returns
.B
nil
\&.
.PP
divideContent
.RS 1
-
.B
divideContent
.RE
.PP
If the polynomial is zero, this method returns a copy of itself\&. Otherwise, this method returns the quotient (a new polynomial) on division by the scalar returned by
.B
content
\&.
.PP
coefficientContent
.RS 1
-
.B
coefficientContent
.RE
.PP
Returns for a variable dense and recursive polynomial, the greatest common divisor of the coefficients (not scalars) of the polynomial\&. If the polynomial is equal to zero, this method returns
.B
nil
\&.
.PP
divideCoefficientContent
.RS 1
-
.B
divideCoefficientContent
.RE
.PP
If the polynomial is zero, this method returns a copy of itself\&. Otherwise, this method returns the quotient (a new polynomial) on division by the coefficient returned by
.B
coefficientContent
\&.
.PP
termContent
.RS 1
-
.B
termContent
.RE
.PP
Returns for a variable dense and recursive polynomial, the
.I
monic
greatest common divisor of the terms of the polynomial\&. In other words, this method returns the main symbol of the polynomial raised to the
.B
order
of the polynomial\&.
.PP
.B
See also:
order
.PP
monomialContent
.RS 1
-
.B
monomialContent
.RE
.PP
Returns the greatest common divisor (a monic monomial) of the monomials in an expanded polynomial\&. If the polynomial is equal to zero, this method returns
.B
nil
\&.
.PP
gcd:
.RS 1
-
.B
gcd
:
.I
b
.RE
.PP
Returns a new polynomial that is the gcd of the polynomials\&. For recursive and variable dense polynomials over a field, the method computes the
.I
monic
gcd of the polynomials by the euclidean algorithm\&. Over an integral domain, the method computes the
.I
primitive
gcd by the improved subresultant algorithm\&. Expanded or variable dense polynomials are temporarily converted into recursive and variable dense representation (and the resulting gcd is converted back into the original representation)\&.
.PP
resultant:
.RS 1
-
.B
resultant
:
.I
b
.RE
.PP
Returns the resultant of the pair of two recursive and variable dense polynomials\&. The result is a new object that is taken from the coefficient domain i\&.e\&., it is either a polynomial in a variable less than the argument polynomials, or it is a scalar\&.
.PP
resultant:wrt:
.RS 1
-
.B
resultant
:
.I
b
.B
wrt
:(STR)
.I
aSymbol
.RE
.PP
Returns the resultant of the pair of polynomials with respect to the variable named
.I
aSymbol
\&.
.PP
discriminant
.RS 1
-
.B
discriminant
.RE
.PP
Returns the discriminant of the polynomial i\&.e\&. the resultant of the polynomial and its derivative\&.
.PP
.B
Note:
This is actually the discriminant up to a scalar\&. Scalar factor will change in future\&.
.PP
numRealRoots
.RS 1
- (
int
)
.B
numRealRoots
.RE
.PP
Returns the number of real roots of a univariate and variable dense polynomial, using Sturm\&'s algorithm over any ordered integral domain or field\&. A univariate variable sparse polynomial is temporarily converted into variable dense representation\&.
.PP
varRealRoots:
.RS 1
- (
int
)
.B
varRealRoots
:
.I
g
.RE
.PP
Returns the variation of real roots over the polynomial
.I
g
\&.
.PP
isSquareFree
.RS 1
- (
BOOL
)
.B
isSquareFree
.RE
.PP
Returns YES if the polynomial is squarefree i\&.e\&., if the polynomial and its derivative are coprime\&.
.PP
factorSquareFree
.RS 1
-
.B
factorSquareFree
.RE
.PP
Factors a recursive and variable dense polynomial into a product of squarefree factors\&. Returns a new collection of term objects; each term consists of a (base) scalar object, the squarefree factor and a positive integral exponent\&. If the scalars are taken from a field, the factors are made monic; for an integral domain, the factors are made primitive\&. The algorithm works in the case of zero and non-zero characteristic\&. If the polynomial is expanded or variable sparse, the method temporarily converts it into recursive and variable dense representation\&. The factors of the polynomial are made expanded or variable sparse again\&.
.PP
truncateAtDegree:
.RS 1
-
.B
truncateAtDegree
:(int)
.I
d
.RE
.PP
Drops terms or monomials of degree greater than
.I
d
\&. Returns a new polynomial\&.
.PP
frobenius
.RS 1
-
.B
frobenius
.RE
.PP
Returns a new polynomial that is the image of the polynomial under the frobenius map by sending
.B
frobenius
messages to each term or monomial\&.
.PP
frobeniusInverse
.RS 1
-
.B
frobeniusInverse
.RE
.PP
Returns a new polynomial that is the image of the polynomial under the inverse of the frobenius map by sending
.B
frobeniusInverse
messages to each term or monomial\&. Returns
.B
nil
if the polynomial is not the image of a polynomial under the frobenius map\&.
.PP
evaluate:
.RS 1
-
.B
evaluate
:
.I
aScalar
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Replaces the main variable of the polynomial by
.I
aScalar
, and if the polynomial is univariate, returns a scalar object\&. If the polynomial is not univariate, it must be recursive and variable dense and the method returns again a recursive and variable dense polynomial in a variable less (ie\&. a coefficient object), obtained by replacing the main variable by
.I
aScalar
\&.
.PP
evaluate:at:
.RS 1
-
.B
evaluate
:(STR)
.I
aSymbol
.B
at
:
.I
aScalar
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Returns a new polynomial object, obtained by replacing the variable named
.I
aSymbol
by
.I
aScalar
\&.
.PP
evaluateAll:
.RS 1
-
.B
evaluateAll
:
.I
cltnOfScalars
.RE
.PP
Returns a new scalar object, obtained by replacing all variables of the polynomial by the scalar objects in the collection
.I
cltnOfScalars
i\&.e\&., the first member in the collection returned by
.B
variables
is replaced by the first member in
.I
cltnOfScalars
and so on\&. Variable sparse or expanded polynomials are temporarily converted into recursive and variable dense representation by this method\&.
.PP
substitute:
.RS 1
-
.B
substitute
:
.I
aPolynomial
.RE
.PP
Returns a new (variable dense) polynomial, obtained by replacing the main variable of a variable dense polynomial by
.I
aPolynomial
\&.
.PP
substitute:by:
.RS 1
-
.B
substitute
:(STR)
.I
aSymbol
.B
by
:
.I
aPolynomial
.RE
.PP
Returns a new polynomial, obtained by replacing the variable named
.I
aSymbol
by
.I
aPolynomial
\&. Implemented for recursive and variable sparse polynomials only\&.
.PP
substituteAll:
.RS 1
-
.B
substituteAll
:
.I
cltnOfPolynomials
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Returns a new polynomial, obtained by replacing all variables simultaneously by the polynomials in the collection
.I
cltnOfPolynomials
\&.
.PP
Change of Variables - Permuting (Swapping) Variables = substituteAll
.PP
derive
.RS 1
-
.B
derive
.RE
.PP
Returns the derivative of a variable dense polynomial with respect to the main variable (the last member in the collection returned by
.B
variables
)\&.
.PP
deriveWrt:
.RS 1
-
.B
deriveWrt
:(STR)
.I
aSymbol
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Returns the derivative of the polynomial with respect to the variable named
.I
aSymbol
\&. For example, to integrate a polynomial with respect to
.I
x
:
.RS 3
pdx = [p deriveWrt:\&"x\&"];
.br
.RE
.PP
integrate
.RS 1
-
.B
integrate
.RE
.PP
Integrates a variable dense polynomial with respect to the main variable (the last member in the collection returned by
.B
variables
)\&. Because the resulting polynomial is a polynomial over the same domain of scalars as the integrandum, this operation might fail and returns
.B
nil
if the scalars are not taken from a field\&.
.PP
integrateWrt:
.RS 1
-
.B
integrateWrt
:(STR)
.I
aSymbol
.RE
.PP
.B
Note:
Not implemented\&.
.PP
Integrates the polynomial with respect to the variable named
.I
aSymbol
\&.
.PP
printsLeadingSign
.RS 1
- (
BOOL
)
.B
printsLeadingSign
.RE
.PP
Whether the polynomial prints a leading minus sign\&.
.PP
printsSum
.RS 1
- (
BOOL
)
.B
printsSum
.RE
.PP
Whether the polynomial prints multiple terms or monomials separated by a plus or minus signs\&.
.PP
printsProduct
.RS 1
- (
BOOL
)
.B
printsProduct
.RE
.PP
Whether the polynomial prints a single product\&.
.PP
printOn:
.RS 1
-
.B
printOn
:(IOD)
.I
aFile
.RE
.PP
Prints the polynomial, by sending
.B
printOn:
messages to the terms or monomials\&.