summaryrefslogtreecommitdiff
path: root/macros/generic/polexpr/polexpr.html
blob: 9b6f99138d3744283e41bc9be854c29902604ee0 (plain)
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
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8"/>
<meta name="generator" content="Docutils 0.16: http://docutils.sourceforge.net/" />
<title>Package polexpr documentation</title>
<style type="text/css">

/* Minimal style sheet for the HTML output of Docutils.                    */
/*                                                                         */
/* :Author: Günter Milde, based on html4css1.css by David Goodger          */
/* :Id: $Id: minimal.css 8397 2019-09-20 11:09:34Z milde $               */
/* :Copyright: © 2015 Günter Milde.                                        */
/* :License: Released under the terms of the `2-Clause BSD license`_,      */
/*    in short:                                                            */
/*                                                                         */
/*    Copying and distribution of this file, with or without modification, */
/*    are permitted in any medium without royalty provided the copyright   */
/*    notice and this notice are preserved.                                */
/*                                                                         */
/*    This file is offered as-is, without any warranty.                    */
/*                                                                         */
/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause     */

/* This CSS2.1_ stylesheet defines rules for Docutils elements without    */
/* HTML equivalent. It is required to make the document semantic visible. */
/*                                                                        */
/* .. _CSS2.1: http://www.w3.org/TR/CSS2                                  */
/* .. _validates: http://jigsaw.w3.org/css-validator/validator$link       */

/* alignment of text and inline objects inside block objects*/
.align-left   { text-align: left; }
.align-right  { text-align: right; }
.align-center { clear: both; text-align: center; }
.align-top    { vertical-align: top; }
.align-middle { vertical-align: middle; }
.align-bottom { vertical-align: bottom; }

/* titles */
h1.title, p.subtitle {
  text-align: center;
}
p.topic-title,
p.sidebar-title,
p.rubric,
p.admonition-title,
p.system-message-title {
  font-weight: bold;
}
h1 + p.subtitle,
h1 + p.section-subtitle {
  font-size: 1.6em;
}
h2 + p.section-subtitle { font-size: 1.28em; }
p.subtitle,
p.section-subtitle,
p.sidebar-subtitle {
  font-weight: bold;
  margin-top: -0.5em;
}
p.sidebar-title,
p.rubric {
  font-size: larger;
}
p.rubric { color: maroon; }
a.toc-backref {
  color: black;
  text-decoration: none; }

/* Warnings, Errors */
div.caution p.admonition-title,
div.attention p.admonition-title,
div.danger p.admonition-title,
div.error p.admonition-title,
div.warning p.admonition-title,
div.system-messages h1,
div.error,
span.problematic,
p.system-message-title {
  color: red;
}

/* inline literals */
span.docutils.literal {
  font-family: monospace;
  white-space: pre-wrap;
}
/* do not wraph at hyphens and similar: */
.literal > span.pre { white-space: nowrap; }

/* Lists */

/* compact and simple lists: no margin between items */
.simple  li, .compact li,
.simple  ul, .compact ul,
.simple  ol, .compact ol,
.simple > li p, .compact > li p,
dl.simple > dd, dl.compact > dd {
  margin-top: 0;
  margin-bottom: 0;
}

/* Table of Contents */
div.topic.contents { margin: 0.5em 0; }
div.topic.contents ul {
  list-style-type: none;
  padding-left: 1.5em;
}

/* Enumerated Lists */
ol.arabic     { list-style: decimal }
ol.loweralpha { list-style: lower-alpha }
ol.upperalpha { list-style: upper-alpha }
ol.lowerroman { list-style: lower-roman }
ol.upperroman { list-style: upper-roman }

dt span.classifier { font-style: italic }
dt span.classifier:before {
  font-style: normal;
  margin: 0.5em;
  content: ":";
}

/* Field Lists and drivatives */
/* bold field name, content starts on the same line */
dl.field-list > dt,
dl.option-list > dt,
dl.docinfo > dt,
dl.footnote > dt,
dl.citation > dt {
  font-weight: bold;
  clear: left;
  float: left;
  margin: 0;
  padding: 0;
  padding-right: 0.5em;
}
/* Offset for field content (corresponds to the --field-name-limit option) */
dl.field-list > dd,
dl.option-list > dd,
dl.docinfo > dd {
  margin-left:  9em; /* ca. 14 chars in the test examples */
}
/* start field-body on a new line after long field names */
dl.field-list > dd > *:first-child,
dl.option-list > dd > *:first-child
{
  display: inline-block;
  width: 100%;
  margin: 0;
}
/* field names followed by a colon */
dl.field-list > dt:after,
dl.docinfo > dt:after {
  content: ":";
}

/* Bibliographic Fields (docinfo) */
pre.address { font: inherit; }
dd.authors > p { margin: 0; }

/* Option Lists */
dl.option-list { margin-left: 1.5em; }
dl.option-list > dt { font-weight: normal; }
span.option { white-space: nowrap; }

/* Footnotes and Citations  */
dl.footnote.superscript > dd {margin-left: 1em; }
dl.footnote.brackets > dd {margin-left: 2em; }
dl > dt.label { font-weight: normal; }
a.footnote-reference.brackets:before,
dt.label > span.brackets:before { content: "["; }
a.footnote-reference.brackets:after,
dt.label > span.brackets:after { content: "]"; }
a.footnote-reference.superscript,
dl.footnote.superscript > dt.label {
  vertical-align: super;
  font-size: smaller;
}
dt.label > span.fn-backref { margin-left: 0.2em; }
dt.label > span.fn-backref > a { font-style: italic; }

/* Line Blocks */
div.line-block { display: block; }
div.line-block div.line-block {
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 40px;
}

/* Figures, Images, and Tables */
.figure.align-left,
figure.align-left,
img.align-left,
object.align-left,
table.align-left {
  margin-right: auto;
}
.figure.align-center,
figure.align-center,
img.align-center,
object.align-center,
table.align-center {
  margin-left: auto;
  margin-right: auto;
}
.figure.align-right,
figure.align-right,
img.align-right,
object.align-right,
table.align-right {
  margin-left: auto;
}
.figure.align-center, .figure.align-right,
figure.align-center, figure.align-right,
img.align-center, img.align-right,
object.align-center, object.align-right {
  display: block;
}
/* reset inner alignment in figures and tables */
.figure.align-left, .figure.align-right,
figure.align-left, figure.align-right,
table.align-left, table.align-center, table.align-right {
  text-align: inherit;
}

/* Admonitions and System Messages */
div.admonition,
div.system-message,
div.sidebar,
aside.sidebar {
  margin: 1em 1.5em;
  border: medium outset;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  padding-right: 1em;
  padding-left: 1em;
}

/* Sidebar */
div.sidebar,
aside.sidebar {
  width: 30%;
  max-width: 26em;
  float: right;
  clear: right;
}

/* Text Blocks */
blockquote,
div.topic,
pre.literal-block,
pre.doctest-block,
pre.math,
pre.code {
  margin-left: 1.5em;
  margin-right: 1.5em;
}
pre.code .ln { color: gray; } /* line numbers */

/* Tables */
table { border-collapse: collapse; }
td, th {
  border-style: solid;
  border-color: silver;
  padding: 0 1ex;
  border-width: thin;
}
td > p:first-child, th > p:first-child { margin-top: 0; }
td > p, th > p { margin-bottom: 0; }

table > caption {
  text-align: left;
  margin-bottom: 0.25em
}

table.borderless td, table.borderless th {
  border: 0;
  padding: 0;
  padding-right: 0.5em /* separate table cells */
}

/* Document Header and Footer */
/* div.header,				      */
/* header { border-bottom: 1px solid black; } */
/* div.footer,				      */
/* footer { border-top: 1px solid black; }    */

/* new HTML5 block elements: set display for older browsers */
header, section, footer, aside, nav, main, article, figure {
  display: block;
}

</style>
<style type="text/css">

/* CSS31_ style sheet for the output of Docutils HTML writers.             */
/* Rules for easy reading and pre-defined style variants.		   */
/*                                                                         */
/* :Author: Günter Milde, based on html4css1.css by David Goodger          */
/* :Id: $Id: plain.css 8397 2019-09-20 11:09:34Z milde $               */
/* :Copyright: © 2015 Günter Milde.                                        */
/* :License: Released under the terms of the `2-Clause BSD license`_,      */
/*    in short:                                                            */
/*                                                                         */
/*    Copying and distribution of this file, with or without modification, */
/*    are permitted in any medium without royalty provided the copyright   */
/*    notice and this notice are preserved.                                */
/*    	     	      	     	 					   */
/*    This file is offered as-is, without any warranty.                    */
/*                                                                         */
/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause     */
/* .. _CSS3: http://www.w3.org/TR/CSS3		        		   */


/* Document Structure */
/* ****************** */

/* "page layout" */
body {
  margin: 0;
  background-color: #dbdbdb;
}
div.document,
main {
  line-height:1.3;
  counter-reset: table;
  /* counter-reset: figure; */
  /* avoid long lines --> better reading */
  /* OTOH: lines should not be too short because of missing hyphenation, */
  max-width: 50em;
  padding: 1px 2%; /* 1px on top avoids grey bar above title (mozilla) */
  margin: auto;
  background-color: white;
}

/* Sections */

/* Transitions */

hr.docutils {
  width: 80%;
  margin-top: 1em;
  margin-bottom: 1em;
  clear: both;
}

/* Paragraphs */
/* ========== */

/* vertical space (parskip) */
p, ol, ul, dl,
div.line-block,
div.topic,
table {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
p:first-child { margin-top: 0; }
/* (:last-child is new in CSS 3) */
p:last-child  { margin-bottom: 0; }

h1, h2, h3, h4, h5, h6,
dl > dd {
  margin-bottom: 0.5em;
}

/* Lists */
/* ===== */

/* Definition Lists */

/* lists nested in definition lists */
/* (:only-child is new in CSS 3) */
dd > ul:only-child, dd > ol:only-child { padding-left: 1em; }

/* Description Lists */
/* styled like in most dictionaries, encyclopedias etc. */
dl.description > dt {
  font-weight: bold;
  clear: left;
  float: left;
  margin: 0;
  padding: 0;
  padding-right: 0.5em;
}

/* Field Lists */

/* example for custom field-name width */
dl.field-list.narrow > dd {
  margin-left: 5em;
}
/* run-in: start field-body on same line after long field names */
dl.field-list.run-in > dd p {
  display: block;
}

/* Bibliographic Fields */

/* generally, bibliographic fields use special definition list dl.docinfo */
/* but dedication and abstract are placed into "topic" divs */
div.abstract p.topic-title {
  text-align: center;
}
div.dedication {
  margin: 2em 5em;
  text-align: center;
  font-style: italic;
}
div.dedication p.topic-title {
  font-style: normal;
}

/* Citations */
dl.citation dt.label {
  font-weight: bold;
}
span.fn-backref {
  font-weight: normal;
}

/* Text Blocks */
/* =========== */

/* Literal Blocks */

pre.literal-block,
pre.doctest-block,
pre.math,
pre.code {
  font-family: monospace;
}

/* Block Quotes */

blockquote > table,
div.topic > table {
  margin-top: 0;
  margin-bottom: 0;
}
blockquote p.attribution,
div.topic p.attribution {
  text-align: right;
  margin-left: 20%;
}

/* Tables */
/* ====== */

/* th { vertical-align: bottom; } */

table tr { text-align: left; }

/* "booktabs" style (no vertical lines) */
table.booktabs {
  border: 0;
  border-top: 2px solid;
  border-bottom: 2px solid;
  border-collapse: collapse;
}
table.booktabs * {
  border: 0;
}
table.booktabs th {
  border-bottom: thin solid;
}

/* numbered tables (counter defined in div.document) */
table.numbered > caption:before {
  counter-increment: table;
  content: "Table " counter(table) ": ";
  font-weight: bold;
}

/* Explicit Markup Blocks */
/* ====================== */

/* Footnotes and Citations */
/* ----------------------- */

/* line on the left */
dl.footnote {
  padding-left: 1ex;
  border-left: solid;
  border-left-width: thin;
}

/* Directives */
/* ---------- */

/* Body Elements */
/* ~~~~~~~~~~~~~ */

/* Images and Figures */

/* let content flow to the side of aligned images and figures */
.figure.align-left,
figure.align-left,
img.align-left,
object.align-left {
  display: block;
  clear: left;
  float: left;
  margin-right: 1em;
}
.figure.align-right,
figure.align-right,
img.align-right,
object.align-right {
  display: block;
  clear: right;
  float: right;
  margin-left: 1em;
}
/* Stop floating sidebars, images and figures at section level 1,2,3 */
h1, h2, h3 { clear: both; }

/* Sidebar */

/* Move right. In a layout with fixed margins, */
/* it can be moved into the margin.   	       */
div.sidebar,
aside.sidebar {
  width: 30%;
  max-width: 26em;
  margin-left: 1em;
  margin-right: -2%;
  background-color: #ffffee;
}

/* Code */

pre.code { padding: 0.7ex }
pre.code, code { background-color: #eeeeee }
pre.code .ln { color: gray; } /* line numbers */
/* basic highlighting: for a complete scheme, see */
/* http://docutils.sourceforge.net/sandbox/stylesheets/ */
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}

/* Math */
/* styled separately (see math.css for math-output=HTML) */

/* Epigraph           */
/* Highlights         */
/* Pull-Quote         */
/* Compound Paragraph */
/* Container          */

/* can be styled in a custom stylesheet */

/* Document Header and Footer */

footer, header,
div.footer, div.header {
  font-size: smaller;
  clear: both;
  padding: 0.5em 2%;
  background-color: #ebebee;
  border: none;
}

/* Inline Markup */
/* ============= */

/* Emphasis           */
/*   em               */
/* Strong Emphasis    */
/*   strong	      */
/* Interpreted Text   */
/*   span.interpreted */
/* Title Reference    */
/*   cite	      */

/* Inline Literals                                          */
/* possible values: normal, nowrap, pre, pre-wrap, pre-line */
/*   span.docutils.literal { white-space: pre-wrap; }       */

/* Hyperlink References */
a { text-decoration: none; }

/* External Targets       */
/*   span.target.external */
/* Internal Targets  	  */
/*   span.target.internal */
/* Footnote References    */
/*   a.footnote-reference */
/* Citation References    */
/*   a.citation-reference */

</style>
</head>
<body>
<div class="document" id="package-polexpr-documentation">
<h1 class="title">Package polexpr documentation</h1>
<p class="subtitle" id="id1">0.8.5 (2021/11/30)</p>

<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#usage" id="id35">Usage</a></p></li>
<li><p><a class="reference internal" href="#abstract" id="id36">Abstract</a></p></li>
<li><p><a class="reference internal" href="#prerequisites" id="id37">Prerequisites</a></p></li>
<li><p><a class="reference internal" href="#quick-syntax-overview" id="id38">Quick syntax overview</a></p></li>
<li><p><a class="reference internal" href="#the-polexpr-0-8-extensions-to-the-xintexpr-syntax" id="id39">The polexpr <span class="docutils literal">0.8</span> extensions to the <span class="docutils literal">\xintexpr</span> syntax</a></p>
<ul>
<li><p><a class="reference internal" href="#warning-about-unstability-of-the-new-syntax" id="id40">Warning about unstability of the new syntax</a></p></li>
<li><p><a class="reference internal" href="#infix-operators" id="id41">Infix operators <span class="docutils literal">+, <span class="pre">-,</span> *, /, **, ^</span></a></p></li>
<li><p><a class="reference internal" href="#experimental-infix-operators" id="id42">Experimental infix operators <span class="docutils literal">//, /:</span></a></p></li>
<li><p><a class="reference internal" href="#comparison-operators" id="id43">Comparison operators <span class="docutils literal">&lt;, &gt;, &lt;=, &gt;=, ==, !=</span></a></p></li>
<li><p><a class="reference internal" href="#pol-nutple-expression" id="id44"><span class="docutils literal"><span class="pre">pol(&lt;nutple</span> expression&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#lpol-nutple-expression" id="id45"><span class="docutils literal"><span class="pre">lpol(&lt;nutple</span> expression&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#xinteval-pol-expr" id="id46"><span class="docutils literal"><span class="pre">\xinteval{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#evalp-pol-expr-pol-expr" id="id47"><span class="docutils literal"><span class="pre">evalp(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. expr&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#deg-pol-expr" id="id48"><span class="docutils literal"><span class="pre">deg(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#coeffs-pol-expr" id="id49"><span class="docutils literal"><span class="pre">coeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#lcoeffs-pol-expr" id="id50"><span class="docutils literal"><span class="pre">lcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#coeff-pol-expr-num-expr" id="id51"><span class="docutils literal"><span class="pre">coeff(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;num. <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#lc-pol-expr" id="id52"><span class="docutils literal"><span class="pre">lc(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#monicpart-pol-expr" id="id53"><span class="docutils literal"><span class="pre">monicpart(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#cont-pol-expr" id="id54"><span class="docutils literal"><span class="pre">cont(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#primpart-pol-expr" id="id55"><span class="docutils literal"><span class="pre">primpart(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#quorem-pol-expr-pol-expr" id="id56"><span class="docutils literal"><span class="pre">quorem(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#quo-pol-expr-pol-expr" id="id57"><span class="docutils literal"><span class="pre">quo(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#rem-pol-expr-pol-expr" id="id58"><span class="docutils literal"><span class="pre">rem(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#prem-pol-expr-1-pol-expr-2" id="id59"><span class="docutils literal"><span class="pre">prem(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#divmod-pol-expr-1-pol-expr-2" id="id60"><span class="docutils literal"><span class="pre">divmod(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#mod-pol-expr-1-pol-expr-2" id="id61"><span class="docutils literal"><span class="pre">mod(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#polgcd-pol-expr-1-pol-expr-2" id="id62"><span class="docutils literal"><span class="pre">polgcd(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;, <span class="pre">...)</span></span></a></p></li>
<li><p><a class="reference internal" href="#resultant-pol-expr-1-pol-expr-2" id="id63"><span class="docutils literal"><span class="pre">resultant(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#disc-pol-expr" id="id64"><span class="docutils literal"><span class="pre">disc(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#polpowmod-pol-expr-1-num-expr-pol-expr-2" id="id65"><span class="docutils literal"><span class="pre">polpowmod(&lt;pol.</span> expr. 1&gt;, &lt;num. <span class="pre">expr.&gt;,</span> &lt;pol. expr. 2&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#rdcoeffs-pol-expr" id="id66"><span class="docutils literal"><span class="pre">rdcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#rdzcoeffs-pol-expr" id="id67"><span class="docutils literal"><span class="pre">rdzcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#diff1-pol-expr" id="id68"><span class="docutils literal"><span class="pre">diff1(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#diff2-pol-expr" id="id69"><span class="docutils literal"><span class="pre">diff2(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></p></li>
<li><p><a class="reference internal" href="#diffn-pol-expr-p-num-expr-n" id="id70"><span class="docutils literal"><span class="pre">diffn(&lt;pol.</span> expr. P&gt;, &lt;num. expr. n&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#antider-pol-expr-p" id="id71"><span class="docutils literal"><span class="pre">antider(&lt;pol.</span> expr. P&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#intfrom-pol-expr-p-pol-expr-c" id="id72"><span class="docutils literal"><span class="pre">intfrom(&lt;pol.</span> expr. P&gt;, &lt;pol. expr. c&gt;)</span></a></p></li>
<li><p><a class="reference internal" href="#integral-pol-expr-p-pol-expr-a-pol-expr-b" id="id73"><span class="docutils literal"><span class="pre">integral(&lt;pol.</span> expr. P&gt;, [&lt;pol. expr. a&gt;, &lt;pol. expr. <span class="pre">b&gt;])</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#examples-of-localization-of-roots" id="id74">Examples of localization of roots</a></p>
<ul>
<li><p><a class="reference internal" href="#a-typical-example" id="id75">A typical example</a></p></li>
<li><p><a class="reference internal" href="#a-degree-four-polynomial-with-nearby-roots" id="id76">A degree four polynomial with nearby roots</a></p></li>
<li><p><a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots" id="id77">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</a></p></li>
<li><p><a class="reference internal" href="#a-degree-five-polynomial-with-three-rational-roots" id="id78">A degree five polynomial with three rational roots</a></p></li>
<li><p><a class="reference internal" href="#a-mignotte-type-polynomial" id="id79">A Mignotte type polynomial</a></p></li>
<li><p><a class="reference internal" href="#the-wilkinson-polynomial" id="id80">The Wilkinson polynomial</a></p></li>
<li><p><a class="reference internal" href="#the-second-wilkinson-polynomial" id="id81">The second Wilkinson polynomial</a></p></li>
<li><p><a class="reference internal" href="#the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots" id="id82">The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots</a></p></li>
<li><p><a class="reference internal" href="#roots-of-chebyshev-polynomials" id="id83">Roots of Chebyshev polynomials</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#non-expandable-macros" id="id84">Non-expandable macros</a></p>
<ul>
<li><p><a class="reference internal" href="#poldef-polname-letter-expression-using-the-letter-as-indeterminate" id="id85"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></p></li>
<li><p><a class="reference internal" href="#poldef-letter-polname-expr-using-the-letter-as-indeterminate" id="id86"><span class="docutils literal"><span class="pre">\PolDef[&lt;letter&gt;]{&lt;polname&gt;}{&lt;expr.</span> using the letter as indeterminate&gt;}</span></a></p></li>
<li><p><a class="reference internal" href="#polgenfloatvariant-polname" id="id87"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltypeset-pol-expr" id="id88"><span class="docutils literal"><span class="pre">\PolTypeset{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#poltypesetcmd-raw-coeff" id="id89"><span class="docutils literal"><span class="pre">\PolTypesetCmd{&lt;raw_coeff&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#polifcoeffisplusorminusone-t-f" id="id90"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#poltypesetone-raw-coeff" id="id91"><span class="docutils literal"><span class="pre">\PolTypesetOne{&lt;raw_coeff&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#id9" id="id92"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></p></li>
<li><p><a class="reference internal" href="#poltypesetcmdprefix-raw-coeff" id="id93"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{&lt;raw_coeff&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#id11" id="id94"><span class="docutils literal"><span class="pre">\PolTypeset*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#non-expandable-macros-related-to-the-root-localization-routines" id="id95">Non-expandable macros related to the root localization routines</a></p>
<ul>
<li><p><a class="reference internal" href="#poltosturm-polname-sturmname" id="id96"><span class="docutils literal"><span class="pre">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#id13" id="id97"><span class="docutils literal"><span class="pre">\PolToSturm*{&lt;polname&gt;}{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatezeros-sturmname" id="id98"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#id15" id="id99"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#polsturmisolatezerosandgetmultiplicities-sturmname" id="id100"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{&lt;sturmname&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#id17" id="id101"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname" id="id102"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{&lt;sturmname&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#polsturmisolatezerosandfindrationalroots-sturmname" id="id103"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polrefineinterval-sturmname-index" id="id104"><span class="docutils literal"><span class="pre">\PolRefineInterval*{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polrefineinterval-n-sturmname-index" id="id105"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polensureintervallength-sturmname-index-exponent" id="id106"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{&lt;sturmname&gt;}{&lt;index&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polensureintervallengths-sturmname-exponent" id="id107"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{&lt;sturmname&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervals-varname-sturmname" id="id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals[&lt;varname&gt;]{&lt;sturmname&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#polprintintervalsnorealroots" id="id109"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsbeginenv" id="id110"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsendenv" id="id111"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsknownroot" id="id112"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsunknownroot" id="id113"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></p></li>
<li><p><a class="reference internal" href="#id18" id="id114"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></p></li>
<li><p><a class="reference internal" href="#id19" id="id115"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></p></li>
<li><p><a class="reference internal" href="#id20" id="id116"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#id22" id="id117"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[&lt;varname&gt;]{&lt;sturmname&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#polprintintervalsprintmultiplicity" id="id118"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#polsettosturmchainsignchangesat-foo-sturmname-value" id="id119"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{&lt;sturmname&gt;}{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsettonbofzeroswithin-foo-sturmname-value-left-value-right" id="id120"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{&lt;sturmname&gt;}{&lt;value_left&gt;}{&lt;value_right&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#pollet-polname-2-polname-1" id="id121"><span class="docutils literal"><span class="pre">\PolLet{&lt;polname_2&gt;}={&lt;polname_1&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polgloballet-polname-2-polname-1" id="id122"><span class="docutils literal"><span class="pre">\PolGlobalLet{&lt;polname_2&gt;}={&lt;polname_1&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polassign-polname-toarray-macro" id="id123"><span class="docutils literal"><span class="pre">\PolAssign{&lt;polname&gt;}\toarray\macro</span></span></a></p></li>
<li><p><a class="reference internal" href="#polget-polname-fromarray-macro" id="id124"><span class="docutils literal"><span class="pre">\PolGet{&lt;polname&gt;}\fromarray\macro</span></span></a></p></li>
<li><p><a class="reference internal" href="#polfromcsv-polname-csv" id="id125"><span class="docutils literal"><span class="pre">\PolFromCSV{&lt;polname&gt;}{&lt;csv&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polmapcoeffs-macro-polname" id="id126"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polreducecoeffs-polname" id="id127"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#id24" id="id128"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polmakemonic-polname" id="id129"><span class="docutils literal"><span class="pre">\PolMakeMonic{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polmakeprimitive-polname" id="id130"><span class="docutils literal"><span class="pre">\PolMakePrimitive{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poldiff-polname-1-polname-2" id="id131"><span class="docutils literal"><span class="pre">\PolDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poldiff-n-polname-1-polname-2" id="id132"><span class="docutils literal"><span class="pre">\PolDiff[N]{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polantidiff-polname-1-polname-2" id="id133"><span class="docutils literal"><span class="pre">\PolAntiDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polantidiff-n-polname-1-polname-2" id="id134"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poldivide-polname-1-polname-2-polname-q-polname-r" id="id135"><span class="docutils literal"><span class="pre">\PolDivide{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_Q&gt;}{&lt;polname_R&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polquo-polname-1-polname-2-polname-q" id="id136"><span class="docutils literal"><span class="pre">\PolQuo{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_Q&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polrem-polname-1-polname-2-polname-r" id="id137"><span class="docutils literal"><span class="pre">\PolRem{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_R&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polgcd-polname-1-polname-2-polname-gcd" id="id138"><span class="docutils literal"><span class="pre">\PolGCD{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_GCD&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#expandable-macros" id="id139">Expandable macros</a></p>
<ul>
<li><p><a class="reference internal" href="#poltoexpr-pol-expr" id="id140"><span class="docutils literal"><span class="pre">\PolToExpr{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#id27" id="id141"><span class="docutils literal">\PolToExprVar</span></a></p></li>
<li><p><a class="reference internal" href="#poltoexprinvar" id="id142"><span class="docutils literal">\PolToExprInVar</span></a></p></li>
<li><p><a class="reference internal" href="#id28" id="id143"><span class="docutils literal">\PolToExprTimes</span></a></p></li>
<li><p><a class="reference internal" href="#poltoexprcaret" id="id144"><span class="docutils literal">\PolToExprCaret</span></a></p></li>
<li><p><a class="reference internal" href="#poltoexprcmd-raw-coeff" id="id145"><span class="docutils literal"><span class="pre">\PolToExprCmd{&lt;raw_coeff&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltoexproneterm-raw-coeff-exponent" id="id146"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltoexpronetermstylea-raw-coeff-exponent" id="id147"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltoexpronetermstyleb-raw-coeff-exponent" id="id148"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltoexprtermprefix-raw-coeff" id="id149"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{&lt;raw_coeff&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#poltofloatexpr-pol-expr" id="id150"><span class="docutils literal"><span class="pre">\PolToFloatExpr{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p>
<ul>
<li><p><a class="reference internal" href="#poltofloatexproneterm-raw-coeff-exponent" id="id151"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltofloatexprcmd-raw-coeff" id="id152"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{&lt;raw_coeff&gt;}</span></span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#id30" id="id153"><span class="docutils literal"><span class="pre">\PolToExpr*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#id32" id="id154"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polnthcoeff-polname-index" id="id155"><span class="docutils literal"><span class="pre">\PolNthCoeff{&lt;polname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polleadingcoeff-polname" id="id156"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poldegree-polname" id="id157"><span class="docutils literal"><span class="pre">\PolDegree{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#policontent-polname" id="id158"><span class="docutils literal"><span class="pre">\PolIContent{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltolist-polname" id="id159"><span class="docutils literal"><span class="pre">\PolToList{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poltocsv-polname" id="id160"><span class="docutils literal"><span class="pre">\PolToCSV{&lt;polname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poleval-polname-atexpr-num-expr" id="id161"><span class="docutils literal"><span class="pre">\PolEval{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#poleval-polname-at-value" id="id162"><span class="docutils literal"><span class="pre">\PolEval{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polevalreduced-polname-atexpr-num-expr" id="id163"><span class="docutils literal"><span class="pre">\PolEvalReduced{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polevalreduced-polname-at-value" id="id164"><span class="docutils literal"><span class="pre">\PolEvalReduced{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polfloateval-polname-atexpr-num-expr" id="id165"><span class="docutils literal"><span class="pre">\PolFloatEval{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polfloateval-polname-at-value" id="id166"><span class="docutils literal"><span class="pre">\PolFloatEval{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#expandable-macros-related-to-the-root-localization-routines" id="id167">Expandable macros related to the root localization routines</a></p>
<ul>
<li><p><a class="reference internal" href="#polsturmchainlength-sturmname" id="id168"><span class="docutils literal"><span class="pre">\PolSturmChainLength{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-t-f" id="id169"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{&lt;sturmname&gt;}{&lt;index&gt;}{T}{F}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatedzeroleft-sturmname-index" id="id170"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index" id="id171"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index" id="id172"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname" id="id173"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value" id="id174"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id175"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value" id="id176"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr" id="id177"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrationalroots-sturmname" id="id178"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrationalrootswithmultiplicities-sturmname" id="id179"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{&lt;sturmname&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalroot-sturmname-k" id="id180"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalrootindex-sturmname-k" id="id181"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalrootmultiplicity-sturmname-k" id="id182"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#polintervalwidth-sturmname-index" id="id183"><span class="docutils literal"><span class="pre">\PolIntervalWidth{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></p></li>
<li><p><a class="reference internal" href="#expandable-macros-for-use-within-execution-of-polprintintervals" id="id184">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthevar" id="id185"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalstheindex" id="id186"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthesturmname" id="id187"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalstheleftendpoint" id="id188"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalstherightendpoint" id="id189"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthemultiplicity" id="id190"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></p></li>
</ul>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="#booleans-with-default-setting-as-indicated" id="id191">Booleans (with default setting as indicated)</a></p>
<ul>
<li><p><a class="reference internal" href="#xintverbosefalse" id="id192"><span class="docutils literal">\xintverbosefalse</span></a></p></li>
<li><p><a class="reference internal" href="#polnewpolverbosefalse" id="id193"><span class="docutils literal">\polnewpolverbosefalse</span></a></p></li>
<li><p><a class="reference internal" href="#poltypesetallfalse" id="id194"><span class="docutils literal">\poltypesetallfalse</span></a></p></li>
<li><p><a class="reference internal" href="#poltoexprallfalse" id="id195"><span class="docutils literal">\poltoexprallfalse</span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#utilies" id="id196">Utilies</a></p>
<ul>
<li><p><a class="reference internal" href="#poldectostring-decimal-number" id="id197"><span class="docutils literal">\PolDecToString{decimal number}</span></a></p></li>
<li><p><a class="reference internal" href="#polexprsetup" id="id198"><span class="docutils literal">\polexprsetup</span></a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#technicalities" id="id199">Technicalities</a></p></li>
<li><p><a class="reference internal" href="#change-log" id="id200">CHANGE LOG</a></p></li>
<li><p><a class="reference internal" href="#acknowledgments" id="id201">Acknowledgments</a></p></li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id35">Usage</a></h1>
<p>The package can be used with TeX based formats incorporating the e-TeX
primitives.  The <span class="docutils literal">\expanded</span> primitive available generally since
TeXLive 2019 is required.</p>
<pre class="literal-block">\input polexpr.sty</pre>
<p>with Plain or other non-LaTeX macro formats, or:</p>
<pre class="literal-block">\usepackage{polexpr}</pre>
<p>with the LaTeX macro format.</p>
<p>The package requires <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4d</span> or later.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Until <span class="docutils literal">0.8</span> the package only had a LaTeX interface.  As a result,
parts of this documentation may still give examples using LaTeX syntax such
as <span class="docutils literal">\newcommand</span>.  Please convert to the syntax appropriate to the
TeX macro format used if needed.</p>
</div>
</div>
<div class="section" id="abstract">
<h1><a class="toc-backref" href="#id36">Abstract</a></h1>
<p>The package provides a parser <span class="docutils literal">\poldef</span> of algebraic polynomial
expressions.  As it is based on <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>
the coefficients are allowed to be arbitrary rational numbers.</p>
<p>Once defined, a polynomial is usable by its name either as a numerical
function in <span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span>, or for additional polynomial
definitions, or as argument to the package macros.  The localization of
real roots to arbitrary precision as well as the determination of all
rational roots is implemented via such macros.</p>
<p>Since release <span class="docutils literal">0.8</span>, polexpr extends the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>
syntax to recognize
polynomials as a new variable type (and not only as functions).
Functionality which previously was implemented via macros such as the
computation of a greatest common divisor is now available directly in
<span class="docutils literal">\xintexpr</span>, <span class="docutils literal">\xinteval</span> or <span class="docutils literal">\poldef</span> via infix or functional
syntax.</p>
</div>
<div class="section" id="prerequisites">
<h1><a class="toc-backref" href="#id37">Prerequisites</a></h1>
<ul>
<li><p>The user must have some understanding of TeX as a macro-expansion
based programming interface, and in particular of how <span class="docutils literal">\edef</span>
differs from <span class="docutils literal">\def</span>:  functionalities of the package as described in
the <a class="reference internal" href="#expandable-macros">Expandable macros</a> section are suitable for usage in <span class="docutils literal">\edef</span>,
<span class="docutils literal">\write</span> or <span class="docutils literal">\xinteval</span> context.  At <span class="docutils literal">0.8</span> some of these
macros have an even more convenient functional interface inside
<span class="docutils literal">\xinteval</span>, as is described in a <a class="reference internal" href="#polexpr08">dedicated section</a>.</p>
<p>Despite its name <span class="docutils literal">\poldef</span> is more to be seen as an <span class="docutils literal">\edef</span>
although it does not define a TeX macro (at user level); and of course
<span class="docutils literal">\edef</span> would do usually nothing on the typical input parsed by
<span class="docutils literal">\poldef</span> which generally has no backslash in it: but if this input
does contain macros, they will then be expanded fully and are supposed to
produce recognizable syntax elements in this expansion only context.</p>
<p>Note that the <span class="docutils literal">def</span> in <span class="docutils literal">\poldef</span> reminds us that the macro does
some assignments hence is not usable in expandable only context.  Its
whole point is rather to define entities which, them, can then be used
in the expandable only <span class="docutils literal">\xinteval</span> (or <span class="docutils literal">\poldef</span>) context.</p>
</li>
<li><p>The user must have some familiarity with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> and in
particular must know what <span class="docutils literal">\xintexpr</span>, <span class="docutils literal">\xinttheexpr</span>,
<span class="docutils literal">\xinteval</span> and <span class="docutils literal">\xintfloatexpr</span>, <span class="docutils literal">\xintthefloatexpr</span>,
<span class="docutils literal">\xintfloateval</span> mean and what are the good practices with them.</p></li>
<li><p>The user will become quickly aware that exact computations with
fractions easily lead to very big ones in very few steps; see
<a class="reference internal" href="#polreducecoeffs-polname">\PolReduceCoeffs{&lt;polname&gt;}</a> in this context.</p></li>
<li><p>Finally, it is mandatory to read the entire documentation before
starting to use the package.</p></li>
</ul>
</div>
<div class="section" id="quick-syntax-overview">
<h1><a class="toc-backref" href="#id38">Quick syntax overview</a></h1>
<p>The syntax to define a new polynomial is:</p>
<pre class="literal-block">\poldef polname(x):= expression in variable x;</pre>
<p>The package is focused on exact computations, so this expression will be
parsed by the services of <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> and accept arbitrarily big integers
or fractions.</p>
<p>If you are interested into numerical evaluations, for example for
plotting, it is advisable to use the <span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span>
context, as exact evaluations will quickly lead to manipulating numbers
with dozens of digits (when the number of digits exceeds five hundreds,
computation with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> will become noticeably too slow, if many
evaluations need to be done).  For the polynomial to be usable as a function in
floating point context, an extra step beyond <span class="docutils literal">\poldef</span> is required:
see <a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a>.</p>
<p>As a rule, the functionalities such as getting the degree, or getting
one coefficient, or taking derivatives, etc..., i.e. anything which
handles the polynomial as an entity and not only as a numerical
function, are only available in the <span class="docutils literal"><span class="pre">\poldef/\xintexpr/\xinteval</span></span>
context.  The <a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a> must be used each time the
polynomial gets modified or a new polynomial created out of it, if
continuing computations in <span class="docutils literal">\xintfloatexpr</span> are to follow.  But (see
<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation) one can always use a sub-expression such as
<span class="docutils literal">\xintexpr <span class="pre">deg(P)\relax</span></span> as sub-component inside a
<span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span>.</p>
<p>Conversely if perhaps the coefficients of your polynomial have become
too gigantic and you would like to replace them with some approximation
to keep on working in <span class="docutils literal">\xinteval</span>, not necessarily <span class="docutils literal">\xintfloateval</span>,
see <a class="reference internal" href="#polmapcoeffs">\PolMapCoeffs</a> which can be used for example with <span class="docutils literal">\xintFloat</span>
macro to make the float-rounding applied to the exact coefficients.</p>
<ul>
<li><p>In place of <span class="docutils literal">x</span> an arbitrary <em>dummy variable</em> is authorized,
i.e. per default one <span class="docutils literal">a, .., z, A, .., Z</span> (more letters can be declared
under Unicode engines).</p></li>
<li><p><span class="docutils literal">polname</span> consists of letters, digits, and the <span class="docutils literal">_</span> and <span class="docutils literal">'</span>
characters.  It <strong>must</strong> start with a letter: do not use the
underscore <span class="docutils literal">_</span> as <em>first character</em> of a polynomial name (even
if of catcode letter).  No warning is emitted but dire consequences
will result.</p>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>The <span class="docutils literal">&#64;</span> is usable too, independently of whether it is of catcode
letter or other.  This has always been the case, but was not
documented by polexpr prior to <span class="docutils literal">0.8</span>, as the author has never
found the time to provide some official guidelines on how to name
temporary variables and the <span class="docutils literal">&#64;</span> is used already as such internally
to package; time has still not yet been found for <span class="docutils literal">0.8</span> to review
the situation but it seems reasonable to recommend at any rate to
restrict usage of <span class="docutils literal">&#64;</span> to scratch variables of defined macros and
to avoid using it to name document variable.</p>
</div>
</li>
<li><p>The colon before the equality sign is optional and its (reasonable)
catcode does not matter.</p></li>
<li><p>The semi-colon at the end of the expression is mandatory.  Some
contexts (such as (pdf)LaTeX with babel+frenchb) modify its catcode.
If at top level, <span class="docutils literal">\poldef</span> resets temporarily the semi-colon catcode
before fetching the expression, so is immune to this.  There is also
naturally no problem either if <span class="docutils literal">\poldef</span> is used in the replacement
text of some other macro which is defined at a time the <span class="docutils literal">;</span> has its
standard catcode, as is the case in LaTeX in the document preamble,
even with babel+french loaded.</p>
<p>The semi-colon intervenes in certain <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax elements, within
parentheses.  This (except if the inner semi-colons are hidden within
braces: <span class="docutils literal">{;}</span>) will break <span class="docutils literal">\poldef</span> which, contrarily to
<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>'s <span class="docutils literal">\xintdefvar</span>, does not balance parentheses when
fetching the semi-colon delimited polynomial expression.</p>
</li>
</ul>
<p>Problems with the semi-colon are avoided via an alternative syntax:</p>
<pre class="literal-block">\PolDef[optional letter]{&lt;polname&gt;}{&lt;expr. using letter as indeterminate&gt;}</pre>
<p>The <span class="docutils literal">\PolDef</span> optional first argument defaults to <span class="docutils literal">x</span> and must be
used as the indeterminate in the expression.</p>
<p><span class="docutils literal">\poldef <span class="pre">f(x):=</span> 1 - x + quo(x^5,1 - x + x^2);</span></p>
<dl>
<dt><span class="docutils literal"><span class="pre">\PolDef{f}{1</span> - x + quo(x^5,1 - x + x^2)}</span></dt>
<dd><p>Both parse the polynomial
expression, and convert it internally (currently) to the list
of its coefficients from the constant term to the highest degree
term.</p>
<p>The polynomial can then be used in further polynomial definitions or
serve as argument to package macros, or as a variable in various
functions which will be <a class="reference internal" href="#polexpr08">described later</a>.</p>
</dd>
</dl>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>Euclidean quotient is mapped to the function <span class="docutils literal">quo()</span> (as shown
in the example above), but
for backwards compatibility one can currently still use the <span class="docutils literal">/</span>
infix operator:</p>
<pre class="literal-block">\poldef f(x):= 1 - x + x^5/(1 - x + x^2);</pre>
<p>Due to precedence rules the first operand is <span class="docutils literal">x^5</span>, not of course
<span class="docutils literal"><span class="pre">1-x+x^5</span></span>.</p>
<p>Note that <span class="docutils literal"><span class="pre">(1-x^2)/(1-x)</span></span> produces <span class="docutils literal">1+x</span>
but <span class="docutils literal"><span class="pre">(1/(1-x))*(1-x^2)</span></span> produces zero!  One also has to be aware
of some precedence rules, for example:</p>
<pre class="literal-block">\poldef k(x):= (x-1)(x-2)(x-3)(x-4)/(x^2-5x+4);</pre>
<p>does compute a degree 2 polynomial because the tacit multiplication
ties more than the division operator.</p>
<p>In short, it is safer to use the <span class="docutils literal">quo()</span> function which avoids
surprises.</p>
</div>
<div class="admonition attention" id="warningtacit">
<p class="admonition-title">Attention!</p>
<p>Tacit multiplication means that
<span class="docutils literal">1/2 x^2</span> skips the space and is treated like <span class="docutils literal"><span class="pre">1/(2*x^2)</span></span>.
But then it gives zero!</p>
<p>Thus one must use <span class="docutils literal">(1/2)x^2</span> or <span class="docutils literal">1/2*x^2</span> or
<span class="docutils literal"><span class="pre">(1/2)*x^2</span></span> for disambiguation: <span class="docutils literal">x - 1/2*x^2 + <span class="pre">1/3*x^3...</span></span>. It is
simpler to move the denominator to the right: <span class="docutils literal">x - x^2/2 + x^3/3 - ...</span>.</p>
<p>It is worth noting that <span class="docutils literal"><span class="pre">1/2(x-1)(x-2)</span></span> suffers the same issue:
<a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>'s tacit multiplication always &quot;ties more&quot;, hence this
gets interpreted as <span class="docutils literal"><span class="pre">1/(2*(x-1)*(x-2))</span></span> which gives zero by
polynomial division. Thus, use in such cases one of
<span class="docutils literal"><span class="pre">(1/2)(x-1)(x-2)</span></span>, <span class="docutils literal"><span class="pre">1/2*(x-1)(x-2)</span></span> or <span class="docutils literal"><span class="pre">(x-1)(x-2)/2</span></span>.</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The package does not currently know rational functions, but in order
to leave open this as a future possibility, the usage of <span class="docutils literal">/</span> to stand
for the
euclidean quotient is <strong>deprecated</strong>.</p>
<p>Please start using rather the <span class="docutils literal">quo()</span> function.  It is possible
that in a future major release <span class="docutils literal">A/B</span> with <span class="docutils literal">B</span> a non-scalar will
raise an error.  Or, who knows, rational functions will be
implemented sometime during the next decades, and then <span class="docutils literal">A/B</span> will
naturally be the rational function.</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p><span class="docutils literal">\poldef <span class="pre">P(x):=...;</span></span> defines <span class="docutils literal">P</span> both as a <em>function</em>,
to be used as:</p>
<pre class="literal-block">P(..numeric or even polynomial expression..)</pre>
<p>and as a <em>variable</em> which can used inside polynomial expressions or
as argument to some polynomial specific functions such as <span class="docutils literal">deg()</span>
or <span class="docutils literal">polgcd()</span> <a class="footnote-reference brackets" href="#id3" id="id2">1</a>.</p>
<dl class="footnote brackets">
<dt class="label" id="id3"><span class="brackets"><a class="fn-backref" href="#id2">1</a></span></dt>
<dd><p>Functional syntax accepts expressions as arguments; but the
TeX <strong>macros</strong> described in the documentation, even the
expandable ones, work only (there are a few exceptions to the
general rule) with arguments being <em>names of declared
polynomials</em>.</p>
</dd>
</dl>
<p>One needs to have a clear understanding of the difference between
<span class="docutils literal">P</span> used a function  and <span class="docutils literal">P</span> used as a variable: if <span class="docutils literal">P</span> and
<span class="docutils literal">Q</span> are both declared polynomials then:</p>
<pre class="literal-block">(P+Q)(3)%  &lt;--- attention!</pre>
<p>is currently evaluated as <span class="docutils literal"><span class="pre">(P+Q)*3</span></span>, because <span class="docutils literal">P+Q</span> is not known
as a <em>function</em>, but <em>only as a variable of polynomial type</em>.
Even worse:</p>
<pre class="literal-block">(P)(3)%  &lt;--- attention!</pre>
<p>will compute <span class="docutils literal">P*3</span>, because one can not in current <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax
enclose a function name in parentheses: consequently it is the variable
which is used here.  There is a <em>meager possibility</em> that in future
some internal changes to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> would let <span class="docutils literal"><span class="pre">(P)(3)</span></span> actually
compute <span class="docutils literal">P(3)</span> and <span class="docutils literal"><span class="pre">(P+Q)(3)</span></span> compute <span class="docutils literal">P(3) + Q(3)</span>, but note
that <span class="docutils literal"><span class="pre">(P)(P)</span></span> will then do <span class="docutils literal">P(P)</span> and not <span class="docutils literal">P*P</span>,
the latter, current interpretation, looking more
intuitive. Anyway, do not rely too extensively on tacit <span class="docutils literal">*</span> and use
explicit <span class="docutils literal"><span class="pre">(P+Q)*(1+2)</span></span> if this is what is intended.</p>
<p>As an alternative to explicit <span class="docutils literal"><span class="pre">P(3)+Q(3)</span></span> there is <span class="docutils literal">evalp(P+Q,3)</span>.</p>
</div>
<dl>
<dt><span class="docutils literal"><span class="pre">\PolLet{g}={f}</span></span></dt>
<dd><p>saves a copy of <span class="docutils literal">f</span> under name <span class="docutils literal">g</span>. Also usable without <span class="docutils literal">=</span>.</p>
<p>Has exactly the same effect as <span class="docutils literal">\poldef <span class="pre">g(x):=f;</span></span> or <span class="docutils literal">\poldef <span class="pre">g(w):=f(w);</span></span>.</p>
</dd>
<dt><span class="docutils literal">\poldef <span class="pre">f(z):=</span> f^2;</span></dt>
<dd><p>redefines <span class="docutils literal">f</span> in terms of itself.  Prior to <span class="docutils literal">0.8</span> one needed
the right hand side to be <span class="docutils literal"><span class="pre">f(z)^2</span></span>.  Also, now <span class="docutils literal">sqr(f)</span>  is
possible (also <span class="docutils literal">sqr(f(x))</span> but not <span class="docutils literal"><span class="pre">sqr(f)(x)</span></span>).</p>
<p>It may look strange that an indeterminate variable is used on
left-hand-side even though it may be absent of right-hand-side, as
it seems to define <span class="docutils literal">f</span> always as a polynomial function.</p>
<p>This is a legacy of pre-<span class="docutils literal">0.8</span> context.</p>
</dd>
</dl>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>Note that <span class="docutils literal">f^2(z)</span> or <span class="docutils literal"><span class="pre">sqr(f)(z)</span></span> will give a logical but
perhaps unexpected result: first <span class="docutils literal">f^2</span> is computed, then the
opening parenthesis is seen which inserts a tacit multiplication
<span class="docutils literal">*</span>, so in the end it is as if the input had been <span class="docutils literal">f^2 * z</span>.
Although <span class="docutils literal">f</span> is both a variable and a function, <span class="docutils literal">f^2</span> is
computed as a polynomial <em>variable</em> and ceases being a function.</p>
</div>
<dl>
<dt><span class="docutils literal">\poldef <span class="pre">f(T):=</span> f(f);</span></dt>
<dd><p>again modifies <span class="docutils literal">f</span>.  Here it is used both as variable and as
a function.  Prior to <span class="docutils literal">0.8</span> it needed to be <span class="docutils literal">f(f(T))</span>.</p>
</dd>
<dt><span class="docutils literal">\poldef <span class="pre">k(z):=</span> <span class="pre">f-g(g^2)^2;</span></span></dt>
<dd><p>if everybody followed, this should now define the zero polynomial...
And <span class="docutils literal"><span class="pre">f-sqr(g(sqr(g)))</span></span> computes the same thing.</p>
<p>We can check this in a typeset document like this:</p>
<pre class="literal-block">\poldef f(x):= 1 - x + quo(x^5,1 - x + x^2);%
\PolLet{g}={f}%
\poldef f(z):= f^2;%
\poldef f(T):= f(f);%
\poldef k(w):= f-sqr(g(sqr(g)));%
$$f(x) = \vcenter{\hsize10cm \PolTypeset{f}} $$
$$g(z) = \PolTypeset{g} $$
$$k(z) = \PolTypeset{k} $$
\immediate\write128{f(x)=\PolToExpr{f}}% ah, here we see it also</pre>
</dd>
<dt><span class="docutils literal">\poldef <span class="pre">f'(x):=</span> diff1(f);</span></dt>
<dd><p>(new at <span class="docutils literal">0.8</span>)</p>
</dd>
<dt><span class="docutils literal"><span class="pre">\PolDiff{f}{f'}</span></span></dt>
<dd><p>Both set <span class="docutils literal">f'</span> (or any other chosen name) to the derivative
of <span class="docutils literal">f</span>.</p>
</dd>
</dl>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>This is not done automatically. If some new definition needs to use
the derivative of some available polynomial, that derivative
polynomial must have been previously defined: something such as
<span class="docutils literal"><span class="pre">f'(3)^2</span></span> will not work without a prior definition of <span class="docutils literal">f'</span>.</p>
<p>But one can now use <span class="docutils literal">diff1(f)</span> for on-the-spot construction with no
permanent declaration, so here <span class="docutils literal"><span class="pre">evalp(diff1(f),3)^2</span></span>. And
<span class="docutils literal"><span class="pre">diff1(f)^2</span></span> is same as <span class="docutils literal"><span class="pre">f'^2</span></span>, assuming here <span class="docutils literal">f'</span> was declared
to be the derived polynomial.</p>
<p>Notice that the name <span class="docutils literal">diff1()</span> is experimental and may change. Use
<span class="docutils literal"><span class="pre">\PolDiff{f}{f'}</span></span> as the stable interface.</p>
</div>
<dl>
<dt><span class="docutils literal">\PolTypeset{P}</span></dt>
<dd><p>Typesets (switching to math mode if in text mode):</p>
<pre class="literal-block">\poldef f(x):=(3+x)^5;%
\PolDiff{f}{f'}\PolDiff{f'}{f''}\PolDiff{f''}{f'''}%
$$f(z)   = \PolTypeset[z]{f}    $$
$$f'(z)  = \PolTypeset[z]{f'}   $$
$$f''(z) = \PolTypeset[z]{f''}  $$
$$f'''(z)= \PolTypeset[z]{f'''} $$</pre>
<p>See <a class="reference internal" href="#poltypeset">the documentation</a> for the configurability
via macros.</p>
<p>Since <span class="docutils literal">0.8</span> <a class="reference internal" href="#poltypeset">\PolTypeset</a> accepts directly an
expression, it does not have to be a pre-declared polynomial name:</p>
<pre class="literal-block">\PolTypeset{mul(x-i,i=1..5)}</pre>
</dd>
<dt><span class="docutils literal">\PolToExpr{P}</span></dt>
<dd><p>Expandably (contrarily to <a class="reference internal" href="#poltypeset">\PolTypeset</a>)
produces <span class="docutils literal">c_n*x^n + ... + c_0</span> starting from the leading
coefficient.  The <span class="docutils literal">+</span> signs are omitted if followed by negative
coefficients.</p>
<p>This is useful for console or file output.  This syntax is Maple and
PSTricks <span class="docutils literal">\psplot[algebraic]</span> compatible; and also it is
compatible with <span class="docutils literal">\poldef</span> input syntax, of course.  See
<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a> for configuration of the <span class="docutils literal">^</span>, for example to
use rather <span class="docutils literal">**</span> for Python syntax compliance.</p>
<p>Changed at <span class="docutils literal">0.8</span>: the <span class="docutils literal">^</span> in output is by default of catcode 12
so in a draft document one can use <span class="docutils literal">\PolToExpr{P}</span> inside the
typesetting flow (without requiring math mode, where the <span class="docutils literal">*</span> would
be funny and <span class="docutils literal">^12</span> would only put the <span class="docutils literal">1</span> as exponent anyhow;
but arguably in text mode the <span class="docutils literal">+</span> and <span class="docutils literal">-</span> are not satisfactory
for math, except sometimes in monospace typeface, and anyhow TeX is
unable to break the expression across lines, barring special help).</p>
<p>See <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{&lt;pol. expr.&gt;}</a> and related macros for customization.</p>
<p>Extended at <span class="docutils literal">0.8</span> to accept as argument not only the name of a
polynomial variable but more generally any polynomial expression.</p>
</dd>
</dl>
</div>
<div class="section" id="the-polexpr-0-8-extensions-to-the-xintexpr-syntax">
<span id="polexpr08"></span><h1><a class="toc-backref" href="#id39">The polexpr <span class="docutils literal">0.8</span> extensions to the <span class="docutils literal">\xintexpr</span> syntax</a></h1>
<p>All the syntax elements described in this section can be used in the
<span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span> context (where polynomials can be obtained from
the <span class="docutils literal"><span class="pre">pol([])</span></span> constructor, once polexpr is loaded):  their usage is
not limited to only <span class="docutils literal">\poldef</span> context.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If a variable <span class="docutils literal">myPol</span> defined via <span class="docutils literal">\xintdefvar</span> turns out
to be a polynomial, the difference with those declared via <span class="docutils literal">\poldef</span>
will be:</p>
<ol class="arabic">
<li><p><span class="docutils literal">myPol</span> is not usable as <em>function</em>, but only as a variable.
Attention that <span class="docutils literal">f(x)</span> if <span class="docutils literal">f</span> is only a variable (even a
polynomial one) will actually compute <span class="docutils literal">f * x</span>.</p></li>
<li><p><span class="docutils literal">myPol</span> is not known to the polexpr package, hence for example the
macros to achieve localization of its roots are unavailable.</p>
<p>In a parallel universe I perhaps have implemented this expandably
which means it could then be accessible with syntax such as
<span class="docutils literal"><span class="pre">rightmostroot(pol([42,1,34,2,-8,1]))</span></span> but...</p>
</li>
</ol>
</div>
<div class="section" id="warning-about-unstability-of-the-new-syntax">
<h2><a class="toc-backref" href="#id40">Warning about unstability of the new syntax</a></h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Consider the entirety of this section as <strong>UNSTABLE</strong> and
<strong>EXPERIMENTAL</strong> (except perhaps regarding <span class="docutils literal">+</span>, <span class="docutils literal">-</span> and <span class="docutils literal">*</span>).</p>
<p>And this applies even to items not explicitly flagged with one of
<strong>unstable</strong>, <strong>Unstable</strong>, or <strong>UNSTABLE</strong> which only reflect that
documentation was written over a period of time exceeding one minute,
enough for the author mood changes to kick in.</p>
<p>It is hard to find good names at the start of a life-long extension
program of functionalities, and perhaps in future it will be
preferred to rename everything or give to some functions other
meanings.  Such quasi-complete renamings happened already a few times
during the week devoted to development.</p>
</div>
</div>
<div class="section" id="infix-operators">
<h2><a class="toc-backref" href="#id41">Infix operators <span class="docutils literal">+, <span class="pre">-,</span> *, /, **, ^</span></a></h2>
<blockquote>
<p>As has been explained in the <a class="reference internal" href="#quick-syntax-overview">Quick syntax overview</a> these infix
operators have been made polynomial aware, not only in the
<span class="docutils literal">\poldef</span> context, but generally in any <span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span>
context, inclusive of <span class="docutils literal">\xintdeffunc</span>.</p>
<p>Conversely functions declared via <span class="docutils literal">\xintdeffunc</span> and making use of
these operators will automatically be able to accept polynomials
declared from <span class="docutils literal">\poldef</span> as variables.</p>
<p>Usage of <span class="docutils literal">/</span> for euclidean division of polynomials is <strong>deprecated</strong>.
Only in case of a scalar denominator is it to be considered stable.
Please use rather <span class="docutils literal">quo()</span>.</p>
</blockquote>
</div>
<div class="section" id="experimental-infix-operators">
<h2><a class="toc-backref" href="#id42">Experimental infix operators <span class="docutils literal">//, /:</span></a></h2>
<blockquote>
<p>Here is the tentative behaviour of <span class="docutils literal"><span class="pre">A//B</span></span> according to types:</p>
<ul class="simple">
<li><p><span class="docutils literal">A</span> non scalar and <span class="docutils literal">B</span> non scalar: euclidean quotient,</p></li>
<li><p><span class="docutils literal">A</span> scalar and <span class="docutils literal">B</span> scalar: floored division,</p></li>
<li><p><span class="docutils literal">A</span> scalar and <span class="docutils literal">B</span> non scalar: produces zero,</p></li>
<li><p><span class="docutils literal">A</span> non scalar and <span class="docutils literal">B</span> scalar: coefficient per
coefficient floored division.</p></li>
</ul>
<p>This is an <strong>experimental</strong> overloading of the <span class="docutils literal">//</span> and <span class="docutils literal">/:</span>
from <span class="docutils literal">\xintexpr</span>.</p>
<p>The behaviour in the last case, but not only, is to be considerd
<strong>unstable</strong>. The alternative would be for <span class="docutils literal"><span class="pre">A//B</span></span> with <span class="docutils literal">B</span>
scalar to act as <span class="docutils literal">quo(A,B)</span>.  But, we have currently chosen to let
<span class="docutils literal">//B</span> for a scalar <span class="docutils literal">B</span> act coefficient-wise on the numerator.
Beware that it thus means it can be employed with the idea of doing
euclidean division only by checking that <span class="docutils literal">B</span> is non-scalar.</p>
<p>The <span class="docutils literal">/:</span> operator provides the associated remainder so always
<span class="docutils literal">A</span> is reconstructed from <span class="docutils literal"><span class="pre">(A//B)*B</span> + <span class="pre">A/:B</span></span>.</p>
<p>If <span class="docutils literal">:</span> is active character use <span class="docutils literal">/\string:</span> (it is safer to use
<span class="docutils literal">/\string :</span> if it is not known if <span class="docutils literal">:</span> has catcode other, letter,
or is active, but note that <span class="docutils literal">/:</span> is fine and needs no precaution if
<span class="docutils literal">:</span> has catcode letter, it is only an active <span class="docutils literal">:</span> which is
problematic, like for all other characters possibly used in an
expression).</p>
<blockquote>
<p><strong>UNSTABLE</strong></p>
<p>As explained above, there are (among other things) hesitations
about behaviour with <span class="docutils literal">pol2</span> a scalar.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="comparison-operators">
<h2><a class="toc-backref" href="#id43">Comparison operators <span class="docutils literal">&lt;, &gt;, &lt;=, &gt;=, ==, !=</span></a></h2>
<blockquote>
<p><strong>NOT YET IMPLEMENTED</strong></p>
<p>As the internal representation by <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> and <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> of
fractions does not currently require them to be in reduced terms,
such operations would be a bit costly as they could not benefit from
the <span class="docutils literal">\pdfstrcmp</span> engine primitive.  In fact <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> does not use
it yet anywhere, even for normalized pure integers, although it could
speed up signifcantly certain aspects of core arithmetic.</p>
<p>Equality of polynomials can currently be tested by computing the
difference, which is a bit costly.  And of course the <span class="docutils literal">deg()</span>
function allows comparing degrees.  In this context note the
following syntax:</p>
<pre class="literal-block">(deg(Q)) ?? { zero } { non-zero scalar } { non-scalar }</pre>
<p>for branching.</p>
</blockquote>
</div>
<div class="section" id="pol-nutple-expression">
<h2><a class="toc-backref" href="#id44"><span class="docutils literal"><span class="pre">pol(&lt;nutple</span> expression&gt;)</span></a></h2>
<blockquote>
<p>This converts a nutple <span class="docutils literal"><span class="pre">[c0,c1,...,cN]</span></span> into the polynomial
variable having these coefficients.  Attention that the square
brackets are <strong>mandatory</strong>, except of course if the argument is
actually an expression producing such a &quot;nutple&quot;.</p>
<blockquote>
<p>Currently, this process will not normalize the coefficients (such
as reducing to lowest terms), it only trims out the leading zero
coefficients.</p>
</blockquote>
<p>Inside <span class="docutils literal">\xintexpr</span>, this is the only (allowed) way to create ex
nihilo a polynomial variable; inside <span class="docutils literal">\poldef</span> it is an alternative
input syntax which is more efficient than typing <span class="docutils literal">c0 + c1 * x + c2 * x^2 + ...</span>.</p>
</blockquote>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>Whenever an expression with polynomials collapses to a constant, it
becomes a scalar.  There is currently no distinction during the
parsing of expressions by <span class="docutils literal">\poldef</span>
or <span class="docutils literal">\xintexpr</span> between constant polynomial variables and scalar
variables.</p>
<p>Naturally, <span class="docutils literal">\poldef</span> can be used to declare a constant polynomial
<span class="docutils literal">P</span>, then <span class="docutils literal">P</span> can also be used as function having a value
independent of argument, but as a variable, it is non-distinguishable
from a scalar (of course functions such as <span class="docutils literal">deg()</span> tacitly
consider scalars to be constant polynomials).</p>
<p>Notice that we tend to use the vocable &quot;variable&quot; to refer to
arbitrary expressions used as function arguments, without implying
that we are actually referring to pre-declared variables in the sense
of <span class="docutils literal">\xintdefvar</span>.</p>
</div>
</div>
<div class="section" id="lpol-nutple-expression">
<span id="lpol"></span><h2><a class="toc-backref" href="#id45"><span class="docutils literal"><span class="pre">lpol(&lt;nutple</span> expression&gt;)</span></a></h2>
<blockquote>
<p>This converts a nutple <span class="docutils literal"><span class="pre">[cN,...,c1,c0]</span></span> into the polynomial
variable having these coefficients, with leading coefficients coming
first in the input.  Attention that the square brackets are
<strong>mandatory</strong>, except of course if the argument is actually an
expression producing such a &quot;nutple&quot;.</p>
<blockquote>
<p>Currently, this process will not normalize the coefficients (such
as reducing to lowest terms), it only trims out the leading zero
coefficients.</p>
<p><strong>NAME UNSTABLE</strong></p>
</blockquote>
<p>It can be used in <span class="docutils literal">\poldef</span> as an alternative input syntax, which
is more efficient than using the algebraic notation with monomials.</p>
<p>(new with <span class="docutils literal">0.8.1</span>, an empty nutple will cause breakage)</p>
</blockquote>
</div>
<div class="section" id="xinteval-pol-expr">
<h2><a class="toc-backref" href="#id46"><span class="docutils literal"><span class="pre">\xinteval{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>This is documented here for lack of a better place: it evaluates the
polynomial expression then outputs the &quot;string&quot; <span class="docutils literal"><span class="pre">pol([c0,</span> c1, <span class="pre">...,</span> cN])</span>
if the degree <span class="docutils literal">N</span> is at least one (and the usual scalar output else).</p>
<p>The &quot;pol&quot; word uses letter catcodes, which is actually mandatory for
this output to be usable as input, but it does not make sense to use
this inside <span class="docutils literal">\poldef</span> or <span class="docutils literal">\xintexpr</span> at it means basically
executing <span class="docutils literal"><span class="pre">pol(coeffs(..expression..))</span></span> which is but a convoluted
way to obtain the same result as <span class="docutils literal"><span class="pre">(..expression..)</span></span> (the
parentheses delimiting the polynomial expression).</p>
<p>For example, <span class="docutils literal"><span class="pre">\xinteval{(1+pol([0,1]))^10}</span></span> expands (in two steps)
to:</p>
<pre class="literal-block">pol([1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1])</pre>
<p>You do need loading polexpr for this, else of course <span class="docutils literal"><span class="pre">pol([])</span></span>
remains unknown to <span class="docutils literal">\xinteval{}</span> as well as the polynomial algebra !
This example can also be done as
<span class="docutils literal"><span class="pre">\xinteval{subs((1+x)^10,x=pol([0,1]))}</span></span>.</p>
<p>I hesitated using as output the polynomial notation as produced by
<a class="reference internal" href="#poltoexpr">\PolToExpr{}</a>, but finally opted for this.</p>
</blockquote>
</div>
<div class="section" id="evalp-pol-expr-pol-expr">
<h2><a class="toc-backref" href="#id47"><span class="docutils literal"><span class="pre">evalp(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. expr&gt;)</span></a></h2>
<blockquote>
<p>Evaluates the first argument as a polynomial function of the
second.  Usually the second argument will be scalar, but this is not
required:</p>
<pre class="literal-block">\poldef K(x):= evalp(-3x^3-5x+1,-27x^4+5x-2);</pre>
<p>If the first argument is an already declared polynomial <span class="docutils literal">P</span>, use
rather the functional form <span class="docutils literal">P()</span> (which can accept a numerical as
well as polynomial argument) as it is more efficient.</p>
<p>One can also use <span class="docutils literal">subs()</span> syntax <a class="footnote-reference brackets" href="#id5" id="id4">2</a> (see <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation):</p>
<pre class="literal-block">\poldef K(x):= subs(-3y^3-5y+1, y = -27x^4+5x-2);</pre>
<p>but the <span class="docutils literal">evalp()</span> will use a Horner evaluation scheme which is
usually more efficient.</p>
<dl class="footnote brackets">
<dt class="label" id="id5"><span class="brackets"><a class="fn-backref" href="#id4">2</a></span></dt>
<dd><p>by the way Maple uses the opposite, hence wrong, order
<span class="docutils literal"><span class="pre">subs(x=...,</span> P)</span> but was written before computer science
reached the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> heights.  However it makes validating
Maple results by polexpr sometimes cumbersome, but perhaps
they will update it at some point.</p>
</dd>
</dl>
<blockquote>
<p><strong>name unstable</strong></p>
<p><span class="docutils literal">poleval</span>? <span class="docutils literal">evalpol</span>?  <span class="docutils literal">peval</span>? <span class="docutils literal">evalp</span>? <span class="docutils literal">value</span>?
<span class="docutils literal">eval</span>? <span class="docutils literal">evalat</span>? <span class="docutils literal">eval1at2</span>? <span class="docutils literal">evalat2nd</span>?</p>
<p>Life is so complicated when one asks questions. Not everybody does,
though, as is amply demonstrated these days.</p>
<p><strong>syntax unstable</strong></p>
<p>I am hesitating about permuting the order of the arguments.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="deg-pol-expr">
<h2><a class="toc-backref" href="#id48"><span class="docutils literal"><span class="pre">deg(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>Computes the degree.</p>
</blockquote>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>As <span class="docutils literal">\xintexpr</span> does not yet support infinities, the degree of
the zero polynomial is <span class="docutils literal"><span class="pre">-1</span></span>.  Beware that this breaks additivity
of degrees, but <span class="docutils literal"><span class="pre">deg(P)&lt;0</span></span> correctly detects the zero polynomial,
and <span class="docutils literal"><span class="pre">deg(P)&lt;=0</span></span> detects scalars.</p>
</div>
</div>
<div class="section" id="coeffs-pol-expr">
<h2><a class="toc-backref" href="#id49"><span class="docutils literal"><span class="pre">coeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>Produces the nutple <span class="docutils literal"><span class="pre">[c0,c1,...,cN]</span></span> of coefficients. The highest
degree coefficient is always non zero (except for the zero
polynomial...).</p>
<blockquote>
<p><strong>name unstable</strong></p>
<p>I am considering in particular using <span class="docutils literal">polcoeffs()</span> to avoid
having to overload <span class="docutils literal">coeffs()</span> in future when matrix type
will be added to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="lcoeffs-pol-expr">
<span id="lcoeffs"></span><h2><a class="toc-backref" href="#id50"><span class="docutils literal"><span class="pre">lcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>Produces the nutple <span class="docutils literal"><span class="pre">[cN,....,c1,c0]</span></span> of coefficients, starting
with the highest degree coefficient.</p>
<p>(new with <span class="docutils literal">0.8.1</span>)</p>
</blockquote>
</div>
<div class="section" id="coeff-pol-expr-num-expr">
<h2><a class="toc-backref" href="#id51"><span class="docutils literal"><span class="pre">coeff(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;num. <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>As expected. Produces zero if the numerical index is negative or
higher than the degree.</p>
<blockquote>
<p><strong>name, syntax and output unstable</strong></p>
<p>I am hesitating with <span class="docutils literal">coeff(n,pol)</span> syntax and also perhaps using
<span class="docutils literal">polcoeff()</span> in order to avoid having to overload <span class="docutils literal">coeff()</span>
when matrix type will be added to <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>.</p>
<p>The current behaviour is at odds with legacy
<a class="reference internal" href="#polnthcoeff-polname-index">\PolNthCoeff{&lt;polname&gt;}{&lt;index&gt;}</a> regarding negative indices.
Accessing leading or sub-leading coefficients can be done with
other syntax, see <a class="reference internal" href="#lc-pol-expr">lc(&lt;pol. expr.&gt;)</a>, and in some contexts it
is useful to be able to rely on the fact that coefficients with
negative indices do vanish, so I am for time being maintaining this.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="lc-pol-expr">
<span id="lc"></span><h2><a class="toc-backref" href="#id52"><span class="docutils literal"><span class="pre">lc(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The leading coefficient. The same result can be obtained from
<span class="docutils literal"><span class="pre">coeffs(pol)[-1]</span></span>, which shows also how to generalize to access
sub-leading coefficients.  See the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation for
Python-like indexing syntax.</p>
</blockquote>
</div>
<div class="section" id="monicpart-pol-expr">
<h2><a class="toc-backref" href="#id53"><span class="docutils literal"><span class="pre">monicpart(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>Divides by the leading coefficient, except that <span class="docutils literal"><span class="pre">monicpart(0)==0</span></span>.</p>
<blockquote>
<p><strong>unstable</strong></p>
<p>Currently the coefficients are reduced to lowest terms (contrarily
to legacy behaviour of <a class="reference internal" href="#polmakemonic">\PolMakeMonic</a>), and
additionally the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> <span class="docutils literal">\xintREZ</span> macro is applied which
extracts powers of ten from numerator or denominator and stores
them internally separately. This is generally beneficial to
efficiency of multiplication.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="cont-pol-expr">
<span id="cont"></span><h2><a class="toc-backref" href="#id54"><span class="docutils literal"><span class="pre">cont(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The (fractional) greatest common divisor of the polynomial
coefficients. It is always produced as an irreducible (non-negative)
fraction.  According to Gauss theorem the content of a product is the
product of the contents.</p>
<blockquote>
<p><strong>name and syntax unstable</strong></p>
<p>At <span class="docutils literal">0.8</span> it was created as <span class="docutils literal">icontent()</span> to match the legacy
macro <a class="reference internal" href="#policontent">\PolIContent</a>, whose name in 2018 was
chosen in relation to Maple's function <span class="docutils literal">icontent()</span>, possibly
because at that time I had not seen that Maple also had a
<span class="docutils literal">content()</span> function.  Name changed at <span class="docutils literal">0.8.1</span>.</p>
<p>It will change syntax if in future multivariate polynomials are
supported, and <span class="docutils literal">icontent()</span> will then make a come-back.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="primpart-pol-expr">
<h2><a class="toc-backref" href="#id55"><span class="docutils literal"><span class="pre">primpart(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The quotient (except for the zero polynomial) by
<span class="docutils literal"><span class="pre">cont(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span>.  This is thus a polynomial with
integer coefficients having <span class="docutils literal">1</span> as greatest common divisor.  The
sign of the leading coefficient is the same as in the original.</p>
<p>And <span class="docutils literal"><span class="pre">primpart(0)==0</span></span>.</p>
<p>The trailing zeros of the integer coefficients are extracted
into a power of ten exponent part, in the internal representation.</p>
</blockquote>
</div>
<div class="section" id="quorem-pol-expr-pol-expr">
<h2><a class="toc-backref" href="#id56"><span class="docutils literal"><span class="pre">quorem(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>Produces a nutple <span class="docutils literal">[Q,R]</span> with <span class="docutils literal">Q</span> the euclidean quotient and
<span class="docutils literal">R</span> the remainder.</p>
<blockquote>
<p><strong>name unstable</strong></p>
<p><span class="docutils literal">poldiv()</span>?</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="quo-pol-expr-pol-expr">
<h2><a class="toc-backref" href="#id57"><span class="docutils literal"><span class="pre">quo(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The euclidean quotient.</p>
<p>The deprecated <span class="docutils literal">pol1/pol2</span> syntax computes the same polynomial.</p>
</blockquote>
</div>
<div class="section" id="rem-pol-expr-pol-expr">
<h2><a class="toc-backref" href="#id58"><span class="docutils literal"><span class="pre">rem(&lt;pol.</span> <span class="pre">expr.&gt;,</span> &lt;pol. <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The euclidean remainder. If <span class="docutils literal">pol2</span> is a (non-zero) scalar, this is
zero.</p>
<p>There is no infix operator associated to this, for lack of evident
notation.  Please advise.</p>
<p><span class="docutils literal">/:</span> can be used if one is certain that <span class="docutils literal">pol2</span> is of
degree at least one.  But read the warning about it being unstable
even in that case.</p>
</blockquote>
</div>
<div class="section" id="prem-pol-expr-1-pol-expr-2">
<span id="prem"></span><h2><a class="toc-backref" href="#id59"><span class="docutils literal"><span class="pre">prem(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></h2>
<blockquote>
<p>Produces a nutple <span class="docutils literal">[m, spR]</span> where <span class="docutils literal">spR</span> is the (special) pseudo
Euclidean remainder.  Its description is:</p>
<ul>
<li><p>the standard euclidean remainder <span class="docutils literal">R</span> is <span class="docutils literal">spR/m</span></p></li>
<li><p><span class="docutils literal">m = b^f</span> with <span class="docutils literal">b</span> equal to the <strong>absolute value</strong> of the
leading coefficient of <span class="docutils literal">pol2</span>,</p></li>
<li><p><span class="docutils literal">f</span> is the number of non-zero coefficients in the euclidean
quotient, if <span class="docutils literal"><span class="pre">deg(pol2)&gt;0</span></span> (even if the remainder vanishes).</p>
<p>If <span class="docutils literal">pol2</span> is a scalar however, the function outputs <span class="docutils literal">[1,0]</span>.</p>
</li>
</ul>
<p>With these definitions one can show that if both <span class="docutils literal">pol1</span> and
<span class="docutils literal">pol2</span> have integer coefficients, then this is also the case of
<span class="docutils literal">spR</span>, which makes its interest (and also <span class="docutils literal">m*Q</span> has integer
coefficients, with <span class="docutils literal">Q</span> the euclidean quotient, if <span class="docutils literal"><span class="pre">deg(pol2)&gt;0</span></span>).
Also, <span class="docutils literal">prem()</span> is computed faster than <span class="docutils literal">rem()</span> for such integer
coefficients polynomials.</p>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>If you want the euclidean quotient <span class="docutils literal">R</span> evaluated via <span class="docutils literal">spR/m</span>
(which may be faster, even with non integer coefficients) use
<span class="docutils literal"><span class="pre">subs(last(x)/first(x),x=prem(P,Q))</span></span> syntax as it avoids
computing <span class="docutils literal">prem(P,Q)</span> twice.  This does the trick both in
<span class="docutils literal">\poldef</span> or in <span class="docutils literal">\xintdefvar</span>.</p>
<p>However, as is explained in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation, using
such syntax in an <span class="docutils literal">\xintdeffunc</span> is (a.t.t.o.w) illusory, due to
technicalities of how <span class="docutils literal">subs()</span> gets converted into nested
expandable macros.  One needs an auxiliary function like this:</p>
<pre class="literal-block">\xintdeffunc lastoverfirst(x):=last(x)/first(x);
\xintdeffunc myR(x)=lastoverfirst(prem(x));</pre>
<p>Then, <span class="docutils literal">myR(pol1,pol2)</span> will evaluate <span class="docutils literal">prem(pol1,pol2)</span> only
once and compute a polynomial identical to the euclidean
remainder (internal representations of coefficients may differ).</p>
</div>
<p>In this case of integer coefficients polynomials, the polexpr
internal representation of the integer coefficients in the pseudo
remainder will be with unit denominators only if that was already the
case for those of <span class="docutils literal">pol1</span> and <span class="docutils literal">pol2</span> (no automatic reduction to
lowest terms is made prior or after computation).</p>
<p>Pay attention here that <span class="docutils literal">b</span> is the <strong>absolute value</strong> of the
leading coefficient of <span class="docutils literal">pol2</span>.  Thus the coefficients of the
pseudo-remainder have the same signs as those of the standard
remainder.  This diverges from Maple's function with the same name.</p>
</blockquote>
</div>
<div class="section" id="divmod-pol-expr-1-pol-expr-2">
<h2><a class="toc-backref" href="#id60"><span class="docutils literal"><span class="pre">divmod(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></h2>
<blockquote>
<p>Overloads the scalar <span class="docutils literal">divmod()</span> and associates it  with the
experimental <span class="docutils literal">//</span> and <span class="docutils literal">/:</span> as extended to the polynomial type.</p>
<p>In particular when both <span class="docutils literal">pol1</span> and <span class="docutils literal">pol2</span> are scalars, this is
the usual <span class="docutils literal">divmod()</span> (as in Python) and for <span class="docutils literal">pol1</span> and <span class="docutils literal">pol2</span>
non constant polynomials, this is the same as <span class="docutils literal">quorem()</span>.</p>
<blockquote>
<p><strong>Highly unstable</strong> overloading of <span class="docutils literal">\xinteval</span>'s  <span class="docutils literal">divmod()</span>.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="mod-pol-expr-1-pol-expr-2">
<h2><a class="toc-backref" href="#id61"><span class="docutils literal"><span class="pre">mod(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></h2>
<blockquote>
<p>The <span class="docutils literal">R</span> of the <span class="docutils literal">divmod()</span> output. Same as <span class="docutils literal">R</span> of <span class="docutils literal">quorem()</span>
when the second argument <span class="docutils literal">pol2</span> is of degree at least one.</p>
<blockquote>
<p><strong>Highly unstable</strong> overloading of <span class="docutils literal">\xinteval</span>'s  <span class="docutils literal">mod()</span>.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="polgcd-pol-expr-1-pol-expr-2">
<h2><a class="toc-backref" href="#id62"><span class="docutils literal"><span class="pre">polgcd(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;, <span class="pre">...)</span></span></a></h2>
<blockquote>
<p>Evaluates to the greatest common polynomial divisor of all the
polynomial inputs.  The output is a <strong>primitive</strong> (in particular,
with integer coefficients) polynomial.  It is zero if and only if all
inputs vanish.</p>
<p>Attention, there must be either at least two polynomial variables, or
alternatively, only one argument which then must be a bracketed list
or some expression or variable evaluating to such a &quot;nutple&quot; whose
items are polynomials (see the documentation of the scalar <span class="docutils literal">gcd()</span>
in <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>).</p>
<blockquote>
<p>The two variable case could (and was, during development) have been
defined at user level like this:</p>
<pre class="literal-block">\xintdeffunc polgcd_(P,Q):=
  (deg(Q))??{P}{1}{polgcd_(Q,primpart(last(prem(P,Q))))};
\xintdeffunc polgcd(P,Q):=polgcd_(primpart(P),primpart(Q));%</pre>
<p>This is basically what is done internally for two polynomials, up
to some internal optimizations.</p>
</blockquote>
<p><strong>UNSTABLE</strong></p>
<p>I hesitate between returning a <em>primitive</em> or a <em>monic</em> polynomial.
Maple returns a primitive polynomial if all inputs <a class="footnote-reference brackets" href="#id7" id="id6">3</a> have integer
coefficients, else it returns a monic polynomial, but this is
complicated technically for us to add such a check and would add
serious overhead.</p>
<p>Internally, computations are done using primitive
integer-coefficients polynomials (as can be seen in the function
template above).  So I decided finally to output a primitive
polynomial, as one can always apply <span class="docutils literal">monicpart()</span> to it.</p>
<p>Attention that this is at odds with behaviour of the legacy
<a class="reference internal" href="#polgcd">\PolGCD</a> (non expandable) macro.</p>
<dl class="footnote brackets">
<dt class="label" id="id7"><span class="brackets"><a class="fn-backref" href="#id6">3</a></span></dt>
<dd><p>actually, only two polynomial arguments are allowed by Maple's
<span class="docutils literal">gcd()</span> as far as I know.</p>
</dd>
</dl>
</blockquote>
</div>
<div class="section" id="resultant-pol-expr-1-pol-expr-2">
<h2><a class="toc-backref" href="#id63"><span class="docutils literal"><span class="pre">resultant(&lt;pol.</span> expr. 1&gt;, &lt;pol. expr. 2&gt;)</span></a></h2>
<blockquote>
<p>The resultant.</p>
<blockquote>
<p><strong>NOT YET IMPLEMENTED</strong></p>
</blockquote>
</blockquote>
</div>
<div class="section" id="disc-pol-expr">
<h2><a class="toc-backref" href="#id64"><span class="docutils literal"><span class="pre">disc(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The discriminant.</p>
<blockquote>
<p><strong>NOT YET IMPLEMENTED</strong></p>
</blockquote>
</blockquote>
</div>
<div class="section" id="polpowmod-pol-expr-1-num-expr-pol-expr-2">
<h2><a class="toc-backref" href="#id65"><span class="docutils literal"><span class="pre">polpowmod(&lt;pol.</span> expr. 1&gt;, &lt;num. <span class="pre">expr.&gt;,</span> &lt;pol. expr. 2&gt;)</span></a></h2>
<blockquote>
<p>Modular exponentiation: <span class="docutils literal">mod(pol1^N, pol2)</span> in a more efficient
manner than first computing <span class="docutils literal">pol1^N</span> then reducing modulo <span class="docutils literal">pol2</span>.</p>
<p>Attention that this is using the <span class="docutils literal">mod()</span> operation, whose current
experimental status is as follows:</p>
<ul class="simple">
<li><p>if <span class="docutils literal"><span class="pre">deg(pol2)&gt;0</span></span>, the euclidean remainder operation,</p></li>
<li><p>if <span class="docutils literal">pol2</span> is a scalar, coefficient-wise reduction modulo <span class="docutils literal">pol2</span>.</p></li>
</ul>
<p><strong>UNSTABLE</strong></p>
<blockquote>
<p>This is currently implemented at high level via <span class="docutils literal">\xintdeffunc</span> and
recursive definitions, which were copied over from a scalar example
in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> manual:</p>
<pre class="literal-block">\xintdeffunc polpowmod_(P, m, Q) :=
       isone(m)?
           % m=1: return P modulo Q
           {   mod(P,Q)  }
           % m &gt; 1: test if odd or even and do recursive call
           {   odd(m)? {  mod(P*sqr(polpowmod_(P, m//2, Q)), Q) }
                       {  mod(  sqr(polpowmod_(P, m//2, Q)), Q) }
            }
         ;%
\xintdeffunc polpowmod(P, m, Q) := (m)?{polpowmod_(P, m, Q)}{1};%</pre>
<p>Negative exponents are not currently implemented.</p>
<p>For example:</p>
<pre class="literal-block">\xinteval{subs(polpowmod(1+x,100,x^7),x=pol([0,1]))}
\xinteval{subs(polpowmod(1+x,20,10), x=pol([0,1]))}</pre>
<p>produce respectively:</p>
<pre class="literal-block">pol([1, 100, 4950, 161700, 3921225, 75287520, 1192052400])
pol([1, 0, 0, 0, 5, 4, 0, 0, 0, 0, 6, 0, 0, 0, 0, 4, 5, 0, 0, 0, 1])</pre>
</blockquote>
</blockquote>
</div>
<div class="section" id="rdcoeffs-pol-expr">
<h2><a class="toc-backref" href="#id66"><span class="docutils literal"><span class="pre">rdcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>This operates on the internal representation of the coefficients,
reducing them to lowest terms.</p>
<blockquote>
<p><strong>name HIGHLY undecided</strong></p>
</blockquote>
</blockquote>
</div>
<div class="section" id="rdzcoeffs-pol-expr">
<h2><a class="toc-backref" href="#id67"><span class="docutils literal"><span class="pre">rdzcoeffs(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>This operates on the internal representation of the coefficients,
reducing them to lowest terms then extracting from numerator
or denominator the maximal power of ten to store as a decimal
exponent.</p>
<p>This is sometimes favourable to more efficient polynomial algebra
computations.</p>
<blockquote>
<p><strong>name HIGHLY undecided</strong></p>
</blockquote>
</blockquote>
</div>
<div class="section" id="diff1-pol-expr">
<h2><a class="toc-backref" href="#id68"><span class="docutils literal"><span class="pre">diff1(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The first derivative.</p>
<blockquote>
<p><strong>name UNSTABLE</strong></p>
<p>This name may be used in future to be the partial derivative with
respect to a first variable.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="diff2-pol-expr">
<h2><a class="toc-backref" href="#id69"><span class="docutils literal"><span class="pre">diff2(&lt;pol.</span> <span class="pre">expr.&gt;)</span></span></a></h2>
<blockquote>
<p>The second derivative.</p>
<blockquote>
<p><strong>name UNSTABLE</strong></p>
<p>This name may be used in future to be the partial derivative with
respect to a second variable.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="diffn-pol-expr-p-num-expr-n">
<h2><a class="toc-backref" href="#id70"><span class="docutils literal"><span class="pre">diffn(&lt;pol.</span> expr. P&gt;, &lt;num. expr. n&gt;)</span></a></h2>
<blockquote>
<p>The <span class="docutils literal">n</span>th derivative of <span class="docutils literal">P</span>. For <span class="docutils literal">n&lt;0</span> computes iterated primitives
vanishing at the origin.</p>
<p>The coefficients are not reduced to lowest terms.</p>
<blockquote>
<p><strong>name and syntax UNSTABLE</strong></p>
<p>I am also considering reversing the order of the arguments.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="antider-pol-expr-p">
<h2><a class="toc-backref" href="#id71"><span class="docutils literal"><span class="pre">antider(&lt;pol.</span> expr. P&gt;)</span></a></h2>
<blockquote>
<p>The primitive of <span class="docutils literal">P</span> with no constant term. Same as <span class="docutils literal"><span class="pre">diffn(P,-1)</span></span>.</p>
</blockquote>
</div>
<div class="section" id="intfrom-pol-expr-p-pol-expr-c">
<h2><a class="toc-backref" href="#id72"><span class="docutils literal"><span class="pre">intfrom(&lt;pol.</span> expr. P&gt;, &lt;pol. expr. c&gt;)</span></a></h2>
<blockquote>
<p>The primitive of <span class="docutils literal">P</span> vanishing at <span class="docutils literal">c</span>, i.e. <span class="docutils literal">\int_c^x P(t)dt</span>.</p>
<p>Also <span class="docutils literal">c</span> can be a polynomial... so if <span class="docutils literal">c</span> is monomial <span class="docutils literal">x</span>
this will give zero!</p>
<blockquote>
<p><strong>UNSTABLE</strong></p>
<p>Allowing general polynomial variable for <span class="docutils literal">c</span> adds a bit of
overhead to the case of a pure scalar.  So I am hesitating
maintaining this feature whose interest appears dubious.</p>
</blockquote>
</blockquote>
</div>
<div class="section" id="integral-pol-expr-p-pol-expr-a-pol-expr-b">
<h2><a class="toc-backref" href="#id73"><span class="docutils literal"><span class="pre">integral(&lt;pol.</span> expr. P&gt;, [&lt;pol. expr. a&gt;, &lt;pol. expr. <span class="pre">b&gt;])</span></span></a></h2>
<blockquote>
<p><span class="docutils literal">\int_a^b P(t)dt</span>.</p>
<p>The brackets here are not denoting an optional argument
but a <em>mandatory</em> nutple argument <span class="docutils literal">[a, b]</span> with <em>two items</em>.</p>
<p><span class="docutils literal">a</span> and <span class="docutils literal">b</span> are not restricted to be scalars, they can be
polynomials.</p>
<blockquote>
<p>To compute <span class="docutils literal"><span class="pre">\int_{x-1}^x</span> P(t)dt</span> it is more efficient to use
<span class="docutils literal"><span class="pre">intfrom(x-1)</span></span>.</p>
<p>Similary to compute <span class="docutils literal"><span class="pre">\int_x^{x+1}</span> P(t)dt</span>, use <span class="docutils literal"><span class="pre">-intfrom(x+1)</span></span>.</p>
<p><strong>UNSTABLE</strong></p>
<p>Am I right to allow general polynomials <span class="docutils literal">a</span> and <span class="docutils literal">b</span> hence add
overhead to the pure scalar case ?</p>
</blockquote>
</blockquote>
</div>
</div>
<div class="section" id="examples-of-localization-of-roots">
<h1><a class="toc-backref" href="#id74">Examples of localization of roots</a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>As of <span class="docutils literal">0.8</span>, <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with
LaTeX, the examples of this section have been converted to use a
syntax which (at least at time of writing, March 2021) works in both.</p>
<p>This is done in order for the examples to be easy to copy-paste to
documents using either macro format.</p>
</div>
<p>This (slightly over-extended) section gives various examples of usage of
the package macros such as <a class="reference internal" href="#poltosturm">\PolToSturm</a>, <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a>
and <a class="reference internal" href="#polprintintervals">\PolPrintIntervals</a> for root localization, which exist since
release <span class="docutils literal">0.4</span> (2018/02/16).  The capacity to find all rational roots
exactly was added at <span class="docutils literal">0.7.2</span> (2018/12/09).</p>
<p>The examples demonstrate that the package can find all real roots to
arbitrary precision, find the multiplicities of real roots, and find
exactly all rational roots.</p>
<p>Perhaps future releases will implement other approaches, which are known
to be generically computationally more efficient, at least in high
degrees, than the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm theorem</a> based approach.  This is not
immediate priority though (perhaps support of multivariate polynomials
would be more important feature; or localization of complex roots).</p>
<ul>
<li><p>To make printed decimal numbers more enjoyable than via
<span class="docutils literal">\xintTeXsignedFrac</span> (or <span class="docutils literal">\xintTeXsignedOver</span> with Plain):</p>
<pre class="literal-block">\def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}}%</pre>
<p><span class="docutils literal">\PolDecToString</span> will use decimal notation to incorporate the power
of ten part; and the <span class="docutils literal">\xintREZ</span> will have the effect to suppress
trailing zeros if present in raw numerator (if those digits end up
after decimal mark.) Notice that the above are expandable macros and
that one can also do:</p>
<pre class="literal-block">\def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}}%</pre>
<p>to modify output of <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{&lt;pol. expr.&gt;}</a>.</p>
</li>
<li><p>For extra info in log file use <span class="docutils literal">\xintverbosetrue</span>.</p></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Package macros related to root localization create (user-level) new
polynomials, or numeric variables, via a naming scheme which
postfixes a root name <span class="docutils literal">&lt;sturmname&gt;</span> in various ways (see
<a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</a> and
<a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a>).  It is thus advisable to
keep the <span class="docutils literal">&lt;sturmname&gt;</span> name-space separate from the one used to
name polynomial or scalar variables.</p>
<p>Regrettably all examples here use the condemnable
<span class="docutils literal"><span class="pre">\PolToSturm{f}{f}</span></span> practice which fuses the name-spaces.  This can
lead to problems if one is not aware of the consequances.</p>
</div>
<div class="section" id="a-typical-example">
<h2><a class="toc-backref" href="#id75">A typical example</a></h2>
<p>In this example the polynomial is square-free.</p>
<pre class="literal-block">\poldef f(x) := x^7 - x^6 - 2x + 1;

\PolToSturm{f}{f}
\PolSturmIsolateZeros{f}
The \PolTypeset{f} polynomial has \PolSturmNbOfIsolatedZeros{f} distinct real
roots which are located in the following intervals:
\PolPrintIntervals{f}
Here is the second root with ten more decimal digits:
\PolRefineInterval[10]{f}{2}
$$\PolSturmIsolatedZeroLeft{f}{2}&lt;Z_2&lt;\PolSturmIsolatedZeroRight{f}{2}$$
And here is the first root with twenty digits after decimal mark:
\PolEnsureIntervalLength{f}{1}{-20}
$$\PolSturmIsolatedZeroLeft{f}{1}&lt;Z_1&lt;\PolSturmIsolatedZeroRight{f}{1}$$
The first element of the Sturm chain has degree $\PolDegree{f_0}$. As
this is the original degreee $\PolDegree{f}$ we know that $f$ is square free.
Its derivative is up to a constant \PolTypeset{f_1} (in this example
it is identical with it).
\PolToSturm{f_1}{f_1}\PolSturmIsolateZeros{f_1}%
The derivative has \PolSturmNbOfIsolatedZeros{f_1} distinct real
roots:
\PolPrintIntervals[W]{f_1}
\PolEnsureIntervalLengths{f_1}{-10}%
Here they are with ten digits after decimal mark:
\PolPrintIntervals[W]{f_1}
\PolDiff{f_1}{f''}
\PolToSturm{f''}{f''}
\PolSturmIsolateZeros{f''}
The second derivative is \PolTypeset{f''}.
It has \PolSturmNbOfIsolatedZeros{f''} distinct real
roots:
\PolPrintIntervals[X]{f''}
Here is the positive one with 20 digits after decimal mark:
\PolEnsureIntervalLength{f''}{2}{-20}%
$$X_2 = \PolSturmIsolatedZeroLeft{f''}{2}\dots$$
The more mathematically advanced among our dear readers will be able
to give the exact value for $X_2$!</pre>
</div>
<div class="section" id="a-degree-four-polynomial-with-nearby-roots">
<h2><a class="toc-backref" href="#id76">A degree four polynomial with nearby roots</a></h2>
<p>Notice that this example is a bit outdated as <span class="docutils literal">0.7</span> release has
added <span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</span></span> which would find exactly
the roots. The steps here retain their interest when one is interested
in finding isolating intervals for example to prepare some demonstration
of dichotomy method.</p>
<pre class="literal-block">\PolDef{Q}{(x-1.050001)(x-1.105001)(x-1.110501)(x-1.111051)}
\PolTypeset{Q}
\PolToSturm{Q}{Q} % it is allowed to use same prefix for Sturm chain
\PolSturmIsolateZeros{Q}
\PolPrintIntervals{Q}
% reports 1.0 &lt; Z_1 &lt; 1.1, 1.10 &lt; Z_2 &lt; 1.11, 1.110 &lt; Z_3 &lt; 1.111, and 1.111 &lt; Z_4 &lt; 1.112
% but the above bounds do not allow minimizing separation between roots
% so we refine:
\PolRefineInterval*{Q}{1}
\PolRefineInterval*{Q}{2}
\PolRefineInterval*{Q}{3}
\PolRefineInterval*{Q}{4}
\PolPrintIntervals{Q}
% reports 1.05 &lt; Z_1 &lt; 1.06, 1.105 &lt; Z_2 &lt; 1.106, 1.1105 &lt; Z_3 &lt; 1.1106,
% and 1.11105 &lt; Z_4 &lt; 1.11106.
\PolEnsureIntervalLengths{Q}{-6}
\PolPrintIntervals{Q}
% of course finds here all roots exactly</pre>
</div>
<div class="section" id="the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots">
<h2><a class="toc-backref" href="#id77">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple roots</a></h2>
<pre class="literal-block">% define a user command (xinttools is loaded automatically by polexpr)
\def\showmultiplicities#1{% #1 = &quot;sturmname&quot;
\xintFor* ##1 in {\xintSeq{1}{\PolSturmNbOfIsolatedZeros{#1}}}\do{%
    The multiplicity is \PolSturmIsolatedZeroMultiplicity{#1}{##1}
    \PolSturmIfZeroExactlyKnown{#1}{##1}%
    {at the root $x=\PolSturmIsolatedZeroLeft{#1}{##1}$}
    {for the root such that
    $\PolSturmIsolatedZeroLeft{#1}{##1}&lt;x&lt;\PolSturmIsolatedZeroRight{#1}{##1}$}
    \par
}}%
\PolDef{f}{(x-0.99)^3(x-0.999)^3(x-0.9999)^3}
\def\PolTypesetOne#1{\PolDecToString{\xintREZ{#1}}}
\PolTypeset{f}\par
\PolToSturm{f}{f}% it is allowed to use &quot;polname&quot; as &quot;sturmname&quot; too
\PolSturmIsolateZerosAndGetMultiplicities{f}% use the &quot;sturmname&quot; here
% or \PolSturmIsolateZeros*{f} which is exactly the same, but shorter..

\showmultiplicities{f}</pre>
<p>In this example, the output will look like this (but using math mode):</p>
<pre class="literal-block">x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5
- 123.683070924326075877x^4 + 82.149260397553075617891x^3
- 35.07602992699900159127007x^2 + 8.7364078733314648368671733x
- 0.967100824643585986488103299

The multiplicity is 3 at the root x = 0.99
The multiplicity is 3 at the root x = 0.999
The multiplicity is 3 at the root x = 0.9999</pre>
<p>On first pass, these rational roots were found (due to their relative
magnitudes, using <span class="docutils literal">\PolSturmIsolateZeros**</span> was not needed here). But
multiplicity computation works also with (decimal) roots not yet
identified or with non-decimal or irrational roots.</p>
<p>It is fun to modify only a tiny bit the polynomial and see if polexpr
survives:</p>
<pre class="literal-block">\PolDef{g}{f(x)+1e-27}
\PolTypeset{g}\par
\PolToSturm{g}{g}
\PolSturmIsolateZeros*{g}

\showmultiplicities{g}</pre>
<p>This produces:</p>
<pre class="literal-block">x^9 - 8.9667x^8 + 35.73400293x^7 - 83.070418400109x^6 + 124.143648875193123x^5
- 123.683070924326075877x^4 + 82.149260397553075617891x^3
- 35.07602992699900159127007x^2 + 8.7364078733314648368671733x
- 0.967100824643585986488103298

The multiplicity is 1 for the root such that 0.98 &lt; x &lt; 0.99
The multiplicity is 1 for the root such that 0.9991 &lt; x &lt; 0.9992
The multiplicity is 1 for the root such that 0.9997 &lt; x &lt; 0.9998</pre>
<p>Which means that the multiplicity-3 roots each became a real and a pair of
complex ones. Let's see them better:</p>
<pre class="literal-block">\PolEnsureIntervalLengths{g}{-10}

\showmultiplicities{g}</pre>
<p>which produces:</p>
<pre class="literal-block">The multiplicity is 1 for the root such that 0.9899888032 &lt; x &lt; 0.9899888033
The multiplicity is 1 for the root such that 0.9991447980 &lt; x &lt; 0.9991447981
The multiplicity is 1 for the root such that 0.9997663986 &lt; x &lt; 0.9997663987</pre>
</div>
<div class="section" id="a-degree-five-polynomial-with-three-rational-roots">
<h2><a class="toc-backref" href="#id78">A degree five polynomial with three rational roots</a></h2>
<pre class="literal-block">\poldef Q(x) :=  1581755751184441 x^5
               -14907697165025339 x^4
               +48415668972339336 x^3
               -63952057791306264 x^2
               +46833913221154895 x
               -49044360626280925;

\PolToSturm{Q}{Q}
  \def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}%
  $Q_0(x) = \PolTypeset{Q_0}$
\PolSturmIsolateZeros**{Q}
\PolPrintIntervals{Q}

$Q_{norr}(x) = \PolTypeset{Q_norr}$</pre>
<p>Here, all real roots are rational:</p>
<pre class="literal-block">Z_1 = 833719/265381
Z_2 = 165707065/52746197
Z_3 = 355/113

Q_norr(x) = x^2 + 1</pre>
<p>And let's get their decimal expansion too:</p>
<pre class="literal-block">% print decimal expansion of the found roots
\def\PolPrintIntervalsPrintExactZero
            {\xintTrunc{20}{\PolPrintIntervalsTheLeftEndPoint}\dots}
\PolPrintIntervals{Q}

Z_1 = 3.14159265358107777120...
Z_2 = 3.14159265358979340254...
Z_3 = 3.14159292035398230088...</pre>
</div>
<div class="section" id="a-mignotte-type-polynomial">
<h2><a class="toc-backref" href="#id79">A Mignotte type polynomial</a></h2>
<pre class="literal-block">\PolDef{P}{x^10 - (10x-1)^2}%
\PolTypeset{P}              % prints it in expanded form
\PolToSturm{P}{P}           % we can use same prefix for Sturm chain
\PolSturmIsolateZeros{P}    % finds 4 real roots
This polynomial has \PolSturmNbOfIsolatedZeros{P} distinct real roots:
\PolPrintIntervals{P}%
% reports  -2 &lt; Z_1 &lt; -1, 0.09 &lt; Z_2 &lt; 0.10, 0.1 &lt; Z_3 &lt; 0.2, 1 &lt; Z_4 &lt; 2
Let us refine the second and third intervals to separate the corresponding
roots:
\PolRefineInterval*{P}{2}% will refine to 0.0999990 &lt; Z_2 &lt; 0.0999991
\PolRefineInterval*{P}{3}% will refine to 0.100001 &lt; Z_3 &lt; 0.100002
\PolPrintIntervals{P}%
Let us now get to know all roots with 10 digits after decimal mark:
\PolEnsureIntervalLengths{P}{-10}%
\PolPrintIntervals{P}% now all roots are known 10 decimal digits after mark
Finally, we display 20 digits of the second root:
\PolEnsureIntervalLength{P}{2}{-20}% makes Z_2 known with 20 digits after mark
$$\PolSturmIsolatedZeroLeft{P}{2}&lt;Z_2&lt;\PolSturmIsolatedZeroRight{P}{2}$$</pre>
<p>The last line produces:</p>
<pre class="literal-block">0.09999900004999650028 &lt; Z_2 &lt; 0.09999900004999650029</pre>
</div>
<div class="section" id="the-wilkinson-polynomial">
<h2><a class="toc-backref" href="#id80">The Wilkinson polynomial</a></h2>
<p>See <a class="reference external" href="https://en.wikipedia.org/wiki/Wilkinson%27s_polynomial">Wilkinson polynomial</a>.</p>
<pre class="literal-block">%\xintverbosetrue % for the curious...

\poldef f(x) := mul((x - i), i = 1..20);

\def\PolTypesetCmdPrefix#1{\allowbreak\xintiiifSgn{#1}{}{+}{+}}%
\def\PolTypesetOne#1{\xintDecToString{#1}}%

\noindent\PolTypeset{f}

\PolToSturm{f}{f}
\PolSturmIsolateZeros{f}
\PolPrintIntervals{f}

% \vfill\eject

% This page is commented out because it takes about 30s on a 2GHz CPU
% \poldef g(x) := f(x) - 2**{-23} x**19;

% \PolToSturm{g}{g}
% \noindent\PolTypeset{g_0}% integer coefficient primitive polynomial

% \PolSturmIsolateZeros{g}
% \PolEnsureIntervalLengths{g}{-10}

% \let\PolPrintIntervalsPrintMultiplicity\empty
% \PolPrintIntervals*{g}</pre>
<p>The first polynomial:</p>
<pre class="literal-block">f(x) = x**20
- 210 x**19
+ 20615 x**18
- 1256850 x**17
+ 53327946 x**16
- 1672280820 x**15
+ 40171771630 x**14
- 756111184500 x**13
+ 11310276995381 x**12
- 135585182899530 x**11
+ 1307535010540395 x**10
- 10142299865511450 x**9
+ 63030812099294896 x**8
- 311333643161390640 x**7
+ 1206647803780373360 x**6
- 3599979517947607200 x**5
+ 8037811822645051776 x**4
- 12870931245150988800 x**3
+ 13803759753640704000 x**2
- 8752948036761600000 x
+ 2432902008176640000</pre>
<p>is handled fast enough, but the modified one <span class="docutils literal">f(x) - <span class="pre">2**-23</span> <span class="pre">x**19</span></span> takes about 20x longer.</p>
<p>The Sturm chain polynomials
have integer coefficients with up to 321 digits, whereas (surprisingly
perhaps) those of the Sturm chain polynomials derived from <span class="docutils literal">f</span> never
have more than 21 digits ...</p>
<p>Once the Sturm chain is computed and the zeros isolated, obtaining their
decimal digits is relatively faster. Here is for the ten real roots of
<span class="docutils literal">f(x) - <span class="pre">2**-23</span> <span class="pre">x**19</span></span> as computed by the code above:</p>
<pre class="literal-block">Z_1 = 0.9999999999...
Z_2 = 2.0000000000...
Z_3 = 2.9999999999...
Z_4 = 4.0000000002...
Z_5 = 4.9999999275...
Z_6 = 6.0000069439...
Z_7 = 6.9996972339...
Z_8 = 8.0072676034...
Z_9 = 8.9172502485...
Z_10 = 20.8469081014...</pre>
</div>
<div class="section" id="the-second-wilkinson-polynomial">
<h2><a class="toc-backref" href="#id81">The second Wilkinson polynomial</a></h2>
<pre class="literal-block">\poldef f(x) := mul(x - 2^-i, i = 1..20);

%\PolTypeset{f}

\PolToSturm{f}{f}
\PolSturmIsolateZeros**{f}
\PolPrintIntervals{f}</pre>
<p>This takes more time than the polynomial with 1, 2, .., 20 as roots but
less than the latter modified by the <span class="docutils literal"><span class="pre">2**-23</span></span> tiny change to one of its
coefficient.</p>
<p>Here is the output (with release 0.7.2):</p>
<pre class="literal-block">Z_1  = 0.00000095367431640625
Z_2  = 0.0000019073486328125
Z_3  = 0.000003814697265625
Z_4  = 0.00000762939453125
Z_5  = 0.0000152587890625
Z_6  = 0.000030517578125
Z_7  = 0.00006103515625
Z_8  = 0.0001220703125
Z_9  = 1/4096
Z_10 = 1/2048
Z_11 = 1/1024
Z_12 = 1/512
Z_13 = 1/256
Z_14 = 1/128
Z_15 = 0.015625
Z_16 = 0.03125
Z_17 = 0.0625
Z_18 = 0.125
Z_19 = 0.25
Z_20 = 0.5</pre>
<p>There is some incoherence in output format which has its source in the
fact that some roots are found in branches which can only find decimal
roots, whereas some are found in branches which could find general
fractions and they use <span class="docutils literal">\xintIrr</span> before storage of the found root.
This may evolve in future.</p>
</div>
<div class="section" id="the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots">
<h2><a class="toc-backref" href="#id82">The degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2 as roots</a></h2>
<pre class="literal-block">\PolDef{P}{mul((x-i*1e-1), i=-20..20)}% i/10 is same but less efficient</pre>
<p>In the defining expression we could have used <span class="docutils literal">i/10</span> but this gives
less efficient internal form for the coefficients (the <span class="docutils literal">10</span>'s end up
in denominators).</p>
<p>Using <span class="docutils literal">\PolToExpr{P}</span> after having done</p>
<pre class="literal-block">\def\PolToExprCmd#1{\PolDecToString{\xintREZ{#1}}}</pre>
<p>we get this expanded form:</p>
<pre class="literal-block">x^41
-28.7*x^39
+375.7117*x^37
-2975.11006*x^35
+15935.28150578*x^33
-61167.527674162*x^31
+173944.259366417394*x^29
-373686.963560544648*x^27
+613012.0665016658846445*x^25
-771182.31133138163125495*x^23
+743263.86672885754888959569*x^21
-545609.076599482896371978698*x^19
+301748.325708943677229642930528*x^17
-123655.8987669450434698869844544*x^15
+36666.1782054884005855608205864192*x^13
-7607.85821367459445649518380016128*x^11
+1053.15135918687298508885950223794176*x^9
-90.6380005918141132650786081964032*x^7
+4.33701563847327366842552218288128*x^5
-0.0944770968420804735498178265088*x^3
+0.00059190121813899276854174416896*x</pre>
<p>which shows coefficients with up to 36 significant digits...</p>
<p>Stress test: not a hard challenge to <span class="docutils literal">xint + polexpr</span>, but be a bit
patient!</p>
<pre class="literal-block">\PolDef{P}{mul((x-i*1e-1), i=-20..20)}%
\PolToSturm{P}{S}           % dutifully computes S_0, ..., S_{41}
% the [1] optional argument limits the search to interval (-10,10)
\PolSturmIsolateZeros[1]{S} % finds *exactly* (but a bit slowly) all 41 roots!
\PolPrintIntervals{S}       % nice, isn't it?</pre>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Release <span class="docutils literal">0.5</span> has <em>experimental</em> addition of optional argument
<span class="docutils literal">E</span> to <span class="docutils literal">\PolSturmIsolateZeros</span>. It instructs to search roots only
in interval <span class="docutils literal"><span class="pre">(-10^E,</span> 10^E)</span>. Important: the extremities are
<em>assumed to not be roots</em>. In this example, the <span class="docutils literal">[1]</span> in
<span class="docutils literal"><span class="pre">\PolSturmIsolateZeros[1]{S}</span></span> gives some speed gain; without it, it
turns out in this case that <span class="docutils literal">polexpr</span> would have started with
<span class="docutils literal"><span class="pre">(-10^6,</span> 10^6)</span> interval.</p>
<p>Please note that this will probably get replaced in future by the
specification of a general interval. Do not rely on meaning of this
optional argument keeping the same.</p>
</div>
</div>
<div class="section" id="roots-of-chebyshev-polynomials">
<h2><a class="toc-backref" href="#id83">Roots of Chebyshev polynomials</a></h2>
<pre class="literal-block">\poldef T_0(x) := 1;
\poldef T_1(x) := x;
\catcode`&#64; 11
\count&#64; 2
\xintloop
  \poldef T_\the\count&#64;(x) :=
          2x*T_\the\numexpr\count&#64;-1\relax
           - T_\the\numexpr\count&#64;-2\relax;
\ifnum\count&#64;&lt;15
\advance\count&#64; 1
\repeat
\catcode`&#64; 12

$$T_{15} = \PolTypeset[X]{T_15}$$
\PolToSturm{T_15}{T_15}
\PolSturmIsolateZeros{T_15}
\PolEnsureIntervalLengths{T_15}{-10}
\PolPrintIntervals{T_15}</pre>
</div>
</div>
<div class="section" id="non-expandable-macros">
<h1><a class="toc-backref" href="#id84">Non-expandable macros</a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>At <span class="docutils literal">0.8</span> <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with
LaTeX.  Some examples given in this section may be using LaTeX syntax
such as <span class="docutils literal">\renewcommand</span>.  Convert to TeX primitives as appropriate
if testing with a non LaTeX macro format.</p>
</div>
<div class="section" id="poldef-polname-letter-expression-using-the-letter-as-indeterminate">
<span id="poldef"></span><h2><a class="toc-backref" href="#id85"><span class="docutils literal">\poldef <span class="pre">polname(letter):=</span> expression using the letter as indeterminate;</span></a></h2>
<blockquote>
<p>This evaluates the <em>polynomial expression</em> and stores the
coefficients in a private structure accessible later via other
package macros, used with argument <span class="docutils literal">polname</span>.  Of course the
<em>expression</em> can make use of previously defined polynomials.</p>
<p>Polynomial names must start with a letter and are constituted of
letters, digits, underscores and the right tick <span class="docutils literal">'</span>.</p>
<p>The whole <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> syntax is authorized, as long as the final
result is of polynomial type:</p>
<pre class="literal-block">\poldef polname(z) := add((-1)^i z^(2i+1)/(2i+1)!, i = 0..10);</pre>
<p>With fractional coefficients, beware the <a class="reference internal" href="#warningtacit">tacit multiplication issue</a>.</p>
<p>Furthermore:</p>
<ul class="simple">
<li><p>a variable <span class="docutils literal">polname</span> is defined which can be used in <span class="docutils literal">\poldef</span>
as well as in <span class="docutils literal">\xinteval</span> for algebraic computations or as
argument to polynomial aware functions,</p></li>
<li><p>a function <span class="docutils literal">polname()</span> is defined which can be used in <span class="docutils literal">\poldef</span>
as well as in <span class="docutils literal">\xinteval</span>. It accepts there as argument scalars
and also other polynomials (via their names, thanks to previous
item).</p></li>
</ul>
<p>Notice that any function defined via <span class="docutils literal">\xintdeffunc</span> and using
only algebraic operations (and ople indexing or slicing operations)
should work fine in <span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span> with such polynomial
names as argument.</p>
<p>In the case of a constant polynomial, the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variable (not the
internal data structure on which the package macros operate)
associated to it is indistinguishable from a scalar, it is actually
a scalar and has lost all traces from its origins as a polynomial
(so for example can be used as argument to the <span class="docutils literal">cos()</span> function).</p>
<p>The <em>function</em> on the other hand remains a one-argument function,
which simply has a constant value.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>The function <span class="docutils literal">polname()</span> is defined <strong>only</strong> for
<span class="docutils literal"><span class="pre">\xintexpr/\xinteval</span></span>
context.  It will be unknown to <span class="docutils literal">\xintfloateval</span>.</p>
<p>Worse, a
previously existing floating point function of the same name will
be let undefined again, to avoid hard to debug mismatches between
exact and floating point polynomials. This also applies when the
polynomial is produced not via <span class="docutils literal">\poldef</span> or <span class="docutils literal">\PolDef</span> but
as result of usage of the other package macros.</p>
<p>See <a class="reference internal" href="#polgenfloatvariant-polname">\PolGenFloatVariant{&lt;polname&gt;}</a> to generate a <strong>function</strong>
usable in <span class="docutils literal">\xintfloateval</span>.</p>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Using the <strong>variable</strong> <span class="docutils literal">mypol</span> inside <span class="docutils literal">\xintfloateval</span> will
generate low-level errors because the infix operators there are
not polynomial-aware, and the polynomial specific functions such
as <span class="docutils literal">deg()</span> are only defined for usage inside <span class="docutils literal">\xintexpr</span>.</p>
<p>In short, currently polynomials defined via <span class="docutils literal">polexpr</span> can
be used in floating point context only for numerical evaluations,
via <strong>functions</strong> obtained from <a class="reference internal" href="#polgenfloatvariant-polname">\PolGenFloatVariant{&lt;polname&gt;}</a>
usage.</p>
<p>Changes to the original polynomial via package macros are not
automatically mapped to the numerical floating point evaluator
which must be manually updated as necessary when the original
rational coefficient polynomial is modified.</p>
</div>
<p>The original expression is lost after parsing, and in particular the
package provides no way to typeset it (of course the package
provides macros to typeset the computed polynomial).  Typesetting
the original expression has to be done manually, if needed.</p>
</blockquote>
</div>
<div class="section" id="poldef-letter-polname-expr-using-the-letter-as-indeterminate">
<span id="id8"></span><h2><a class="toc-backref" href="#id86"><span class="docutils literal"><span class="pre">\PolDef[&lt;letter&gt;]{&lt;polname&gt;}{&lt;expr.</span> using the letter as indeterminate&gt;}</span></a></h2>
<blockquote>
<p>Does the same as <a class="reference internal" href="#poldef">\poldef</a> in an undelimited macro
format, the main interest is to avoid potential problems with the
catcode of the semi-colon in presence of some packages. In absence
of a <span class="docutils literal">[&lt;letter&gt;]</span> optional argument, the variable is assumed to be
<span class="docutils literal">x</span>.</p>
</blockquote>
</div>
<div class="section" id="polgenfloatvariant-polname">
<span id="polgenfloatvariant"></span><h2><a class="toc-backref" href="#id87"><span class="docutils literal"><span class="pre">\PolGenFloatVariant{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Makes the polynomial also usable in the
<span class="docutils literal"><span class="pre">\xintfloatexpr/\xintfloateval</span></span> parser.  It will therein evaluates
via an Horner scheme using polynomial coefficients already
pre-rounded to the float precision.</p>
<p>See also <a class="reference internal" href="#poltofloatexpr-pol-expr">\PolToFloatExpr{&lt;pol. expr.&gt;}</a>.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>Any operation, for example generating the derivative polynomial,
or dividing two polynomials or using the <span class="docutils literal">\PolLet</span>, must be
followed by explicit usage of <span class="docutils literal"><span class="pre">\PolGenFloatVariant{&lt;polname&gt;}</span></span> if
the new polynomial is to be used in <span class="docutils literal">\xintfloateval</span>.</p>
</div>
</blockquote>
</div>
<div class="section" id="poltypeset-pol-expr">
<span id="poltypeset"></span><h2><a class="toc-backref" href="#id88"><span class="docutils literal"><span class="pre">\PolTypeset{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Typesets in descending powers, switching to math mode if in text
mode, after evaluating the polynomial expression:</p>
<pre class="literal-block">\PolTypeset{mul(x-i,i=1..5)}% possible since polexpr 0.8</pre>
<p>The letter used in the input expression is by default <span class="docutils literal">x</span>,
but can be modified by a redefinition of <a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a>.</p>
<p>It uses also by default the letter <span class="docutils literal">x</span> on output but this one can
be changed via an optional argument:</p>
<pre class="literal-block">\PolTypeset[z]{polname or polynomial expression}</pre>
<p>By default zero coefficients are skipped (use <span class="docutils literal">\poltypesetalltrue</span>
to get all of them in output).</p>
<p>The following macros (whose meanings will be found in the package code)
can be re-defined for customization. Their default definitions are
expandable, but this is not a requirement.</p>
</blockquote>
<div class="section" id="poltypesetcmd-raw-coeff">
<span id="poltypesetcmd"></span><h3><a class="toc-backref" href="#id89"><span class="docutils literal"><span class="pre">\PolTypesetCmd{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>Its package definition checks if the coefficient is <span class="docutils literal">1</span> or <span class="docutils literal"><span class="pre">-1</span></span>
and then skips printing the <span class="docutils literal">1</span>, except for the coefficient of
degree zero.  Also it sets the conditional deciding behaviour of
<a class="reference internal" href="#polifcoeffisplusorminusone-t-f">\PolIfCoeffIsPlusOrMinusOne{T}{F}</a>.</p>
<p>The actual printing of the coefficients, when not equal to plus or
minus one, is handled by <a class="reference internal" href="#poltypesetone-raw-coeff">\PolTypesetOne{&lt;raw_coeff&gt;}</a>.</p>
</blockquote>
<div class="section" id="polifcoeffisplusorminusone-t-f">
<span id="polifcoeffisplusorminusone"></span><h4><a class="toc-backref" href="#id90"><span class="docutils literal"><span class="pre">\PolIfCoeffIsPlusOrMinusOne{T}{F}</span></span></a></h4>
<blockquote>
<p>This macro is a priori undefined.</p>
<p>It is defined via the default <a class="reference internal" href="#poltypesetcmd-raw-coeff">\PolTypesetCmd{&lt;raw_coeff&gt;}</a> to be
used if needed in the execution of <a class="reference internal" href="#poltypesetmonomialcmd">\PolTypesetMonomialCmd</a>,
e.g. to insert a <span class="docutils literal">\cdot</span> in front of <span class="docutils literal"><span class="pre">\PolVar^{\PolIndex}</span></span> if
the coefficient is not plus or minus one.</p>
<p>The macro will execute <span class="docutils literal">T</span> if the coefficient has been found to be
plus or minus one, and <span class="docutils literal">F</span> if not.  It chooses expandably between
<span class="docutils literal">T</span> and <span class="docutils literal">F</span>.</p>
</blockquote>
</div>
</div>
<div class="section" id="poltypesetone-raw-coeff">
<span id="poltypesetone"></span><h3><a class="toc-backref" href="#id91"><span class="docutils literal"><span class="pre">\PolTypesetOne{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal">\xintTeXsignedFrac</span> (LaTeX) or <span class="docutils literal">\xintTeXsignedOver</span>
(else).  But these <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> old legacy macros are a bit
annoying as they insist in exhibiting a power of ten rather than
using simpler decimal notation.</p>
<p>As alternative, one can do definitions such as:</p>
<pre class="literal-block">\def\PolTypesetOne#1{\xintDecToString{\xintREZ{#1}}}
% or with LaTeX+siunitx for example
\renewcommand\PolTypesetOne[1]{\num{\xintPFloat[5]{#1}}}
% (as \num of siunitx understands floating point notation)
\renewcommand\PolTypesetOne[1]{\num{\xintRound{4}{#1}}}</pre>
</blockquote>
</div>
<div class="section" id="id9">
<span id="poltypesetmonomialcmd"></span><h3><a class="toc-backref" href="#id92"><span class="docutils literal">\PolTypesetMonomialCmd</span></a></h3>
<blockquote>
<p>This decides how a monomial (in variable <span class="docutils literal">\PolVar</span> and with
exponent <span class="docutils literal">\PolIndex</span>) is to be printed. The default does nothing
for the constant term, <span class="docutils literal">\PolVar</span> for the first degree and
<span class="docutils literal"><span class="pre">\PolVar^{\PolIndex}</span></span> for higher degrees monomials. Beware that
<span class="docutils literal">\PolIndex</span> expands to digit tokens and needs termination in
<span class="docutils literal">\ifnum</span> tests.</p>
</blockquote>
</div>
<div class="section" id="poltypesetcmdprefix-raw-coeff">
<span id="poltypesetcmdprefix"></span><h3><a class="toc-backref" href="#id93"><span class="docutils literal"><span class="pre">\PolTypesetCmdPrefix{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to a <span class="docutils literal">+</span> if the <span class="docutils literal">raw_coeff</span> is zero or positive, and to
nothing if <span class="docutils literal">raw_coeff</span> is negative, as in latter case the
<span class="docutils literal">\xintTeXsignedFrac</span> (or <span class="docutils literal">\xintTeXsignedOver</span>) used by
<a class="reference internal" href="#poltypesetcmd-raw-coeff">\PolTypesetCmd{&lt;raw_coeff&gt;}</a> will put the <span class="docutils literal">-</span> sign in front of
the fraction (if it is a fraction) and this will thus serve as
separator in the typeset formula. Not used for the first term.</p>
</blockquote>
</div>
</div>
<div class="section" id="id11">
<span id="id10"></span><h2><a class="toc-backref" href="#id94"><span class="docutils literal"><span class="pre">\PolTypeset*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Typesets in ascending powers. Use <span class="docutils literal">[&lt;letter&gt;]</span> optional argument
(after the <span class="docutils literal">*</span>) to use another letter than <span class="docutils literal">x</span>.</p>
<p>Extended at <span class="docutils literal">0.8</span> to accept general expressions and not only
polynomial names.  Redefine <a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a> to use in the
expression another letter than default <span class="docutils literal">x</span>.</p>
</blockquote>
</div>
<div class="section" id="non-expandable-macros-related-to-the-root-localization-routines">
<h2><a class="toc-backref" href="#id95">Non-expandable macros related to the root localization routines</a></h2>
<p>As <a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</a> and
<a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> and variants declare
additional polynomial or scalar variables with names based on <span class="docutils literal">&lt;sturmname&gt;</span> as
prefix, it is advisable to keep the <span class="docutils literal">&lt;sturmname&gt;</span> namespace separate from
the one applying to <span class="docutils literal">\xintexpr</span> variables generally, or to polynomials.</p>
<div class="section" id="poltosturm-polname-sturmname">
<span id="poltosturm"></span><h3><a class="toc-backref" href="#id96"><span class="docutils literal"><span class="pre">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>With <span class="docutils literal">&lt;polname&gt;</span> being for example <span class="docutils literal">P</span>, and <span class="docutils literal">&lt;sturmname&gt;</span> being
for example <span class="docutils literal">S</span>, the macro starts by computing the derivative
<span class="docutils literal">P'</span>, then computes the opposite of the remainder in the euclidean
division of <span class="docutils literal">P</span> by <span class="docutils literal">P'</span>, then the opposite of the remainder in
the euclidean division of <span class="docutils literal">P'</span> by the first obtained polynomial,
etc... Up to signs following the <span class="docutils literal"><span class="pre">--++--++...</span></span> pattern, these are
the same remainders as in the Euclide algorithm applied to the
computation of the GCD of <span class="docutils literal">P</span> and <span class="docutils literal">P'</span>.</p>
<p>The precise process differs from the above description: the
algorithm first sets <span class="docutils literal">S_0_</span> to be the <em>primitive part</em> of <span class="docutils literal">P</span> and
<span class="docutils literal">S_1_</span> to be the <em>primitive part</em> of <span class="docutils literal">P'</span> (see
<a class="reference internal" href="#policontent-polname">\PolIContent{&lt;polname&gt;}</a>), then at each step the remainder is made
primitive and stored for internal reference as <span class="docutils literal">S_k_</span>, so only
integer-coefficients polynomials are manipulated.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This exact procedure will perhaps in future be replaced by a
<em>sub-resultant algorithm</em>, which may bring some speed gain in
obtaining a pseudo-Sturm sequence, but some experimenting is
needed, in the context of realistically realizable computations
by the package; primitive polynomials although a bit costly
have the smallest coefficients hence are the best for the kind of
computations done for root localization, after having computed a
Sturm sequence.</p>
</div>
<p>The last non-zero primitivized remainder <span class="docutils literal">S_N_</span> is, up to sign,
the primitive part of the GCD of <span class="docutils literal">P</span> and <span class="docutils literal">P'</span>.  Its roots (real
and complex) are the multiple roots of the original <span class="docutils literal">P</span>.  The
original <span class="docutils literal">P</span> was &quot;square-free&quot; (i.e. did not have multiple real
or complex roots) if and only if <span class="docutils literal">S_N_</span> is a constant, which is
then <span class="docutils literal">+1</span> or <span class="docutils literal"><span class="pre">-1</span></span> (its value before primitivization is lost).</p>
<p>The macro then divides each <span class="docutils literal">S_k_</span> by <span class="docutils literal">S_N_</span> and declares the
quotients <span class="docutils literal">S_k</span> as user polynomials for future use.  By Gauss
theorem about the contents of integer-coefficients polynomials,
these <span class="docutils literal">S_k</span> also are primitive integer-coefficients polynomials.</p>
<p>This step will be referred to as <em>normalization</em>, and in this
documentation the obtained polynomials are said to constitute the
&quot;Sturm chain&quot; (or &quot;Sturm sequence&quot;), i.e. by convention the &quot;Sturm
chain polynomials&quot; are square-free and primitive.  The possibly
non-square-free ones are referred to as <em>non-normalized</em>.</p>
<p>As an exception to the rule, if the original <span class="docutils literal">P</span> was &quot;square-free&quot;
(i.e. did not have multiple real or complex roots) then
normalization is skipped (in that case <span class="docutils literal">S_N_</span> is either <span class="docutils literal">+1</span> or
<span class="docutils literal"><span class="pre">-1</span></span>), so <span class="docutils literal">S_0_</span> is exactly the primitive part of starting
polynomial <span class="docutils literal">P</span>, in the &quot;square-free&quot; case.</p>
<p>The next logical step is to execute <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros{S}</a> or one of its variants.  Be careful not to
use the names <span class="docutils literal">sturmname_0</span>, <span class="docutils literal">sturmname_1</span>, etc... for defining
other polynomials after having done
<span class="docutils literal"><span class="pre">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</span></span> and before executing
<span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{&lt;sturmname&gt;}</span></span> or its variants else the
latter will behave erroneously.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The declaration of the <span class="docutils literal">S_k</span>'s will overwrite
with no warning previously declared polynomials with identical
names <span class="docutils literal">S_k</span>.  This is original reason why the macro expects two
names: <span class="docutils literal">&lt;polname&gt;</span> and <span class="docutils literal">&lt;sturmname&gt;</span>.</p>
<p>It is allowed to use the polynomial name <span class="docutils literal">P</span> as Sturm chain
name <span class="docutils literal">S</span>: <span class="docutils literal"><span class="pre">\PolToSturm{f}(f}</span></span>, but of course fusing the
namespaces is slightly dangerous.  And, also <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> creates variables sharing
the <span class="docutils literal">&lt;sturmname&gt;</span> prefix, which must be taken into account to
avoid name clashes.</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The reason why the <span class="docutils literal">S_k</span>'s are declared as polynomials is
that the associated polynomial functions are needed to compute
the sign changes in the Sturm sequence evaluated at a given
location, as this is the basis mechanism of <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> (on the basis of the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm theorem</a>).</p>
<p>It is possible that in future the package will only internally
construct such polynomial functions and only the starred variant
will make the normalized (i.e. square-free) Sturm sequence public.</p>
</div>
<p>The integer <span class="docutils literal">N</span> giving the length of the Sturm chain <span class="docutils literal">S_0</span>,
<span class="docutils literal">S_1</span>, ..., <span class="docutils literal">S_N</span> is available as
<a class="reference internal" href="#polsturmchainlength-sturmname">\PolSturmChainLength{&lt;sturmname&gt;}</a>.  If all roots of original <span class="docutils literal">P</span>
are real, then <span class="docutils literal">N</span> is both the number of distinct real roots and
the degree of <span class="docutils literal">S_0</span>.  In the case of existence of complex roots,
the number of distinct real roots is at most <span class="docutils literal">N</span> and <span class="docutils literal">N</span> is at
most the degree of <span class="docutils literal">S_0</span>.</p>
</blockquote>
</div>
<div class="section" id="id13">
<span id="id12"></span><h3><a class="toc-backref" href="#id97"><span class="docutils literal"><span class="pre">\PolToSturm*{&lt;polname&gt;}{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>Does the same as <a class="reference internal" href="#poltosturm">un-starred version</a> and additionally it
keeps for user usage the memory of the <em>un-normalized</em> (but still
made primitive) Sturm chain
polynomials <span class="docutils literal">sturmname_k_</span>, <span class="docutils literal">k=0,1, <span class="pre">...,</span> N</span>, with
<span class="docutils literal">N</span> being <a class="reference internal" href="#polsturmchainlength-sturmname">\PolSturmChainLength{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polsturmisolatezeros-sturmname">
<span id="polsturmisolatezeros"></span><h3><a class="toc-backref" href="#id98"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>The macro locates, using the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm Theorem</a>, as many disjoint
intervals as there are distinct real roots.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>The Sturm chain must have been produced by an earlier
<a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</a>.</p>
</div>
<p>After its execution they are two types of such intervals (stored in
memory and accessible via macros or <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables, see below):</p>
<ul class="simple">
<li><p>singleton <span class="docutils literal">{a}</span>: then <span class="docutils literal">a</span> is a root, (necessarily a decimal
number, but not all such decimal numbers are exactly identified yet).</p></li>
<li><p>open intervals <span class="docutils literal">(a,b)</span>: then there is exactly one root <span class="docutils literal">z</span>
such that <span class="docutils literal">a &lt; z &lt; b</span>, and the end points are guaranteed to not
be roots.</p></li>
</ul>
<p>The interval boundaries are decimal numbers, originating
in iterated decimal subdivision from initial intervals
<span class="docutils literal"><span class="pre">(-10^E,</span> 0)</span> and <span class="docutils literal">(0, 10^E)</span> with <span class="docutils literal">E</span> chosen initially large
enough so that all roots are enclosed; if zero is a root it is always
identified as such. The non-singleton intervals are of the
type <span class="docutils literal">(a/10^f, <span class="pre">(a+1)/10^f)</span></span> with <span class="docutils literal">a</span> an integer, which is
neither <span class="docutils literal">0</span> nor <span class="docutils literal"><span class="pre">-1</span></span>. Hence either <span class="docutils literal">a</span> and <span class="docutils literal">a+1</span> are both positive
or they are both negative.</p>
<p>One does not <em>a priori</em> know what will be the lengths of these
intervals (except that they are always powers of ten), they
vary depending on how many digits two successive roots have in
common in their respective decimal expansions.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>If some two consecutive intervals share an end-point, no
information is yet gained about the separation between the two
roots which could at this stage be arbitrarily small.</p>
<p>See <a class="reference internal" href="#polrefineinterval-sturmname-index">\PolRefineInterval*{&lt;sturmname&gt;}{&lt;index&gt;}</a> which addresses
this issue.</p>
</div>
<p>Let us suppose <span class="docutils literal">&lt;sturmname&gt;</span> is <span class="docutils literal">S</span>.</p>
<p>The interval boundaries (and exactly found roots) are made available
for future computations in <span class="docutils literal">\xintexpr/xinteval</span> or <span class="docutils literal">\poldef</span> as
variables <span class="docutils literal">SL_1</span>, <span class="docutils literal">SL_2</span>, etc..., for the left end-points and
<span class="docutils literal">SR_1</span>, <span class="docutils literal">SR_2</span>, ..., for the right end-points.</p>
<p>Additionally, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variable <span class="docutils literal">SZ_1_isknown</span> will have value
<span class="docutils literal">1</span> if the root in the first interval is known, and <span class="docutils literal">0</span>
otherwise. And similarly for the other intervals.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>The variable declarations are done with no check of existence of
previously existing variables with identical names.</p>
</div>
<p>Also, macros <a class="reference internal" href="#polsturmisolatedzeroleft">\PolSturmIsolatedZeroLeft{&lt;sturmname&gt;}{&lt;index&gt;}</a> and
<a class="reference internal" href="#polsturmisolatedzeroright-sturmname-index">\PolSturmIsolatedZeroRight{&lt;sturmname&gt;}{&lt;index&gt;}</a> are provided which
expand to these same values, written in decimal notation (i.e.
pre-processed by <a class="reference internal" href="#poldectostring">\PolDecToString</a>.) And there
is also <a class="reference internal" href="#polsturmifzeroexactlyknown-sturmname-index-t-f">\PolSturmIfZeroExactlyKnown{&lt;sturmname&gt;}{&lt;index&gt;}{T}{F}</a>.</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>Trailing zeroes in the stored decimal numbers accessible via the
macros are significant: they are also present in the decimal
expansion of the exact root, so as to be able for example to
print out bounds of real roots with as many digits as is
significant, even if the digits are zeros.</p>
</div>
<p>The start of the decimal expansion of the <span class="docutils literal">&lt;index&gt;</span>-th root is given by
<a class="reference internal" href="#polsturmisolatedzeroleft">\PolSturmIsolatedZeroLeft{&lt;sturmname&gt;}{&lt;index&gt;}</a> if the root is positive, and by
<a class="reference internal" href="#polsturmisolatedzeroright">PolSturmIsolatedZeroRight{&lt;sturmname&gt;}{&lt;index&gt;}</a> if the root is neagtive. These two
decimal numbers are either both zero or both of the same sign.</p>
<p>The number of distinct roots is obtainable expandably as
<a class="reference internal" href="#polsturmnbofisolatedzeros-sturmname">\PolSturmNbOfIsolatedZeros{&lt;sturmname&gt;}</a>.</p>
<p>Furthermore
<a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</a> and
<a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num. expr.&gt;}</a>.
will expandably compute respectively the number of real roots at
most equal to <span class="docutils literal">value</span> or <span class="docutils literal">expression</span>, and the same but with
multiplicities.</p>
<p>These variables and macros are automatically updated in case of
subsequent usage of <a class="reference internal" href="#polrefineinterval-sturmname-index">\PolRefineInterval*{&lt;sturmname&gt;}{&lt;index&gt;}</a> or
other localization improving macros.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The current polexpr implementation defines the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables
and <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> arrays as described above with global scope. On the
other hand the Sturm sequence polynomials obey the current scope.</p>
<p>This is perhaps a bit inconsistent and may change in future.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The results are exact
bounds for the mathematically exact real roots.</p>
<p>Future releases will perhaps also provide macros based on Newton
or Regula Falsi methods. Exact computations with such methods
lead however quickly to very big fractions, and this forces usage
of some rounding scheme for the abscissas if computation times
are to remain reasonable. This raises issues of its own, which
are studied in numerical mathematics.</p>
</div>
</blockquote>
</div>
<div class="section" id="id15">
<span id="id14"></span><h3><a class="toc-backref" href="#id99"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>The macro does the same as <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> and
then in addition it does the extra work to determine all
multiplicities of the real roots.</p>
<p>After execution,
<a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index">\PolSturmIsolatedZeroMultiplicity{&lt;sturmname&gt;}{&lt;index&gt;}</a> expands
to the multiplicity of the root located in the <span class="docutils literal">index</span>-th
interval (intervals are enumerated from left to right, with index
starting at <span class="docutils literal">1</span>).</p>
<p>Furthermore, if for example the <span class="docutils literal">&lt;sturmname&gt;</span> is <span class="docutils literal">S</span>, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a>
variables <span class="docutils literal">SM_1</span>, <span class="docutils literal">SM_2</span>... hold the multiplicities thus
computed.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Somewhat counter-intuitively, it is not necessary to have
executed the <a class="reference internal" href="#id12">\PolToSturm*</a> starred variant: during its
execution, <a class="reference internal" href="#poltosturm">\PolToSturm</a>, even though it does not declare the
non-square-free Sturm chain polynomials as user-level genuine
polynomials, stores their data in private macros.</p>
</div>
<p>See <a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple
roots</a> for an example.</p>
</blockquote>
<div class="section" id="polsturmisolatezerosandgetmultiplicities-sturmname">
<span id="polsturmisolatezerosandgetmultiplicities"></span><h4><a class="toc-backref" href="#id100"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndGetMultiplicities{&lt;sturmname&gt;}</span></span></a></h4>
<blockquote>
<p>This is another name for <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
</div>
<div class="section" id="id17">
<span id="id16"></span><h3><a class="toc-backref" href="#id101"><span class="docutils literal"><span class="pre">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>The macro does the same as <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</a> and
in addition it does the extra work to determine all the <em>rational</em>
roots.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>After execution of this macro, a root is &quot;known&quot; if and only if
it is rational.</p>
</div>
<p>Furthermore, primitive polynomial <span class="docutils literal">sturmname_sqf_norr</span> is created
to match the (square-free) <span class="docutils literal">sturmname_0</span> from which all rational
roots have been removed (see <a class="reference internal" href="#polexprsetup">\polexprsetup</a> for customizing this
name). The number of distinct rational roots is thus the difference
between the degrees of these two polynomials (see also
<a class="reference internal" href="#polsturmnbofrationalroots-sturmname">\PolSturmNbOfRationalRoots{&lt;sturmname&gt;}</a>).</p>
<p>And <span class="docutils literal">sturmname_norr</span> is <span class="docutils literal">sturmname_0_</span> from which all rational
roots have been removed (see <a class="reference internal" href="#polexprsetup">\polexprsetup</a>), i.e. it contains
the irrational roots of the original polynomial, with the same
multiplicities.</p>
<p>See <a class="reference internal" href="#a-degree-five-polynomial-with-three-rational-roots">A degree five polynomial with three rational
roots</a> for an example.</p>
</blockquote>
<div class="section" id="polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname">
<span id="polsturmisolatezerosgetmultiplicitiesandrationalroots"></span><h4><a class="toc-backref" href="#id102"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{&lt;sturmname&gt;}</span></span></a></h4>
<blockquote>
<p>This is another name for <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
</div>
<div class="section" id="polsturmisolatezerosandfindrationalroots-sturmname">
<h3><a class="toc-backref" href="#id103"><span class="docutils literal"><span class="pre">\PolSturmIsolateZerosAndFindRationalRoots{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>This works exactly like <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a>
(inclusive of declaring the polynomials <span class="docutils literal">sturmname_sqf_norr</span> and
<span class="docutils literal">sturmname_norr</span> with no rational roots) except that it does <em>not</em>
compute the multiplicities of the <em>non-rational</em> roots.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>There is no macro to find the rational roots but not compute
their multiplicities at the same time.</p>
</div>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>This macro does <em>not</em> define <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> variables
<span class="docutils literal">sturmnameM_1</span>, <span class="docutils literal">sturmnameM_2</span>, ... holding the
multiplicities and it leaves the multiplicity array (whose accessor
is <a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index">\PolSturmIsolatedZeroMultiplicity{&lt;sturmname&gt;}{&lt;index&gt;}</a>) into
a broken state, as all non-rational roots will supposedly have
multiplicity one. This means that the output of
<a class="reference internal" href="#id21">\PolPrintIntervals*</a> will be
erroneous regarding the multiplicities of irrational roots.</p>
<p>I decided to document it because finding multiplicities of the
non rational roots is somewhat costly, and one may be interested
only into finding the rational roots (of course random
polynomials with integer coefficients will not have <em>any</em>
rational root anyhow).</p>
</div>
</blockquote>
</div>
<div class="section" id="polrefineinterval-sturmname-index">
<span id="polrefineinterval"></span><h3><a class="toc-backref" href="#id104"><span class="docutils literal"><span class="pre">\PolRefineInterval*{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>The <span class="docutils literal">index</span>-th interval (starting indexing at one) is further
subdivided as many times as is necessary in order for the newer
interval to have both its end-points distinct from the end-points of
the original interval.  As a consequence, the <span class="docutils literal">k</span>th root is then
strictly separated from the other roots.</p>
</blockquote>
</div>
<div class="section" id="polrefineinterval-n-sturmname-index">
<span id="polrefineinterval-n"></span><h3><a class="toc-backref" href="#id105"><span class="docutils literal"><span class="pre">\PolRefineInterval[N]{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>The <span class="docutils literal">index</span>-th interval (starting count at one) is further
subdivided once, reducing its length by a factor of 10. This is done
<span class="docutils literal">N</span> times if the optional argument <span class="docutils literal">[N]</span> is present.</p>
</blockquote>
</div>
<div class="section" id="polensureintervallength-sturmname-index-exponent">
<span id="polensureintervallength"></span><h3><a class="toc-backref" href="#id106"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLength{&lt;sturmname&gt;}{&lt;index&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>The <span class="docutils literal">index</span>-th interval is subdivided until its length becomes at
most <span class="docutils literal">10^E</span>. This means (for <span class="docutils literal">E&lt;0</span>) that the first <span class="docutils literal"><span class="pre">-E</span></span> digits
after decimal mark of the <span class="docutils literal">k</span>th root will then be known exactly.</p>
</blockquote>
</div>
<div class="section" id="polensureintervallengths-sturmname-exponent">
<span id="polensureintervallengths"></span><h3><a class="toc-backref" href="#id107"><span class="docutils literal"><span class="pre">\PolEnsureIntervalLengths{&lt;sturmname&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>The intervals as obtained from <span class="docutils literal">\PolSturmIsolateZeros</span> are (if
necessary) subdivided further by (base 10) dichotomy in order for
each of them to have length at most <span class="docutils literal">10^E</span>.</p>
<p>This means that decimal expansions of all roots will be known with
<span class="docutils literal"><span class="pre">-E</span></span> digits (for <span class="docutils literal">E&lt;0</span>) after decimal mark.</p>
</blockquote>
</div>
<div class="section" id="polprintintervals-varname-sturmname">
<span id="polprintintervals"></span><h3><a class="toc-backref" href="#id108"><span class="docutils literal"><span class="pre">\PolPrintIntervals[&lt;varname&gt;]{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>This is a convenience macro which prints the bounds for the roots
<span class="docutils literal">Z_1</span>, <span class="docutils literal">Z_2</span>, ... (the optional argument <span class="docutils literal">varname</span> allows to
specify a replacement for the default <span class="docutils literal">Z</span>). This will be done (by
default) in a
math mode <span class="docutils literal">array</span>, one interval per row, and pattern <span class="docutils literal">rcccl</span>,
where the second and fourth column hold the <span class="docutils literal">&lt;</span> sign, except when
the interval reduces to a singleton, which means the root is known
exactly.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The explanations here and in this section are for LaTeX.  With
other TeX macro formats, the LaTeX syntax such as for example
<span class="docutils literal"><span class="pre">\begin{array}{rcccl}</span></span> which appears in the documentation here
is actually replaced with quasi-equivalent direct use of TeX
primitives.</p>
</div>
<p>See next macros which govern its output.</p>
</blockquote>
<div class="section" id="polprintintervalsnorealroots">
<h4><a class="toc-backref" href="#id109"><span class="docutils literal">\PolPrintIntervalsNoRealRoots</span></a></h4>
<blockquote>
<p>Executed in place of an <span class="docutils literal">array</span> environment, when there are no
real roots. Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsNoRealRoots{}</pre>
</blockquote>
</div>
<div class="section" id="polprintintervalsbeginenv">
<h4><a class="toc-backref" href="#id110"><span class="docutils literal">\PolPrintIntervalsBeginEnv</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsBeginEnv{\[\begin{array}{rcccl}}</pre>
</blockquote>
</div>
<div class="section" id="polprintintervalsendenv">
<h4><a class="toc-backref" href="#id111"><span class="docutils literal">\PolPrintIntervalsEndEnv</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsEndEnv{\end{array}\]}</pre>
</blockquote>
</div>
<div class="section" id="polprintintervalsknownroot">
<h4><a class="toc-backref" href="#id112"><span class="docutils literal">\PolPrintIntervalsKnownRoot</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsKnownRoot{%
  &amp;&amp;\PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}%
  &amp;=&amp;\PolPrintIntervalsPrintExactZero
}</pre>
</blockquote>
</div>
<div class="section" id="polprintintervalsunknownroot">
<h4><a class="toc-backref" href="#id113"><span class="docutils literal">\PolPrintIntervalsUnknownRoot</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsUnknownRoot{%
  \PolPrintIntervalsPrintLeftEndPoint&amp;&lt;&amp;%
  \PolPrintIntervalsTheVar_{\PolPrintIntervalsTheIndex}&amp;&lt;&amp;%
  \PolPrintIntervalsPrintRightEndPoint
}</pre>
</blockquote>
</div>
<div class="section" id="id18">
<span id="polprintintervalsprintexactzero"></span><h4><a class="toc-backref" href="#id114"><span class="docutils literal">\PolPrintIntervalsPrintExactZero</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsPrintExactZero{\PolPrintIntervalsTheLeftEndPoint}</pre>
</blockquote>
</div>
<div class="section" id="id19">
<span id="polprintintervalsprintleftendpoint"></span><h4><a class="toc-backref" href="#id115"><span class="docutils literal">\PolPrintIntervalsPrintLeftEndPoint</span></a></h4>
<blockquote>
<p>Default definition:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsPrintLeftEndPoint{\PolPrintIntervalsTheLeftEndPoint}</pre>
</blockquote>
</div>
<div class="section" id="id20">
<span id="polprintintervalsprintrightendpoint"></span><h4><a class="toc-backref" href="#id116"><span class="docutils literal">\PolPrintIntervalsPrintRightEndPoint</span></a></h4>
<blockquote>
<p>Default definition is:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsPrintRightEndPoint{\PolPrintIntervalsTheRightEndPoint}</pre>
</blockquote>
</div>
</div>
<div class="section" id="id22">
<span id="id21"></span><h3><a class="toc-backref" href="#id117"><span class="docutils literal"><span class="pre">\PolPrintIntervals*[&lt;varname&gt;]{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>This starred variant produces an alternative output (which
displays the root multiplicity), and is provided as an
example of customization.</p>
<p>As replacement for <a class="reference internal" href="#polprintintervalsknownroot">\PolPrintIntervalsKnownRoot</a>,
<a class="reference internal" href="#polprintintervalsprintexactzero">\PolPrintIntervalsPrintExactZero</a>,
<a class="reference internal" href="#polprintintervalsunknownroot">\PolPrintIntervalsUnknownRoot</a> it uses its own
<span class="docutils literal"><span class="pre">\POL&#64;&#64;PrintIntervals...</span></span> macros. We only reproduce here one
definition:</p>
<pre class="literal-block">\newcommand\POL&#64;&#64;PrintIntervalsPrintExactZero{%
   \displaystyle
   \xintTeXsignedFrac{\PolPrintIntervalsTheLeftEndPoint}%
}%</pre>
<p>Multiplicities are printed using this auxiliary macro:</p>
</blockquote>
<div class="section" id="polprintintervalsprintmultiplicity">
<h4><a class="toc-backref" href="#id118"><span class="docutils literal">\PolPrintIntervalsPrintMultiplicity</span></a></h4>
<blockquote>
<p>whose default definition is:</p>
<pre class="literal-block">\newcommand\PolPrintIntervalsPrintMultiplicity{(\mbox{mult. }\PolPrintIntervalsTheMultiplicity)}</pre>
</blockquote>
</div>
</div>
<div class="section" id="polsettosturmchainsignchangesat-foo-sturmname-value">
<span id="polsettosturmchainsignchangesat"></span><h3><a class="toc-backref" href="#id119"><span class="docutils literal"><span class="pre">\PolSetToSturmChainSignChangesAt{\foo}{&lt;sturmname&gt;}{&lt;value&gt;}</span></span></a></h3>
<blockquote>
<p>Sets macro <span class="docutils literal">\foo</span> to store the number of sign changes in the
already computed normalized Sturm chain with name prefix
<span class="docutils literal">&lt;sturmname&gt;</span>, at location <span class="docutils literal">&lt;value&gt;</span> (which must be in format as
acceptable by the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.)</p>
<p>The definition is made with global scope. For local scope, use
<span class="docutils literal">[\empty]</span> as extra optional argument.</p>
<p>One can use this immediately after creation of the Sturm chain.</p>
</blockquote>
</div>
<div class="section" id="polsettonbofzeroswithin-foo-sturmname-value-left-value-right">
<span id="polsettonbofzeroswithin"></span><h3><a class="toc-backref" href="#id120"><span class="docutils literal"><span class="pre">\PolSetToNbOfZerosWithin{\foo}{&lt;sturmname&gt;}{&lt;value_left&gt;}{&lt;value_right&gt;}</span></span></a></h3>
<blockquote>
<p>Sets, assuming the normalized Sturm chain has been already computed,
macro <span class="docutils literal">\foo</span> to store the number of roots of <span class="docutils literal">sturmname_0</span> in
the interval <span class="docutils literal">(value_left, value_right]</span>.  The macro first
re-orders end-points if necessary for <span class="docutils literal">value_left &lt;= value_right</span>
to hold.</p>
<p>In accordance to <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm Theorem</a> this is computed as the difference
between the number of sign changes of the Sturm chain at <span class="docutils literal">value_right</span>
and the one at <span class="docutils literal">value_left</span>.</p>
<p>The definition is made with global scope. For local scope, use
<span class="docutils literal">[\empty]</span> as extra optional argument.</p>
<p>One can use this immediately after creation of a Sturm chain.</p>
<p>See also the expandable
<a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</a>,
which however requires prior execution of <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a>.</p>
<p>See also the expandable
<a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</a>
which requires prior execution of
<a class="reference internal" href="#id14">\PolSturmIsolateZeros*</a>.</p>
</blockquote>
</div>
</div>
<div class="section" id="pollet-polname-2-polname-1">
<span id="pollet"></span><h2><a class="toc-backref" href="#id121"><span class="docutils literal"><span class="pre">\PolLet{&lt;polname_2&gt;}={&lt;polname_1&gt;}</span></span></a></h2>
<blockquote>
<p>Makes a copy of the already defined polynomial <span class="docutils literal">polname_1</span> to a
new one <span class="docutils literal">polname_2</span>. This has the same effect as
<span class="docutils literal"><span class="pre">\PolDef{&lt;polname_2&gt;}{&lt;polname_1&gt;(x)}</span></span> or (better)
<span class="docutils literal"><span class="pre">\PolDef{&lt;polname_2&gt;}{&lt;polname_1&gt;}</span></span> but with less overhead. The
<span class="docutils literal">=</span> is optional.</p>
</blockquote>
</div>
<div class="section" id="polgloballet-polname-2-polname-1">
<span id="polgloballet"></span><h2><a class="toc-backref" href="#id122"><span class="docutils literal"><span class="pre">\PolGlobalLet{&lt;polname_2&gt;}={&lt;polname_1&gt;}</span></span></a></h2>
<blockquote>
<p>Acts globally.</p>
</blockquote>
</div>
<div class="section" id="polassign-polname-toarray-macro">
<span id="polassign"></span><h2><a class="toc-backref" href="#id123"><span class="docutils literal"><span class="pre">\PolAssign{&lt;polname&gt;}\toarray\macro</span></span></a></h2>
<blockquote>
<p>Defines a one-argument expandable macro <span class="docutils literal"><span class="pre">\macro{#1}</span></span> which expands
to the (raw) #1th polynomial coefficient.</p>
<ul class="simple">
<li><p>Attention, coefficients here are indexed starting at 1.  This is
an unfortunate legacy situation related to the original indexing
convention in <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> arrays.</p></li>
<li><p>With #1=-1, -2, ..., <span class="docutils literal"><span class="pre">\macro{#1}</span></span> returns leading coefficients.</p></li>
<li><p>With #1=0, returns the number of coefficients, i.e. <span class="docutils literal">1 + deg f</span>
for non-zero polynomials.</p></li>
<li><p>Out-of-range #1's return <span class="docutils literal">0/1[0]</span>.</p></li>
</ul>
<p>See also <a class="reference internal" href="#polnthcoeff-polname-index">\PolNthCoeff{&lt;polname&gt;}{&lt;index&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polget-polname-fromarray-macro">
<span id="polget"></span><h2><a class="toc-backref" href="#id124"><span class="docutils literal"><span class="pre">\PolGet{&lt;polname&gt;}\fromarray\macro</span></span></a></h2>
<blockquote>
<p>Does the converse operation to
<span class="docutils literal"><span class="pre">\PolAssign{&lt;polname&gt;}\toarray\macro</span></span>. Each individual
<span class="docutils literal"><span class="pre">\macro{&lt;value&gt;}</span></span> gets expanded in an <span class="docutils literal">\edef</span> and then normalized
via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p>
<p>The leading zeros are removed from the polynomial.</p>
<p>(contrived) Example:</p>
<pre class="literal-block">\xintAssignArray{1}{-2}{5}{-3}\to\foo
\PolGet{f}\fromarray\foo</pre>
<p>This will define <span class="docutils literal">f</span> as would have <span class="docutils literal">\poldef <span class="pre">f(x):=1-2x+5x^2-3x^3;</span></span>.</p>
</blockquote>
</div>
<div class="section" id="polfromcsv-polname-csv">
<span id="polfromcsv"></span><h2><a class="toc-backref" href="#id125"><span class="docutils literal"><span class="pre">\PolFromCSV{&lt;polname&gt;}{&lt;csv&gt;}</span></span></a></h2>
<blockquote>
<p>Defines a polynomial directly from the comma separated list of values
(or a macro expanding to such a list) of its coefficients, the <em>first
item</em> gives the constant term, the <em>last item</em> gives the leading
coefficient, except if zero, then it is dropped (iteratively). List
items are each expanded in an <span class="docutils literal">\edef</span> and then put into normalized
form via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s macro <span class="docutils literal">\xintRaw</span>.</p>
<p>As leading zero coefficients are removed:</p>
<pre class="literal-block">\PolFromCSV{f}{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}</pre>
<p>defines the zero polynomial, which holds only one coefficient.</p>
<p>See also expandable macro <a class="reference internal" href="#poltocsv-polname">\PolToCSV{&lt;polname&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polmapcoeffs-macro-polname">
<span id="polmapcoeffs"></span><h2><a class="toc-backref" href="#id126"><span class="docutils literal"><span class="pre">\PolMapCoeffs{\macro}{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>It modifies ('in-place': original coefficients get lost) each
coefficient of the defined polynomial via the <em>expandable</em> macro
<span class="docutils literal">\macro</span>. The degree is adjusted as necessary if some leading
coefficients vanish after the operation.</p>
<p>In the replacement text of <span class="docutils literal">\macro</span>, <span class="docutils literal">\index</span> expands to the
coefficient index (starting at zero for the constant term).</p>
<p>Notice that <span class="docutils literal">\macro</span> will have to handle inputs in the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>
internal format. This means that it probably will have to be
expressed in terms of macros from the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> package.</p>
<p>Example:</p>
<pre class="literal-block">\def\foo#1{\xintMul{#1}{\the\numexpr\index*\index\relax}}</pre>
<p>(or with <span class="docutils literal"><span class="pre">\xintSqr{\index}</span></span>) to replace <span class="docutils literal">n</span>-th coefficient
<span class="docutils literal">f_n</span> by <span class="docutils literal">f_n*n^2</span>.</p>
</blockquote>
</div>
<div class="section" id="polreducecoeffs-polname">
<span id="polreducecoeffs"></span><h2><a class="toc-backref" href="#id127"><span class="docutils literal"><span class="pre">\PolReduceCoeffs{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Reduces the internal representations of the coefficients to
their lowest terms.</p>
</blockquote>
</div>
<div class="section" id="id24">
<span id="id23"></span><h2><a class="toc-backref" href="#id128"><span class="docutils literal"><span class="pre">\PolReduceCoeffs*{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Reduces the internal representations of the coefficients to their
lowest terms, but ignoring a possible separated &quot;power of ten part&quot;.</p>
<p>For example, <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> stores an <span class="docutils literal">30e2/50</span> input as <span class="docutils literal">30/50</span> with
a separate <span class="docutils literal">10^2</span> part.  This will thus get replaced by <span class="docutils literal">3e^2/5</span>
(or rather whatever <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> uses for internal representation), and
not by <span class="docutils literal">60</span> as would result from complete reduction.</p>
<p>Evaluations with polynomials treated by this can be much faster than
with those handled by the non-starred variant
<a class="reference internal" href="#polreducecoeffs-polname">\PolReduceCoeffs{&lt;polname&gt;}</a>: as the numerators and denominators
remain generally smaller.</p>
</blockquote>
</div>
<div class="section" id="polmakemonic-polname">
<span id="polmakemonic"></span><h2><a class="toc-backref" href="#id129"><span class="docutils literal"><span class="pre">\PolMakeMonic{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Divides by the leading coefficient. It is recommended to execute
<a class="reference internal" href="#id24">\PolReduceCoeffs*{&lt;polname&gt;}</a> immediately afterwards. This is not
done automatically, in case the original polynomial had integer
coefficients and the user wants to keep the leading one as common
denominator for typesetting purposes.</p>
</blockquote>
</div>
<div class="section" id="polmakeprimitive-polname">
<span id="polmakeprimitive"></span><h2><a class="toc-backref" href="#id130"><span class="docutils literal"><span class="pre">\PolMakePrimitive{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Divides by the integer content see (<a class="reference internal" href="#policontent">\PolIContent</a>).
This thus produces a polynomial with integer
coefficients having no common factor. The sign of the leading
coefficient is not modified.</p>
</blockquote>
</div>
<div class="section" id="poldiff-polname-1-polname-2">
<span id="poldiff"></span><h2><a class="toc-backref" href="#id131"><span class="docutils literal"><span class="pre">\PolDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_2</span> to the first derivative of <span class="docutils literal">polname_1</span>. It
is allowed to issue <span class="docutils literal"><span class="pre">\PolDiff{f}{f}</span></span>, effectively replacing <span class="docutils literal">f</span>
by <span class="docutils literal">f'</span>.</p>
<p>Coefficients of the result <span class="docutils literal">polname_2</span> are irreducible fractions
(see <a class="reference internal" href="#technicalities">Technicalities</a> for the whole story.)</p>
</blockquote>
</div>
<div class="section" id="poldiff-n-polname-1-polname-2">
<span id="poldiff-n"></span><h2><a class="toc-backref" href="#id132"><span class="docutils literal"><span class="pre">\PolDiff[N]{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_2</span> to the <span class="docutils literal">N</span>-th derivative of <span class="docutils literal">polname_1</span>.
Identical arguments is allowed. With <span class="docutils literal">N=0</span>, same effect as
<span class="docutils literal"><span class="pre">\PolLet{&lt;polname_2&gt;}={&lt;polname_1&gt;}</span></span>. With negative <span class="docutils literal">N</span>, switches to
using <span class="docutils literal">\PolAntiDiff</span>.</p>
</blockquote>
</div>
<div class="section" id="polantidiff-polname-1-polname-2">
<span id="polantidiff"></span><h2><a class="toc-backref" href="#id133"><span class="docutils literal"><span class="pre">\PolAntiDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_2</span> to the primitive of <span class="docutils literal">polname_1</span> vanishing
at zero.</p>
<p>Coefficients of the result <span class="docutils literal">polname_2</span> are irreducible fractions
(see <a class="reference internal" href="#technicalities">Technicalities</a> for the whole story.)</p>
</blockquote>
</div>
<div class="section" id="polantidiff-n-polname-1-polname-2">
<span id="polantidiff-n"></span><h2><a class="toc-backref" href="#id134"><span class="docutils literal"><span class="pre">\PolAntiDiff[N]{&lt;polname_1&gt;}{&lt;polname_2&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_2</span> to the result of <span class="docutils literal">N</span> successive integrations on
<span class="docutils literal">polname_1</span>. With negative <span class="docutils literal">N</span>, it switches to using <span class="docutils literal">\PolDiff</span>.</p>
</blockquote>
</div>
<div class="section" id="poldivide-polname-1-polname-2-polname-q-polname-r">
<span id="poldivide"></span><h2><a class="toc-backref" href="#id135"><span class="docutils literal"><span class="pre">\PolDivide{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_Q&gt;}{&lt;polname_R&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_Q</span> and <span class="docutils literal">polname_R</span> to be the quotient and
remainder in the Euclidean division of <span class="docutils literal">polname_1</span> by
<span class="docutils literal">polname_2</span>.</p>
</blockquote>
</div>
<div class="section" id="polquo-polname-1-polname-2-polname-q">
<span id="polquo"></span><h2><a class="toc-backref" href="#id136"><span class="docutils literal"><span class="pre">\PolQuo{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_Q&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_Q</span> to be the quotient in the Euclidean division
of <span class="docutils literal">polname_1</span> by <span class="docutils literal">polname_2</span>.</p>
</blockquote>
</div>
<div class="section" id="polrem-polname-1-polname-2-polname-r">
<span id="polrem"></span><h2><a class="toc-backref" href="#id137"><span class="docutils literal"><span class="pre">\PolRem{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_R&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_R</span> to be the remainder in the Euclidean division
of <span class="docutils literal">polname_1</span> by <span class="docutils literal">polname_2</span>.</p>
</blockquote>
</div>
<div class="section" id="polgcd-polname-1-polname-2-polname-gcd">
<span id="polgcd"></span><h2><a class="toc-backref" href="#id138"><span class="docutils literal"><span class="pre">\PolGCD{&lt;polname_1&gt;}{&lt;polname_2&gt;}{&lt;polname_GCD&gt;}</span></span></a></h2>
<blockquote>
<p>This sets <span class="docutils literal">polname_GCD</span> to be the (monic) GCD of <span class="docutils literal">polname_1</span>
and <span class="docutils literal">polname_2</span>.  It is a unitary polynomial except if both
<span class="docutils literal">polname_1</span> and <span class="docutils literal">polname_2</span> vanish, then <span class="docutils literal">polname_GCD</span> is the
zero polynomial.</p>
</blockquote>
</div>
</div>
<div class="section" id="expandable-macros">
<h1><a class="toc-backref" href="#id139">Expandable macros</a></h1>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>At <span class="docutils literal">0.8</span> <span class="docutils literal">polexpr</span> is usable with Plain TeX and not only with
LaTeX.  Some examples given in this section may be using LaTeX syntax
such as <span class="docutils literal">\renewcommand</span>.  Convert to TeX primitives as appropriate
if testing with a non LaTeX macro format.</p>
</div>
<p>These macros expand completely in two steps except <span class="docutils literal">\PolToExpr</span> and
<span class="docutils literal">\PolToFloatExpr</span> which need a <span class="docutils literal">\write</span>, <span class="docutils literal">\edef</span> or a
<span class="docutils literal"><span class="pre">\csname...\endcsname</span></span> context.</p>
<div class="section" id="poltoexpr-pol-expr">
<span id="poltoexpr"></span><h2><a class="toc-backref" href="#id140"><span class="docutils literal"><span class="pre">\PolToExpr{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Produces expandably <a class="footnote-reference brackets" href="#id26" id="id25">4</a> the string <span class="docutils literal"><span class="pre">coeff_N*x^N+...</span></span>, i.e. the
polynomial is using descending powers.</p>
<dl class="footnote brackets">
<dt class="label" id="id26"><span class="brackets"><a class="fn-backref" href="#id25">4</a></span></dt>
<dd><p>requires exhaustive expansion, for example as triggered by
<span class="docutils literal">\write</span> or <span class="docutils literal">\edef</span>.</p>
</dd>
</dl>
<p>Since <span class="docutils literal">0.8</span> the input is not restricted to be a polynomial name but
is allowed to be an arbitrary expression (where by default the
letter <span class="docutils literal">x</span> is recognized as the indeterminate; see
<a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a>).</p>
<p>The default output (which also by default uses the letter <span class="docutils literal">x</span> and is
completely configurable, see in particular <a class="reference internal" href="#poltoexprvar">\PolToExprVar</a>) is
compatible with both</p>
<ul class="simple">
<li><p>the Maple's input format,</p></li>
<li><p>and the PSTricks <span class="docutils literal">\psplot[algebraic]</span> input format.</p></li>
</ul>
<p>Attention that it is not compatible with Python, but see
<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a> in this regard.</p>
<p>It has the following characteristics:</p>
<ul class="simple">
<li><p>vanishing coefficients are skipped (issue <span class="docutils literal">\poltoexpralltrue</span> to
override this and produce output such as <span class="docutils literal">x^3+0*x^2+0*x^1+0</span>),</p></li>
<li><p>negative coefficients are not prefixed by  a <span class="docutils literal">+</span> sign (else,
Maple would not be happy),</p></li>
<li><p>coefficients numerically equal to <span class="docutils literal">1</span> (or <span class="docutils literal"><span class="pre">-1</span></span>) are present
only via their sign,</p></li>
<li><p>the letter <span class="docutils literal">x</span> is used and the degree one monomial is output as
<span class="docutils literal">x</span>, not as <span class="docutils literal">x^1</span>.</p></li>
<li><p>(<span class="docutils literal">0.8</span>) the caret <span class="docutils literal">^</span> is of catcode 12.  This means that one
can for convenience typeset in regular text mode, for example
using <span class="docutils literal">\texttt</span> (in LaTeX). But TeX will not know how to break
the expression across end-of-lines anyhow.  Formerly <span class="docutils literal">^</span> was
suitable for math mode but as the exponent is not braced this
worked only for polynomials of degrees at most 9.  Anyhow this
is not supposed to be a typesetting macro.</p></li>
</ul>
<p>Complete customization is possible, see the next macros.  Any user
redefinition must maintain the expandability property.</p>
</blockquote>
<div class="section" id="id27">
<span id="poltoexprvar"></span><h3><a class="toc-backref" href="#id141"><span class="docutils literal">\PolToExprVar</span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal">x</span>. The letter used in input.</p>
</blockquote>
</div>
<div class="section" id="poltoexprinvar">
<h3><a class="toc-backref" href="#id142"><span class="docutils literal">\PolToExprInVar</span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal">x</span>: the letter used as the polynomial indeterminate.</p>
<p>Recall that declared polynomials are more efficiently used in
algebraic expressions without the <span class="docutils literal">(x)</span>, i.e. <span class="docutils literal">P*Q</span> is better
than <span class="docutils literal"><span class="pre">P(x)*Q(x)</span></span>.  Thus the input, even if an expression, does not
have to contain any <span class="docutils literal">x</span>.</p>
<p>(new with <span class="docutils literal">0.8</span>)</p>
</blockquote>
</div>
<div class="section" id="id28">
<span id="poltoexprtimes"></span><h3><a class="toc-backref" href="#id143"><span class="docutils literal">\PolToExprTimes</span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal">*</span>.</p>
</blockquote>
</div>
<div class="section" id="poltoexprcaret">
<h3><a class="toc-backref" href="#id144"><span class="docutils literal">\PolToExprCaret</span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal">^</span> of catcode 12.  Set it to
expand to  <span class="docutils literal">**</span> for Python compatible output.</p>
<p>(new with <span class="docutils literal">0.8</span>)</p>
</blockquote>
</div>
<div class="section" id="poltoexprcmd-raw-coeff">
<span id="poltoexprcmd"></span><h3><a class="toc-backref" href="#id145"><span class="docutils literal"><span class="pre">\PolToExprCmd{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>Defaults to <span class="docutils literal"><span class="pre">\xintPRaw{\xintRawWithZeros{#1}}</span></span>.</p>
<p>This means that the coefficient value is printed-out as a fraction
<span class="docutils literal">a/b</span>, skipping the <span class="docutils literal">/b</span> part if <span class="docutils literal">b</span> turns out to be one.</p>
<p>Configure it to be <span class="docutils literal"><span class="pre">\xintPRaw{\xintIrr{#1}}</span></span> if the fractions
must be in irreducible terms.</p>
<p>An alternative is <span class="docutils literal"><span class="pre">\xintDecToString{\xintREZ{#1}}</span></span> which uses
integer or decimal fixed point format such as <span class="docutils literal">23.0071</span> if the
internal representation of the number only has a power of ten as
denominator (the effect of <span class="docutils literal">\xintREZ</span> here is to remove trailing
decimal zeros).  The behaviour of <span class="docutils literal">\xintDecToString</span> is not yet
stable for other cases, and for example at time of writing no
attempt is made to identify inputs having a finite decimal expansion
so for example <span class="docutils literal">23.007/2</span> or <span class="docutils literal">23.007/25</span> can appear in output
and not their finite decimal expansion with no denominator.</p>
</blockquote>
</div>
<div class="section" id="poltoexproneterm-raw-coeff-exponent">
<span id="poltoexproneterm"></span><h3><a class="toc-backref" href="#id146"><span class="docutils literal"><span class="pre">\PolToExprOneTerm{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>This is the macro which from the coefficient and the exponent
produces the corresponding term in output, such as <span class="docutils literal">2/3*x^7</span>.</p>
<p>For its default definition, see the source code.  It uses
<a class="reference internal" href="#poltoexprcmd">\PolToExprCmd</a>, <a class="reference internal" href="#poltoexprtimes">\PolToExprTimes</a>, <a class="reference internal" href="#poltoexprvar">\PolToExprVar</a> and
<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a>.</p>
</blockquote>
</div>
<div class="section" id="poltoexpronetermstylea-raw-coeff-exponent">
<span id="poltoexpronetermstylea"></span><h3><a class="toc-backref" href="#id147"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleA{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>This holds the default package meaning of <span class="docutils literal">\PolToExprOneTerm</span>.</p>
</blockquote>
</div>
<div class="section" id="poltoexpronetermstyleb-raw-coeff-exponent">
<span id="poltoexpronetermstyleb"></span><h3><a class="toc-backref" href="#id148"><span class="docutils literal"><span class="pre">\PolToExprOneTermStyleB{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>This holds an alternative meaning, which puts the fractional part of
a coefficient after the monomial, i.e. like this:</p>
<pre class="literal-block">2*x^11/3+3*x^8/7-x^5-x^4/4-x^3-x^2/2-2*x+1</pre>
<p><a class="reference internal" href="#poltoexprcmd">\PolToExprCmd</a> isn't used at all in this style.  But
<a class="reference internal" href="#poltoexprtimes">\PolToExprTimes</a>, <a class="reference internal" href="#poltoexprvar">\PolToExprVar</a> and <a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a> are obeyed.</p>
<p>To activate it use <span class="docutils literal">\let\PolToExprOneTerm\PolToExprOneTermStyleB</span>.
To revert to the package default behaviour, issue
<span class="docutils literal">\let\PolToExprOneTerm\PolToExprOneTermStyleA</span>.</p>
</blockquote>
</div>
<div class="section" id="poltoexprtermprefix-raw-coeff">
<span id="poltoexprtermprefix"></span><h3><a class="toc-backref" href="#id149"><span class="docutils literal"><span class="pre">\PolToExprTermPrefix{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>It receives as argument the coefficient.  Its default behaviour is
to produce a <span class="docutils literal">+</span> if the coefficient is positive, which will thus
serve to separate the monomials in the output.  This is to match
the default for <a class="reference internal" href="#poltoexprcmd-raw-coeff">\PolToExprCmd{&lt;raw_coeff&gt;}</a> which in case of a
positive coefficient does not output an explicit <span class="docutils literal">+</span> prefix.</p>
</blockquote>
</div>
</div>
<div class="section" id="poltofloatexpr-pol-expr">
<span id="poltofloatexpr"></span><h2><a class="toc-backref" href="#id150"><span class="docutils literal"><span class="pre">\PolToFloatExpr{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Similar to <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{&lt;pol. expr.&gt;}</a> but using
<a class="reference internal" href="#poltofloatexprcmd-raw-coeff">\PolToFloatExprCmd{&lt;raw_coeff&gt;}</a> which by default rounds and
converts the coefficients to floating point format.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is unrelated to <a class="reference internal" href="#polgenfloatvariant-polname">\PolGenFloatVariant{&lt;polname&gt;}</a>:
<a class="reference internal" href="#poltofloatexprcmd-raw-coeff">\PolToFloatExprCmd{&lt;raw_coeff&gt;}</a> operates on the <em>exact</em>
coefficients anew (and may thus produce something else than
the coefficients of the polynomial function acting
in <span class="docutils literal">\xintfloateval</span> if the floating point precision was changed
in between).</p>
</div>
<p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p>
</blockquote>
<div class="section" id="poltofloatexproneterm-raw-coeff-exponent">
<span id="poltofloatexproneterm"></span><h3><a class="toc-backref" href="#id151"><span class="docutils literal"><span class="pre">\PolToFloatExprOneTerm{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</span></span></a></h3>
<blockquote>
<p>Similar to <a class="reference internal" href="#poltoexproneterm-raw-coeff-exponent">\PolToExprOneTerm{&lt;raw_coeff&gt;}{&lt;exponent&gt;}</a>. But does not treat
especially coefficients equal to plus or minus one.</p>
</blockquote>
</div>
<div class="section" id="poltofloatexprcmd-raw-coeff">
<span id="poltofloatexprcmd"></span><h3><a class="toc-backref" href="#id152"><span class="docutils literal"><span class="pre">\PolToFloatExprCmd{&lt;raw_coeff&gt;}</span></span></a></h3>
<blockquote>
<p>The one-argument macro used by <span class="docutils literal">\PolToFloatExprOneTerm</span>.
It defaults to <span class="docutils literal"><span class="pre">\xintPFloat{#1}</span></span>, which trims trailing
zeroes.</p>
<p><em>changed at 0.8.2</em> Formerly it was using <span class="docutils literal">\xintFloat</span>.</p>
</blockquote>
</div>
</div>
<div class="section" id="id30">
<span id="id29"></span><h2><a class="toc-backref" href="#id153"><span class="docutils literal"><span class="pre">\PolToExpr*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Ascending powers: <span class="docutils literal"><span class="pre">coeff_0+coeff_1*x+coeff_2*x^2+...</span></span>.</p>
<p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p>
<p>Customizable with the same macros as for
<a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{&lt;pol. expr.&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="id32">
<span id="id31"></span><h2><a class="toc-backref" href="#id154"><span class="docutils literal"><span class="pre">\PolToFloatExpr*{&lt;pol.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Ascending powers.</p>
<p>Extended at <span class="docutils literal">0.8</span> to accept general expressions as input.</p>
</blockquote>
</div>
<div class="section" id="polnthcoeff-polname-index">
<span id="polnthcoeff"></span><h2><a class="toc-backref" href="#id155"><span class="docutils literal"><span class="pre">\PolNthCoeff{&lt;polname&gt;}{&lt;index&gt;}</span></span></a></h2>
<blockquote>
<p>It expands to the raw <span class="docutils literal">N</span>-th coefficient (<span class="docutils literal">N=0</span> corresponds to
the constant coefficient).  If <span class="docutils literal">N</span> is out of range, zero (in its
default <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> format <span class="docutils literal">0/1[0]</span>) is returned.</p>
<p>Negative indices <span class="docutils literal"><span class="pre">N=-1</span></span>, <span class="docutils literal"><span class="pre">-2</span></span>, ... return the leading
coefficient, sub-leading coefficient, ..., and finally <span class="docutils literal">0/1[0]</span>
for <span class="docutils literal"><span class="pre">N&lt;-1-degree</span></span>.</p>
</blockquote>
</div>
<div class="section" id="polleadingcoeff-polname">
<span id="polleadingcoeff"></span><h2><a class="toc-backref" href="#id156"><span class="docutils literal"><span class="pre">\PolLeadingCoeff{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Expands to the leading coefficient.</p>
</blockquote>
</div>
<div class="section" id="poldegree-polname">
<span id="poldegree"></span><h2><a class="toc-backref" href="#id157"><span class="docutils literal"><span class="pre">\PolDegree{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>It expands to the degree. This is <span class="docutils literal"><span class="pre">-1</span></span> if zero polynomial but this
may change in future. Should it then expand to <span class="docutils literal"><span class="pre">-\infty</span></span> ?</p>
</blockquote>
</div>
<div class="section" id="policontent-polname">
<span id="policontent"></span><h2><a class="toc-backref" href="#id158"><span class="docutils literal"><span class="pre">\PolIContent{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>It expands to the contents of the polynomial, i.e. to the positive
fraction such that dividing by this fraction produces a polynomial
with integer coefficients having no common prime divisor.</p>
<p>See <a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a>.</p>
</blockquote>
</div>
<div class="section" id="poltolist-polname">
<span id="poltolist"></span><h2><a class="toc-backref" href="#id159"><span class="docutils literal"><span class="pre">\PolToList{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Expands to <span class="docutils literal"><span class="pre">{coeff_0}{coeff_1}...{coeff_N}</span></span> with <span class="docutils literal">N</span> = degree, and
<span class="docutils literal">coeff_N</span> the leading coefficient
(the zero polynomial does give <span class="docutils literal">{0/1[0]}</span> and not an
empty output.)</p>
</blockquote>
</div>
<div class="section" id="poltocsv-polname">
<span id="poltocsv"></span><h2><a class="toc-backref" href="#id160"><span class="docutils literal"><span class="pre">\PolToCSV{&lt;polname&gt;}</span></span></a></h2>
<blockquote>
<p>Expands to <span class="docutils literal">coeff_0, coeff_1, coeff_2, <span class="pre">.....,</span> coeff_N</span>, starting
with constant term and ending with leading coefficient. Converse
to <a class="reference internal" href="#polfromcsv-polname-csv">\PolFromCSV{&lt;polname&gt;}{&lt;csv&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="poleval-polname-atexpr-num-expr">
<span id="polevalatexpr"></span><h2><a class="toc-backref" href="#id161"><span class="docutils literal"><span class="pre">\PolEval{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Same output as
<span class="docutils literal">\xinteval{polname(numerical expression)}</span>.</p>
</blockquote>
</div>
<div class="section" id="poleval-polname-at-value">
<span id="polevalat"></span><h2><a class="toc-backref" href="#id162"><span class="docutils literal"><span class="pre">\PolEval{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></h2>
<blockquote>
<p>Evaluates the polynomial at the given value which must be in (or
expand to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.</p>
</blockquote>
</div>
<div class="section" id="polevalreduced-polname-atexpr-num-expr">
<span id="polevalreducedatexpr"></span><h2><a class="toc-backref" href="#id163"><span class="docutils literal"><span class="pre">\PolEvalReduced{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Same output as <span class="docutils literal">\xinteval{reduce(polname(numerical <span class="pre">expression))}</span></span>.</p>
</blockquote>
</div>
<div class="section" id="polevalreduced-polname-at-value">
<span id="polevalreducedat"></span><h2><a class="toc-backref" href="#id164"><span class="docutils literal"><span class="pre">\PolEvalReduced{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></h2>
<blockquote>
<p>Evaluates the polynomial at the value which must be in (or expand
to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros, and outputs an
irreducible fraction.</p>
</blockquote>
</div>
<div class="section" id="polfloateval-polname-atexpr-num-expr">
<span id="polfloatevalatexpr"></span><h2><a class="toc-backref" href="#id165"><span class="docutils literal"><span class="pre">\PolFloatEval{&lt;polname&gt;}\AtExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></h2>
<blockquote>
<p>Same output as <span class="docutils literal">\xintfloateval{polname(numerical expression)}</span>.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a> must have
been issued before.</p>
</div>
<p>To use the <em>exact coefficients</em> with <em>exactly executed</em> additions
and multiplications and do the rounding only as the final last step,
the following syntax can be used: <a class="footnote-reference brackets" href="#id34" id="id33">5</a></p>
<pre class="literal-block">\xintfloateval{3.27*\xintexpr f(2.53)\relax^2}</pre>
<dl class="footnote brackets">
<dt class="label" id="id34"><span class="brackets"><a class="fn-backref" href="#id33">5</a></span></dt>
<dd><p>Cf. <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> documentation about nested expressions.</p>
</dd>
</dl>
</blockquote>
</div>
<div class="section" id="polfloateval-polname-at-value">
<span id="polfloatevalat"></span><h2><a class="toc-backref" href="#id166"><span class="docutils literal"><span class="pre">\PolFloatEval{&lt;polname&gt;}\At{&lt;value&gt;}</span></span></a></h2>
<blockquote>
<p>Evaluates the polynomial at the value which must be in (or expand
to) a format acceptable to the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros.</p>
</blockquote>
</div>
<div class="section" id="expandable-macros-related-to-the-root-localization-routines">
<h2><a class="toc-backref" href="#id167">Expandable macros related to the root localization routines</a></h2>
<div class="section" id="polsturmchainlength-sturmname">
<span id="polsturmchainlength"></span><h3><a class="toc-backref" href="#id168"><span class="docutils literal"><span class="pre">\PolSturmChainLength{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>Returns the integer <span class="docutils literal">N</span> such that <span class="docutils literal">sturmname_N</span> is the last one
in the Sturm chain <span class="docutils literal">sturmname_0</span>, <span class="docutils literal">sturmname_1</span>, ...</p>
<p>See <a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polsturmifzeroexactlyknown-sturmname-index-t-f">
<span id="polsturmifzeroexactlyknown"></span><h3><a class="toc-backref" href="#id169"><span class="docutils literal"><span class="pre">\PolSturmIfZeroExactlyKnown{&lt;sturmname&gt;}{&lt;index&gt;}{T}{F}</span></span></a></h3>
<blockquote>
<p>Executes <span class="docutils literal">T</span> if the <span class="docutils literal">index</span>-th interval reduces to a singleton,
i.e. the root is known exactly, else <span class="docutils literal">F</span>.</p>
</blockquote>
</div>
<div class="section" id="polsturmisolatedzeroleft-sturmname-index">
<span id="polsturmisolatedzeroleft"></span><h3><a class="toc-backref" href="#id170"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroLeft{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the left end-point for the <span class="docutils literal">index</span>-th interval, as
computed by some earlier <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Execution of this macro after some
<a class="reference internal" href="#polrefineinterval-n">\PolRefineInterval{&lt;sturmname&gt;}{&lt;index&gt;}</a>
will take into account the now known tighter bounds.</p>
</div>
<p>The value is pre-formatted using <a class="reference internal" href="#poldectostring">\PolDecTostring</a>.</p>
</blockquote>
</div>
<div class="section" id="polsturmisolatedzeroright-sturmname-index">
<span id="polsturmisolatedzeroright"></span><h3><a class="toc-backref" href="#id171"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroRight{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the right end-point for the <span class="docutils literal">index</span>-th interval as
computed by some earlier <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> and
possibly refined afterwards.</p>
<p>The value is pre-formatted using <a class="reference internal" href="#poldectostring">\PolDecTostring</a>.</p>
</blockquote>
</div>
<div class="section" id="polsturmisolatedzeromultiplicity-sturmname-index">
<span id="polsturmisolatedzeromultiplicity"></span><h3><a class="toc-backref" href="#id172"><span class="docutils literal"><span class="pre">\PolSturmIsolatedZeroMultiplicity{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the multiplicity of the unique root contained in the
<span class="docutils literal">index</span>-th interval.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p>A prior execution of <a class="reference internal" href="#id15">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</a> is mandatory.</p>
</div>
<p>See <a class="reference internal" href="#the-degree-nine-polynomial-with-0-99-0-999-0-9999-as-triple-roots">The degree nine polynomial with 0.99, 0.999, 0.9999 as triple
roots</a> for an example of use.</p>
</blockquote>
</div>
<div class="section" id="polsturmnbofisolatedzeros-sturmname">
<span id="polsturmnbofisolatedzeros"></span><h3><a class="toc-backref" href="#id173"><span class="docutils literal"><span class="pre">\PolSturmNbOfIsolatedZeros{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number of real roots of the polynomial
<span class="docutils literal">&lt;sturmname&gt;_0</span>, i.e. the number of distinct real roots of the
polynomial originally used to create the Sturm chain via
<a class="reference internal" href="#poltosturm-polname-sturmname">\PolToSturm{&lt;polname&gt;}{&lt;sturmname&gt;}</a>.</p>
</blockquote>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The next few macros counting roots, with or without multiplicities,
less than or equal to some value, are under evaluation and may be
removed from the package if their utility is judged to be not high
enough. They can be re-coded at user level on the basis of the other
documented package macros anyway.</p>
</div>
</div>
<div class="section" id="polsturmnbofrootsof-sturmname-lessthanorequalto-value">
<h3><a class="toc-backref" href="#id174"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number of distinct roots (of the polynomial used to
create the Sturm chain) less than or equal to the <span class="docutils literal">value</span> (i.e. a
number of fraction recognizable by the <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> macros).</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
<p>And the argument is a <span class="docutils literal">&lt;sturmname&gt;</span>, not a <span class="docutils literal">&lt;polname&gt;</span> (this is
why the macro contains Sturm in its name), simply to be reminded
of the above constraint.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr">
<span id="polsturmnbofrootsof"></span><h3><a class="toc-backref" href="#id175"><span class="docutils literal"><span class="pre">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number of distinct roots (of the polynomial
used to create the Sturm chain) which are less than or equal to the
given numerical expression.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value">
<h3><a class="toc-backref" href="#id176"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number counted with multiplicities of the roots (of
the polynomial used to create the Sturm chain) which are less than
or equal to the given <span class="docutils literal">value</span>.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id15">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</a> (or the double starred
variant) must have been executed beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr">
<h3><a class="toc-backref" href="#id177"><span class="docutils literal"><span class="pre">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num.</span> <span class="pre">expr.&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the total number of roots (counted with multiplicities)
which are less than or equal to the given <span class="docutils literal">expression</span>.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id15">\PolSturmIsolateZeros*{&lt;sturmname&gt;}</a> (or the double starred
variant) must have been executed beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmnbofrationalroots-sturmname">
<h3><a class="toc-backref" href="#id178"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRoots{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number of rational roots (without multiplicities).</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmnbofrationalrootswithmultiplicities-sturmname">
<h3><a class="toc-backref" href="#id179"><span class="docutils literal"><span class="pre">\PolSturmNbOfRationalRootsWithMultiplicities{&lt;sturmname&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the number of rational roots (counted with multiplicities).</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmrationalroot-sturmname-k">
<h3><a class="toc-backref" href="#id180"><span class="docutils literal"><span class="pre">\PolSturmRationalRoot{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the k-th rational root.  They are enumerated from left to
right starting at index value <span class="docutils literal">1</span>.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmrationalrootindex-sturmname-k">
<h3><a class="toc-backref" href="#id181"><span class="docutils literal"><span class="pre">\PolSturmRationalRootIndex{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the index of the <span class="docutils literal">k</span>th rational root as part of the
ordered real roots (counted without multiplicities). So
<a class="reference internal" href="#polsturmrationalroot-sturmname-k">\PolSturmRationalRoot{&lt;sturmname&gt;}{&lt;k&gt;}</a> is equivalent to
this nested call:</p>
<pre class="literal-block">\PolSturmIsolatedZeroLeft{&lt;sturmname&gt;}{\PolSturmRationalRootIndex{&lt;sturmname&gt;}{&lt;k&gt;}}</pre>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polsturmrationalrootmultiplicity-sturmname-k">
<h3><a class="toc-backref" href="#id182"><span class="docutils literal"><span class="pre">\PolSturmRationalRootMultiplicity{&lt;sturmname&gt;}{&lt;k&gt;}</span></span></a></h3>
<blockquote>
<p>Expands to the multiplicity of the <span class="docutils literal">k</span>th rational root.</p>
<div class="admonition attention">
<p class="admonition-title">Attention!</p>
<p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> must have been executed
beforehand.</p>
</div>
</blockquote>
</div>
<div class="section" id="polintervalwidth-sturmname-index">
<span id="polintervalwidth"></span><h3><a class="toc-backref" href="#id183"><span class="docutils literal"><span class="pre">\PolIntervalWidth{&lt;sturmname&gt;}{&lt;index&gt;}</span></span></a></h3>
<blockquote>
<p>The <span class="docutils literal">10^E</span> width of the current <span class="docutils literal">index</span>-th root localization
interval. Output is in <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> raw <span class="docutils literal">1/1[E]</span> format (if not zero).</p>
</blockquote>
</div>
<div class="section" id="expandable-macros-for-use-within-execution-of-polprintintervals">
<h3><a class="toc-backref" href="#id184">Expandable macros for use within execution of <span class="docutils literal">\PolPrintIntervals</span></a></h3>
<p>These macros are for usage within custom user redefinitions of
<a class="reference internal" href="#polprintintervalsknownroot">\PolPrintIntervalsKnownRoot</a>, <a class="reference internal" href="#polprintintervalsunknownroot">\PolPrintIntervalsUnknownRoot</a>, or
in redefinitions of <a class="reference internal" href="#polprintintervalsprintexactzero">PolPrintIntervalsPrintExactZero</a> (used in the
default for the former) and of <a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a>,
<a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a> (used in the default for the
latter).</p>
</div>
<div class="section" id="polprintintervalsthevar">
<h3><a class="toc-backref" href="#id185"><span class="docutils literal">\PolPrintIntervalsTheVar</span></a></h3>
<blockquote>
<p>Expands to the name (default <span class="docutils literal">Z</span>) used for representing the roots,
which was passed as optional argument <span class="docutils literal">varname</span> to
<a class="reference internal" href="#polprintintervals-varname-sturmname">\PolPrintIntervals[&lt;varname&gt;]{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polprintintervalstheindex">
<h3><a class="toc-backref" href="#id186"><span class="docutils literal">\PolPrintIntervalsTheIndex</span></a></h3>
<blockquote>
<p>Expands to the index of the considered interval (indexing starting
at 1 for the leftmost interval).</p>
</blockquote>
</div>
<div class="section" id="polprintintervalsthesturmname">
<h3><a class="toc-backref" href="#id187"><span class="docutils literal">\PolPrintIntervalsTheSturmName</span></a></h3>
<blockquote>
<p>Expands to the argument which was passed as <span class="docutils literal">&lt;sturmname&gt;</span> to
<a class="reference internal" href="#polprintintervals-varname-sturmname">\PolPrintIntervals[&lt;varname&gt;]{&lt;sturmname&gt;}</a>.</p>
</blockquote>
</div>
<div class="section" id="polprintintervalstheleftendpoint">
<h3><a class="toc-backref" href="#id188"><span class="docutils literal">\PolPrintIntervalsTheLeftEndPoint</span></a></h3>
<blockquote>
<p>The left end point of the interval, as would be produced by
<a class="reference internal" href="#polsturmisolatedzeroleft">\PolSturmIsolatedZeroLeft</a> if it was
used with arguments the Sturm chain name and interval index returned
by <a class="reference internal" href="#polprintintervalsthesturmname">\PolPrintIntervalsTheSturmName</a> and
<a class="reference internal" href="#polprintintervalstheindex">\PolPrintIntervalsTheIndex</a>.</p>
</blockquote>
</div>
<div class="section" id="polprintintervalstherightendpoint">
<h3><a class="toc-backref" href="#id189"><span class="docutils literal">\PolPrintIntervalsTheRightEndPoint</span></a></h3>
<blockquote>
<p>The right end point of the interval, as would be produced by
<a class="reference internal" href="#polsturmisolatedzeroright">\PolSturmIsolatedZeroRight</a> for
this Sturm chain name and index.</p>
</blockquote>
</div>
<div class="section" id="polprintintervalsthemultiplicity">
<h3><a class="toc-backref" href="#id190"><span class="docutils literal">\PolPrintIntervalsTheMultiplicity</span></a></h3>
<blockquote>
<p>The multiplicity of the unique root within the interval of index
<a class="reference internal" href="#polprintintervalstheindex">\PolPrintIntervalsTheIndex</a>. Makes sense only if the starred (or
double-starred) variant of <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> was used earlier.</p>
</blockquote>
</div>
</div>
</div>
<div class="section" id="booleans-with-default-setting-as-indicated">
<h1><a class="toc-backref" href="#id191">Booleans (with default setting as indicated)</a></h1>
<div class="section" id="xintverbosefalse">
<h2><a class="toc-backref" href="#id192"><span class="docutils literal">\xintverbosefalse</span></a></h2>
<blockquote>
<p>This is actually an <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> configuration. Setting it to
<span class="docutils literal">true</span> triggers the writing of information to the log when new
polynomial or scalar variables are defined.</p>
<div class="admonition caution">
<p class="admonition-title">Caution!</p>
<p>The macro and variable meanings as written to the log are to be
considered unstable and undocumented internal structures.</p>
</div>
</blockquote>
</div>
<div class="section" id="polnewpolverbosefalse">
<h2><a class="toc-backref" href="#id193"><span class="docutils literal">\polnewpolverbosefalse</span></a></h2>
<blockquote>
<p>When <span class="docutils literal">\poldef</span> is used, both a variable and a function are
defined.  The default <span class="docutils literal">\polnewpolverbosefalse</span> setting suppresses
the print-out to the log and terminal of the function macro meaning,
as it only duplicates the information contained in the variable
which is already printed out to the log and terminal.</p>
<p>However <a class="reference internal" href="#polgenfloatvariant-polname">\PolGenFloatVariant{&lt;polname&gt;}</a> does still print out the
information relative to the polynomial function it defines for use in
<span class="docutils literal">\xintfloateval{}</span> as there is no float polynomial variable, only the
function, and it is the only way to see its rounded coefficients
(<span class="docutils literal">\xintverbosefalse</span> suppresses also that info).</p>
<p>If set to <span class="docutils literal">true</span>, it overrides in both cases
<span class="docutils literal">\xintverbosefalse</span>.  The setting only affects polynomial
declarations.  Scalar variables such as those holding information on
roots obey only the <span class="docutils literal"><span class="pre">\xintverbose...</span></span> setting.</p>
<p>(new with <span class="docutils literal">0.8</span>)</p>
</blockquote>
</div>
<div class="section" id="poltypesetallfalse">
<h2><a class="toc-backref" href="#id194"><span class="docutils literal">\poltypesetallfalse</span></a></h2>
<blockquote>
<p>If <span class="docutils literal">true</span>, <a class="reference internal" href="#poltypeset">\PolTypeset</a> will also typeset the vanishing
coefficients.</p>
</blockquote>
</div>
<div class="section" id="poltoexprallfalse">
<h2><a class="toc-backref" href="#id195"><span class="docutils literal">\poltoexprallfalse</span></a></h2>
<blockquote>
<p>If <span class="docutils literal">true</span>, <a class="reference internal" href="#poltoexpr-pol-expr">\PolToExpr{&lt;pol. expr.&gt;}</a> and <a class="reference internal" href="#poltofloatexpr-pol-expr">\PolToFloatExpr{&lt;pol. expr.&gt;}</a> will
also include the vanishing coefficients in their outputs.</p>
</blockquote>
</div>
</div>
<div class="section" id="utilies">
<h1><a class="toc-backref" href="#id196">Utilies</a></h1>
<div class="section" id="poldectostring-decimal-number">
<span id="poldectostring"></span><h2><a class="toc-backref" href="#id197"><span class="docutils literal">\PolDecToString{decimal number}</span></a></h2>
<blockquote>
<p>This is a utility macro to print decimal numbers.  It is an alias
for <span class="docutils literal">\xintDecToString</span>.</p>
</blockquote>
<blockquote>
<p>For example
<span class="docutils literal"><span class="pre">\PolDecToString{123.456e-8}</span></span> will expand to <span class="docutils literal">0.00000123456</span>
and <span class="docutils literal"><span class="pre">\PolDecToString{123.450e-8}</span></span> to <span class="docutils literal">0.00000123450</span> which
illustrates that trailing zeros are not trimmed.</p>
<p>To trim trailing zeroes, one can use
<span class="docutils literal"><span class="pre">\PolDecToString{\xintREZ{#1}}</span></span>.</p>
<p>Attention that a.t.t.o.w. if the argument is for example <span class="docutils literal">1/5</span>, the
macro does not identify that this is in fact a number with a finite
decimal expansion and it outputs <span class="docutils literal">1/5</span>.  See current <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>
documentation.</p>
</blockquote>
</div>
<div class="section" id="polexprsetup">
<h2><a class="toc-backref" href="#id198"><span class="docutils literal">\polexprsetup</span></a></h2>
<blockquote>
<p>Serves to customize the package. Currently only two keys are
recognized:</p>
<ul class="simple">
<li><p><span class="docutils literal">norr</span>: the postfix that <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a>
should append to <span class="docutils literal">&lt;sturmname&gt;</span> to declare the primitive polynomial
obtained from original one after removal of all rational roots.
The default value is <span class="docutils literal">_norr</span> (standing for “no rational roots”).</p></li>
<li><p><span class="docutils literal">sqfnorr</span>: the postfix that <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a>
should append to <span class="docutils literal">&lt;sturmname&gt;</span> to declare the primitive polynomial
obtained from original one after removal of all rational roots and
suppression of all multiplicities.
The default value is <span class="docutils literal">_sqf_norr</span> (standing for “square-free with
no rational roots”).</p></li>
</ul>
<p>The package executes <span class="docutils literal">\polexprsetup{norr=_norr, sqfnorr=_sqf_norr}</span> as default.</p>
</blockquote>
</div>
</div>
<div class="section" id="technicalities">
<h1><a class="toc-backref" href="#id199">Technicalities</a></h1>
<ul>
<li><p>The catcode of the semi-colon is reset temporarily by <a class="reference internal" href="#poldef">\poldef</a> macro in case some other package (for example the French
babel module) may have made it active. This will fail though if the
whole thing was already part of a macro argument, in such cases one
can use <a class="reference internal" href="#id8">\PolDef</a> rather. The colon in <span class="docutils literal">:=</span> may be
active with no consequences.</p></li>
<li><p>As a consequence of <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a> addition and subtraction always using
least common multiples for the denominators, user-chosen common
denominators survive additions and multiplications. For example, this:</p>
<pre class="literal-block">\poldef P(x):= 1/2 + 2/2*x + 3/2*x^3 + 4/2*x^4;
\poldef Q(x):= 1/3 + (2/3)x + (3/3)x^3 + (4/3)x^4;
\poldef PQ(x):= P*Q;</pre>
<p>gives internally the polynomial:</p>
<pre class="literal-block">1/6+4/6*x^1+4/6*x^2+6/6*x^3+20/6*x^4+16/6*x^5+9/6*x^6+24/6*x^7+16/6*x^8</pre>
<p>where all coefficients have the same denominator 6. Notice though that
<span class="docutils literal">\PolToExpr{PQ}</span> outputs the <span class="docutils literal">6/6*x^3</span> as <span class="docutils literal">x^3</span> because (by
default) it recognizes and filters out coefficients equal to one or
minus one. One can use for example
<span class="docutils literal">\PolToCSV{PQ}</span> to see the internally stored coefficients.</p>
</li>
<li><p><a class="reference internal" href="#poldiff-polname-1-polname-2">\PolDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</a> always applies <span class="docutils literal">\xintPIrr</span> to the
resulting coefficients, which means that fractions are reduced to
lowest terms but ignoring an already separated <em>power of ten</em> part <span class="docutils literal">[N]</span>
present in the internal representation.  This is tentative and may change.</p>
<p>Same remark for <a class="reference internal" href="#polantidiff-polname-1-polname-2">\PolAntiDiff{&lt;polname_1&gt;}{&lt;polname_2&gt;}</a>.</p>
</li>
<li><p>Currently, the package stores all coefficients from index <span class="docutils literal">0</span> to
index equal to the polynomial degree inside a single macro, as a list.
This data structure is obviously very inefficient for polynomials of
high degree and few coefficients (as an example with <span class="docutils literal">\poldef <span class="pre">f(x):=x^1000</span> + x^500;</span> the subsequent definition <span class="docutils literal">\poldef <span class="pre">g(x):=</span> <span class="pre">f(x)^2;</span></span> will do of the order of 1,000,000 multiplications and
additions involvings only zeroes... which does take time). This
may change in the future.</p></li>
<li><p>As is to be expected internal structures of the package are barely
documented and unstable. Don't use them.</p></li>
</ul>
</div>
<div class="section" id="change-log">
<h1><a class="toc-backref" href="#id200">CHANGE LOG</a></h1>
<ul>
<li><p>v0.1 (2018/01/11): initial release. Features:</p>
<ul class="simple">
<li><p>The <a class="reference internal" href="#poldef">\poldef</a> parser itself,</p></li>
<li><p>Differentiation and anti-differentiation,</p></li>
<li><p>Euclidean division and GCDs,</p></li>
<li><p>Various utilities such as <a class="reference internal" href="#polfromcsv">\PolFromCSV</a>,
<a class="reference internal" href="#polmapcoeffs">\PolMapCoeffs</a>,
<a class="reference internal" href="#poltocsv">\PolToCSV</a>, <a class="reference internal" href="#poltoexpr">\PolToExpr</a>, ...</p></li>
</ul>
<p>Only one-variable polynomials so far.</p>
</li>
<li><p>v0.2 (2018/01/14)</p>
<ul class="simple">
<li><p>Fix: <span class="docutils literal">&quot;README thinks \numexpr recognizes ^ operator&quot;</span>.</p></li>
<li><p>Convert README to reStructuredText markup.</p></li>
<li><p>Move main documentation from README to separate <span class="docutils literal">polexpr.txt</span> file.</p></li>
<li><p>Provide <span class="docutils literal">polexpr.html</span> as obtained via <a class="reference external" href="http://docutils.sourceforge.net/docs/index.html">DocUtils</a> <span class="docutils literal">rst2html.py</span>.</p></li>
<li><p>Convert README to (CTAN compatible) Markdown markup.</p></li>
</ul>
<p>Due to lack of available time the test suite might not be extensive
enough. Bug reports are very welcome!</p>
</li>
<li><p>v0.3 (2018/01/17)</p>
<ul>
<li><p>bug fixes:</p>
<ul>
<li><p>the <span class="docutils literal">0.1</span> <a class="reference internal" href="#polevalat">\PolEval</a> accepted expressions for its second
argument, but this was removed by mistake at <span class="docutils literal">0.2</span>. Restored.</p>
<p><strong>Attention</strong>: at <span class="docutils literal">0.4</span> this has been reverted again, and
<a class="reference internal" href="#polevalatexpr">\PolEval{P}\AtExpr{foo}</a> syntax is needed for
using expressions in the second argument.</p>
</li>
</ul>
</li>
<li><p>incompatible or breaking changes:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#poltoexpr">\PolToExpr</a> now by default uses <em>descending</em>
powers (it also treats differently coefficients equal to 1 or -1.)
Use <a class="reference internal" href="#id29">\PolToExpr*</a> for <em>ascending</em> powers.</p></li>
<li><p><a class="reference internal" href="#polevalat">\PolEval</a> reduced the output to smallest terms,
but as this is costly with big fractions and not needed if e.g.
wrapped in an <span class="docutils literal">\xintRound</span> or <span class="docutils literal">\xintFloat</span>, this step has been
removed; the former meaning is available as <a class="reference internal" href="#polevalreducedat">\PolEvalReduced</a>.</p></li>
</ul>
</li>
<li><p>new (or newly documented) macros:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#poltypesetcmd">\PolTypesetCmd</a></p></li>
<li><p><a class="reference internal" href="#poltypesetcmdprefix">\PolTypesetCmdPrefix</a></p></li>
<li><p><a class="reference internal" href="#poltypesetmonomialcmd">\PolTypesetMonomialCmd</a></p></li>
<li><p><a class="reference internal" href="#polevalreducedat">\PolEvalReducedAt</a></p></li>
<li><p><a class="reference internal" href="#poltofloatexpr">\PolToFloatExpr</a></p></li>
<li><p><a class="reference internal" href="#poltoexproneterm">\PolToExprOneTerm</a></p></li>
<li><p><a class="reference internal" href="#poltofloatexproneterm">\PolToFloatExprOneTerm</a></p></li>
<li><p><a class="reference internal" href="#poltoexprcmd">\PolToExprCmd</a></p></li>
<li><p><a class="reference internal" href="#poltofloatexprcmd">\PolToFloatExprCmd</a></p></li>
<li><p><a class="reference internal" href="#poltoexprtermprefix">\PolToExprTermPrefix</a></p></li>
<li><p><a class="reference internal" href="#poltoexprvar">\PolToExprVar</a></p></li>
<li><p><a class="reference internal" href="#poltoexprtimes">\PolToExprTimes</a></p></li>
</ul>
</li>
<li><p>improvements:</p>
<ul>
<li><p>documentation has a table of contents, internal hyperlinks,
standardized signature notations and added explanations.</p></li>
<li><p>one can do <span class="docutils literal"><span class="pre">\PolLet{g}={f}</span></span> or <span class="docutils literal"><span class="pre">\PolLet{g}{f}</span></span>.</p></li>
<li><p><span class="docutils literal">\PolToExpr{f}</span> is highly customizable.</p></li>
<li><p><a class="reference internal" href="#poldef">\poldef</a> and other defining macros prepare the polynomial
functions for usage within <span class="docutils literal">\xintthefloatexpr</span> (or
<span class="docutils literal">\xintdeffloatvar</span>). Coefficients are pre-rounded to the
floating point precision. Indispensible for numerical algorithms,
as exact fractions, even reduced, quickly become very big. See the
documentation about how to use the exact polynomials also in
floating point context.</p>
<p><strong>Attention</strong>: this has been reverted at <span class="docutils literal">0.4</span>. The macro
<a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a> must be used for
generation floating point polynomial functions.</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p>v0.3.1 (2018/01/18)</p>
<p>Fixes two typos in example code included in the documentation.</p>
</li>
<li><p>v0.4 (2018/02/16)</p>
<ul>
<li><p>bug fixes:</p>
<ul class="simple">
<li><p>when Euclidean division gave a zero remainder, the internal
representation of this zero polynomial could be faulty; this
could cause mysterious bugs in conjunction with other package
macros such as <a class="reference internal" href="#polmapcoeffs">\PolMapCoeffs</a>.</p></li>
<li><p><a class="reference internal" href="#polgcd">\PolGCD</a> was buggy in case of first polynomial being
of lesser degree than the second one.</p></li>
</ul>
</li>
<li><p>breaking changes:</p>
<ul>
<li><p>formerly <a class="reference internal" href="#polevalat">\PolEval{P}\At{foo}</a> allowed <span class="docutils literal">foo</span> to
be an expression, which was transparently handled via
<span class="docutils literal">\xinttheexpr</span>. Now, <span class="docutils literal">foo</span> must be a fraction (or a macro
expanding to such) in the format acceptable by <span class="docutils literal">xintfrac.sty</span>
macros. Use <a class="reference internal" href="#polevalatexpr">\PolEval{P}\AtExpr{foo}</a> for more
general arguments using expression syntax. E.g., if <span class="docutils literal">foo</span> is the
name of a variable known to <span class="docutils literal">\xintexpr</span>.</p>
<p>The same holds for <a class="reference internal" href="#polevalreducedat">\PolEvalReduced</a>
and <a class="reference internal" href="#polfloatevalat">\PolFloatEval</a>.</p>
</li>
<li><p>the <span class="docutils literal">3.0</span> automatic generation of floating point variants has
been reverted. Not only do <em>not</em> the package macros automatically
generate floating point variants of newly created polynomials,
they actually make pre-existing such variant undefined.</p>
<p>See <a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a>.</p>
</li>
</ul>
</li>
<li><p>new non-expandable macros:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#polgenfloatvariant">\PolGenFloatVariant</a></p></li>
<li><p><a class="reference internal" href="#polgloballet">\PolGlobalLet</a></p></li>
<li><p><a class="reference internal" href="#poltypesetone">\PolTypesetOne</a></p></li>
<li><p><a class="reference internal" href="#polquo">\PolQuo</a></p></li>
<li><p><a class="reference internal" href="#polrem">\PolRem</a></p></li>
<li><p><a class="reference internal" href="#poltosturm">\PolToSturm</a></p></li>
<li><p><a class="reference internal" href="#id12">\PolToSturm*</a></p></li>
<li><p><a class="reference internal" href="#polsettosturmchainsignchangesat">\PolSetToSturmChainSignChangesAt</a></p></li>
<li><p><a class="reference internal" href="#polsettonbofzeroswithin">\PolSetToNbOfZerosWithin</a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a></p></li>
<li><p><a class="reference internal" href="#polrefineinterval">\PolRefineInterval*</a></p></li>
<li><p><a class="reference internal" href="#polrefineinterval-n">\PolRefineInterval[N]</a></p></li>
<li><p><a class="reference internal" href="#polensureintervallength">\PolEnsureIntervalLength</a></p></li>
<li><p><a class="reference internal" href="#polensureintervallengths">\PolEnsureIntervalLengths</a></p></li>
<li><p><a class="reference internal" href="#polprintintervals">\PolPrintIntervals</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsprintexactzero">\PolPrintIntervalsPrintExactZero</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsprintleftendpoint">\PolPrintIntervalsPrintLeftEndPoint</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsprintrightendpoint">\PolPrintIntervalsPrintRightEndPoint</a></p></li>
<li><p><a class="reference internal" href="#id23">\PolReduceCoeffs*</a></p></li>
<li><p><a class="reference internal" href="#polmakemonic">\PolMakeMonic</a></p></li>
</ul>
</li>
<li><p>new expandable macros:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#poltoexpronetermstylea">\PolToExprOneTermStyleA</a></p></li>
<li><p><a class="reference internal" href="#polifcoeffisplusorminusone">\PolIfCoeffIsPlusOrMinusOne</a></p></li>
<li><p><a class="reference internal" href="#polleadingcoeff">\PolLeadingCoeff</a></p></li>
<li><p><a class="reference internal" href="#polsturmchainlength">\PolSturmChainLength</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofisolatedzeros">\PolSturmNbOfIsolatedZeros</a></p></li>
<li><p><a class="reference internal" href="#polsturmifzeroexactlyknown">\PolSturmIfZeroExactlyKnown</a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatedzeroleft">\PolSturmIsolatedZeroLeft</a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatedzeroright">\PolSturmIsolatedZeroRight</a></p></li>
<li><p><span class="docutils literal">\PolPrintIntervalsTheEndPoint</span> (removed at 0.7)</p></li>
<li><p><a class="reference internal" href="#polprintintervalstheindex">\PolPrintIntervalsTheIndex</a></p></li>
<li><p><span class="docutils literal">\PolIfEndPointIsPositive</span> (removed at 0.7)</p></li>
<li><p><span class="docutils literal">\PolIfEndPointIsNegative</span> (removed at 0.7)</p></li>
<li><p><span class="docutils literal">\PolIfEndPointIsZero</span> (removed at 0.7)</p></li>
<li><p><a class="reference internal" href="#polintervalwidth">\PolIntervalWidth</a></p></li>
<li><p><a class="reference internal" href="#poldectostring">\PolDecToString</a></p></li>
</ul>
</li>
<li><p>improvements:</p>
<p>The main new feature is implementation of the <a class="reference external" href="https://en.wikipedia.org/wiki/Sturm%27s_theorem">Sturm algorithm</a>
for localization of the real roots of polynomials.</p>
</li>
</ul>
</li>
<li><p>v0.4.1 (2018/03/01)</p>
<p>Synced with xint 1.3.</p>
</li>
<li><p>v0.4.2 (2018/03/03)</p>
<p>Documentation fix.</p>
</li>
<li><p>v0.5 (2018/04/08)</p>
<ul class="simple">
<li><p>bug fixes:</p>
<ul>
<li><p><a class="reference internal" href="#polget-polname-fromarray-macro">\PolGet{&lt;polname&gt;}\fromarray\macro</a> crashed when <span class="docutils literal">\macro</span> was
an <a class="reference external" href="http://www.ctan.org/pkg/xint">xinttools</a> array macro with no items. It now produces the zero
polynomial.</p></li>
</ul>
</li>
<li><p>breaking changes:</p>
<ul>
<li><p><a class="reference internal" href="#poltosturm">\PolToSturm</a> creates primitive integer coefficients polynomials.
This speeds up localization of roots via
<a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a>. In case of user protests the author
will make available again the code producing the bona fide Sturm
polynomials as used formerly.</p></li>
<li><p>polynomials created from <a class="reference internal" href="#polfromcsv">\PolFromCSV</a> or <a class="reference internal" href="#polget">\PolGet</a>
get their coefficients normalized via <a class="reference external" href="http://www.ctan.org/pkg/xint">xintfrac</a>'s <span class="docutils literal">\xintRaw</span>.</p></li>
</ul>
</li>
<li><p>experimental change:</p>
<ul>
<li><p>optional argument to <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> (see <a class="reference internal" href="#the-degree-41-polynomial-with-2-1-9-1-8-0-0-1-1-9-2-as-roots">The
degree 41 polynomial with -2, -1.9, -1.8, ..., 0, 0.1, ..., 1.9, 2
as roots</a> for usage). It will presumably be replaced in future by
an interval specification.</p></li>
</ul>
</li>
<li><p>new non-expandable macro:</p>
<ul>
<li><p><a class="reference internal" href="#polmakeprimitive">\PolMakePrimitive</a></p></li>
</ul>
</li>
<li><p>new expandable macro:</p>
<ul>
<li><p><a class="reference internal" href="#policontent">\PolIContent</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.5.1 (2018/04/22)</p>
<ul class="simple">
<li><p>new feature:</p>
<ul>
<li><p>the character <span class="docutils literal">'</span> can be used in polynomial names.</p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.6 (2018/11/20)</p>
<ul class="simple">
<li><p>bugfix:</p>
<ul>
<li><p>the starred variant <a class="reference internal" href="#id13">\PolToSturm*{&lt;polname&gt;}{&lt;sturmname&gt;}</a> was
broken. On the occasion of the fix, its meaning has been modified,
see its documentation.</p></li>
<li><p>using <a class="reference internal" href="#poltosturm">\PolToSturm</a> with a constant polynomial
caused a division by zero error.</p></li>
</ul>
</li>
<li><p>new macro:</p>
<ul>
<li><p><a class="reference internal" href="#id14">\PolSturmIsolateZeros*</a>
acts like the <a class="reference internal" href="#polsturmisolatezeros">non-starred variant</a> then computes all the multiplicities.</p></li>
</ul>
</li>
<li><p>new expandable macros:</p>
<ul>
<li><p><a class="reference internal" href="#polsturmisolatedzeromultiplicity-sturmname-index">\PolSturmIsolatedZeroMultiplicity{&lt;sturmname&gt;}{&lt;index&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequalto-value">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrootsof-sturmname-lessthanorequaltoexpr-num-expr">\PolSturmNbOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num. expr.&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequalto-value">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualTo{&lt;value&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbwithmultofrootsof-sturmname-lessthanorequaltoexpr-num-expr">\PolSturmNbWithMultOfRootsOf{&lt;sturmname&gt;}\LessThanOrEqualToExpr{&lt;num. expr.&gt;}</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.7 (2018/12/08), v0.7.1 (bugfix), v0.7.2 (2nd bugfix) (2018/12/09)</p>
<ul class="simple">
<li><p>breaking changes:</p>
<ul>
<li><p>although <a class="reference internal" href="#polprintintervals-varname-sturmname">\PolPrintIntervals[&lt;varname&gt;]{&lt;sturmname&gt;}</a> default output
remains the same, some auxiliary macros for user-customization
have been removed: <span class="docutils literal">\PolPrintIntervalsTheEndPoint</span>,
<span class="docutils literal"><span class="pre">\PolIfEndPointIsPositive{T}{F}</span></span>,
<span class="docutils literal"><span class="pre">\PolIfEndPointIsNegative{T}{F}</span></span>, and
<span class="docutils literal"><span class="pre">\PolIfEndPointIsZero{T}{F}</span></span>.</p></li>
</ul>
</li>
<li><p>bugfix:</p>
<ul>
<li><p>it could happen that, contrarily to documentation, an interval
computed by <a class="reference internal" href="#polsturmisolatezeros-sturmname">\PolSturmIsolateZeros{&lt;sturmname&gt;}</a> had zero as an
endpoint,</p></li>
<li><p><a class="reference internal" href="#polensureintervallength-sturmname-index-exponent">\PolEnsureIntervalLength{&lt;sturmname&gt;}{&lt;index&gt;}{&lt;exponent&gt;}</a> could under
certain circumstances erroneously replace a non-zero root by
zero,</p></li>
<li><p><a class="reference internal" href="#polensureintervallengths-sturmname-exponent">\PolEnsureIntervalLengths{&lt;sturmname&gt;}{&lt;exponent&gt;}</a> crashed when used with
a polynomial with no real roots, hence for which no isolation intervals
existed (thanks to Thomas Söll for report).</p></li>
</ul>
</li>
<li><p>new macros:</p>
<ul>
<li><p><a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatezerosgetmultiplicitiesandrationalroots-sturmname">\PolSturmIsolateZerosGetMultiplicitiesAndRationalRoots{&lt;sturmname&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmisolatezerosandfindrationalroots-sturmname">\PolSturmIsolateZerosAndFindRationalRoots{&lt;sturmname&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polexprsetup">\polexprsetup</a></p></li>
<li><p><a class="reference internal" href="#id21">\PolPrintIntervals*</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsnorealroots">\PolPrintIntervalsNoRealRoots</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsbeginenv">\PolPrintIntervalsBeginEnv</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsendenv">\PolPrintIntervalsEndEnv</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsknownroot">\PolPrintIntervalsKnownRoot</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsunknownroot">\PolPrintIntervalsUnknownRoot</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsprintmultiplicity">\PolPrintIntervalsPrintMultiplicity</a></p></li>
</ul>
</li>
<li><p>new expandable macros:</p>
<ul>
<li><p><a class="reference internal" href="#polsturmnbofrationalroots-sturmname">\PolSturmNbOfRationalRoots{&lt;sturmname&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmnbofrationalrootswithmultiplicities-sturmname">\PolSturmNbOfRationalRootsWithMultiplicities{&lt;sturmname&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalroot-sturmname-k">\PolSturmRationalRoot{&lt;sturmname&gt;}{&lt;k&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalrootindex-sturmname-k">\PolSturmRationalRootIndex{&lt;sturmname&gt;}{&lt;k&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polsturmrationalrootmultiplicity-sturmname-k">\PolSturmRationalRootMultiplicity{&lt;sturmname&gt;}{&lt;k&gt;}</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthevar">\PolPrintIntervalsTheVar</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthesturmname">\PolPrintIntervalsTheSturmName</a></p></li>
<li><p><a class="reference internal" href="#polprintintervalsthemultiplicity">\PolPrintIntervalsTheMultiplicity</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.7.3 (2019/02/04)</p>
<ul class="simple">
<li><p>bugfix:</p>
<ul>
<li><p>Debugging information not destined to user showed in log if root
finding was done under <span class="docutils literal">\xintverbosetrue</span> regime.</p></li>
<li><p><a class="reference internal" href="#polprintintervalsthevar">\PolPrintIntervalsTheVar</a> remained defined after
<a class="reference internal" href="#polprintintervals">\PolPrintIntervals</a> but was left undefined after
<a class="reference internal" href="#id21">\PolPrintIntervals*</a> (reported by Jürgen Gilg). Now remains
defined in both cases, and <a class="reference internal" href="#polprintintervalsthesturmname">\PolPrintIntervalsTheSturmName</a>
also.</p></li>
<li><p>Polynomial names ending in digits caused errors (reported by Thomas
Söll).</p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.7.4 (2019/02/12)</p>
<ul class="simple">
<li><p>bugfix:</p>
<ul>
<li><p>20000000000 is too big for <span class="docutils literal">\numexpr</span>, shouldn't I know that?
Thanks to Jürgen Gilg for report.</p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.7.5 (2020/01/31)</p>
<p>Synced with xintexpr 1.4. Requires it.</p>
</li>
<li><p>v0.8 (2021/03/29)</p>
<p>Synced with xintexpr 1.4d. Requires it.</p>
<ul class="simple">
<li><p>breaking changes:</p>
<ul>
<li><p>As the usability of character <span class="docutils literal">'</span> in names has been extended
from <span class="docutils literal">\poldef</span> to also generally <span class="docutils literal">\xintexpr</span>, <span class="docutils literal">\xintdefvar</span>,
and <span class="docutils literal">\xintdeffunc</span>, it means that the infix operators
<span class="docutils literal">'and'</span>, <span class="docutils literal">'or'</span>, and <span class="docutils literal">'mod'</span> must be replaced
by <span class="docutils literal">&amp;&amp;</span>, <span class="docutils literal">||</span>, and <span class="docutils literal">/:</span> if they
follow immediately a variable name (similarly <span class="docutils literal">'xor'</span> must
be replaced by the <span class="docutils literal">xor()</span> function in such case).</p></li>
<li><p><a class="reference internal" href="#poltoexpr">\PolToExpr</a> by default uses a catcode 12
<span class="docutils literal">^</span>. See its documentation and the new configuration
<a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a>.</p></li>
</ul>
</li>
<li><p>deprecated:</p>
<ul>
<li><p>Usage of <span class="docutils literal">P/Q</span> for the euclidean quotient of two polynomials is
deprecated.  Start using <span class="docutils literal">quo(P,Q)</span> in its place.</p></li>
</ul>
</li>
<li><p>bugfix:</p>
<ul>
<li><p>The <span class="docutils literal">\xintglobaldefstrue</span> setting was obeyed only partially
by the polexpr macros defining polynomials.</p></li>
<li><p>The <span class="docutils literal">\xintexpr</span> variables storing the values of the extremities
of the intervals as found by <a class="reference internal" href="#polsturmisolatezeros">\PolSturmIsolateZeros</a> were not updated at 0.7.5 to the
xintexpr 1.4 format and thus caused low-level TeX errors if used.</p></li>
<li><p>Attempting to use in <span class="docutils literal">\poldef</span> a function previously declared
via <span class="docutils literal">\xintdeffunc</span> which made usage of the indexing or slicing
&quot;ople&quot; syntax typically caused <span class="docutils literal">TeX capacity exceeded</span> error.
Indeed 0.7.5 only partially made polexpr able to cope with the
extended possibilities for xintexpr 1.4 user-declared functions.
Hopefully <span class="docutils literal">0.8</span> achieves full functionality in this context.</p></li>
</ul>
</li>
<li><p>new macros:</p>
<ul>
<li><p><a class="reference internal" href="#polnewpolverbosefalse">\polnewpolverbosefalse</a></p></li>
<li><p><a class="reference internal" href="#poltoexprcaret">\PolToExprCaret</a></p></li>
<li><p><a class="reference internal" href="#poltoexprinvar">\PolToExprInVar</a></p></li>
<li><p>alongside the major new functionalities described in the next item
<a class="reference internal" href="#poltypeset">\PolTypeset</a> and <a class="reference internal" href="#poltoexpr">\PolToExpr</a> have
been enhanced to accept as argument a general expression and not
only a pre-declared polynomial name.</p></li>
</ul>
</li>
<li><p>new features:</p>
<ul>
<li><p>The package is usable under Plain and probably most any TeX format,
and not only under LaTeX.</p></li>
<li><p>The core of the package has been rewritten entirely in order to
start letting <span class="docutils literal">\xintexpr</span> recognize a polynomial type as a genuine
variable.  This has allowed:</p>
<ul>
<li><p>to solve the reduced inter-operability problems between polexpr
and <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> which arose as consequences to the deep <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4</span>
evolution,</p></li>
<li><p>to make available most of the functionality associated to
expandable macros directly in the <span class="docutils literal">\xinteval</span> syntax as
operators or functions,</p></li>
<li><p>to provide (expandable) functional interface in <span class="docutils literal">\xinteval</span> to
features previously available only via (for some, non-expandable)
macro interface such as gcd computations.</p></li>
</ul>
</li>
</ul>
</li>
</ul>
<p>See the updated <a class="reference internal" href="#quick-syntax-overview">Quick syntax overview</a> and then <a class="reference internal" href="#polexpr08">the extended syntax
description</a>.</p>
</li>
<li><p>v0.8.1 (2021/04/12)</p>
<ul class="simple">
<li><p>breaking changes:</p>
<ul>
<li><p>renamed v0.8's <span class="docutils literal">icontent()</span> to <a class="reference internal" href="#cont">cont()</a>.</p></li>
<li><p>renamed v0.8's <span class="docutils literal">lcoeff()</span> to <a class="reference internal" href="#lc">lc()</a>.</p></li>
</ul>
</li>
<li><p>bugfix:</p>
<ul>
<li><p>Sadly, <span class="docutils literal">diff1()</span>, <span class="docutils literal">diff2()</span>,  <span class="docutils literal">diffn()</span> were broken
for polynomials of degrees 8 or more, due to a typo and
insufficient testing.</p></li>
<li><p>The package should have (as documented) required <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> 1.4d
but in practice it accepted to work with <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> 1.4c, whose
<span class="docutils literal">\xinteval</span> does not know how to &quot;output&quot; a polynomial.</p></li>
<li><p>The definition of one of the two variants of <a class="reference internal" href="#polsturmnbofrootsof">\PolSturmNbOfRootsOf</a> was broken by an end-of-line space, left-over
from mass conversion from LaTeX to TeX syntax.</p></li>
</ul>
</li>
<li><p>added:</p>
<ul>
<li><p><a class="reference internal" href="#lpol">lpol()</a></p></li>
<li><p><a class="reference internal" href="#lcoeffs">lcoeffs()</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p>v0.8.2 (2021/05/05)</p>
<ul class="simple">
<li><p>breaking change:</p>
<ul>
<li><p>usage of <span class="docutils literal">\xintPFloat</span> in place of <span class="docutils literal">\xintFloat</span> for
<a class="reference internal" href="#poltofloatexprcmd">\PolToFloatExprCmd</a>.</p></li>
</ul>
</li>
<li><p>improved:</p>
<ul>
<li><p>Some <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> functions such as <span class="docutils literal">rseq()</span> use the semi-colon,
and it was mentioned in the documentation that <a class="reference internal" href="#poldef">\poldef</a>
will be confused by this and that inner semi-colons could be
set within braces <span class="docutils literal">{;}</span> as a work-around.  It was not clear from
this documentation that also <a class="reference internal" href="#id8">\PolDef</a> required
this work-around.  With this relase only <a class="reference internal" href="#poldef">\poldef</a> but
not <a class="reference internal" href="#id8">\PolDef</a> needs the work-around.</p></li>
</ul>
</li>
<li><p>track <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4e</span> changes relative to powers.</p></li>
</ul>
</li>
<li><p>v0.8.3 (2021/05/27)</p>
<ul class="simple">
<li><p>small internal update to track an <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4h</span> change
regarding handling of exceptions.  Will require this version at
least on loading.</p></li>
</ul>
</li>
<li><p>v0.8.4 (2021/11/01)</p>
<ul class="simple">
<li><p>bugfix: <a class="reference internal" href="#id17">\PolSturmIsolateZeros**{&lt;sturmname&gt;}</a> did not
declare the <span class="docutils literal">&lt;sturmname&gt;_norr</span> and <span class="docutils literal">&lt;sturmname&gt;_sqf_norr</span>
polynomials if original polynomial had no real root!</p></li>
</ul>
</li>
<li><p>v0.8.5 (2021/11/30)</p>
<ul class="simple">
<li><p>bugfix: support for the <span class="docutils literal">intfrom()</span> function was in the code,
but the declaration to the polynomial parser had not been done.</p></li>
<li><p>track (belatedly) upstream deprecation of <span class="docutils literal">\xintSignedFrac</span> and
<span class="docutils literal">\xintSignedFwOver</span> at <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> <span class="docutils literal">1.4g</span></p></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="acknowledgments">
<h1><a class="toc-backref" href="#id201">Acknowledgments</a></h1>
<p>Thanks to Jürgen Gilg whose question about <a class="reference external" href="http://www.ctan.org/pkg/xint">xintexpr</a> usage for
differentiating polynomials was the initial trigger leading to this
package, and to Jürgen Gilg and Thomas Söll for testing it on some
concrete problems.</p>
<p>Renewed thanks to them on occasion of the <span class="docutils literal">0.6</span>, <span class="docutils literal">0.7</span>, and <span class="docutils literal">0.8</span>
releases for their continued interest.</p>
<p>See README.md for the License.</p>
</div>
</div>
</body>
</html>