/usr/share/doc/maxima-doc/html/maxima_14.html is in maxima-doc 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima 5.32.1 Manual: 14. Polynomials</title>
<meta name="description" content="Maxima 5.32.1 Manual: 14. Polynomials">
<meta name="keywords" content="Maxima 5.32.1 Manual: 14. Polynomials">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
color: black;
background: white;
margin-left: 8%;
margin-right: 13%;
}
h1
{
margin-left: +8%;
font-size: 150%;
font-family: sans-serif
}
h2
{
font-size: 125%;
font-family: sans-serif
}
h3
{
font-size: 100%;
font-family: sans-serif
}
h2,h3,h4,h5,h6 { margin-left: +4%; }
div.textbox
{
border: solid;
border-width: thin;
/* width: 100%; */
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em
}
div.titlebox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(200,255,255);
font-family: sans-serif
}
div.synopsisbox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(255,220,255);
/*background: rgb(200,255,255); */
/* font-family: fixed */
}
pre.example
{
border: 1px solid gray;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 1em;
/* background: rgb(247,242,180); */ /* kind of sandy */
/* background: rgb(200,255,255); */ /* sky blue */
background-color: #F1F5F9; /* light blue-gray */
/* font-family: "Lucida Console", monospace */
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
div.categorybox
{
border: 1px solid gray;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,220);
}
-->
</style>
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Polynomials"></a>
<a name="SEC74"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_13.html#SEC73" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC75" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_13.html#SEC68" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_15.html#SEC77" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 14. Polynomials </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC75">14.1 Introduction to Polynomials</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC76">14.2 Functions and Variables for Polynomials</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Introduction-to-Polynomials"></a>
</p><hr size="6">
<a name="Introduction-to-Polynomials"></a>
<a name="SEC75"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC74" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC76" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_15.html#SEC77" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 14.1 Introduction to Polynomials </h2>
<p>Polynomials are stored in Maxima either in General Form or as
Canonical Rational Expressions (CRE) form. The latter is a standard
form, and is used internally by operations such as factor, ratsimp, and
so on.
</p>
<p>Canonical Rational Expressions constitute a kind of representation
which is especially suitable for expanded polynomials and rational
functions (as well as for partially factored polynomials and rational
functions when RATFAC is set to <code>true</code>). In this CRE form an
ordering of variables (from most to least main) is assumed for each
expression. Polynomials are represented recursively by a list
consisting of the main variable followed by a series of pairs of
expressions, one for each term of the polynomial. The first member of
each pair is the exponent of the main variable in that term and the
second member is the coefficient of that term which could be a number or
a polynomial in another variable again represented in this form. Thus
the principal part of the CRE form of 3*X^2-1 is (X 2 3 0 -1) and that
of 2*X*Y+X-3 is (Y 1 (X 1 2) 0 (X 1 1 0 -3)) assuming Y is the main
variable, and is (X 1 (Y 1 2 0 1) 0 -3) assuming X is the main
variable. "Main"-ness is usually determined by reverse alphabetical
order. The "variables" of a CRE expression needn't be atomic. In fact
any subexpression whose main operator is not + - * / or ^ with integer
power will be considered a "variable" of the expression (in CRE form) in
which it occurs. For example the CRE variables of the expression
X+SIN(X+1)+2*SQRT(X)+1 are X, SQRT(X), and SIN(X+1). If the user does
not specify an ordering of variables by using the RATVARS function
Maxima will choose an alphabetic one. In general, CRE's represent
rational expressions, that is, ratios of polynomials, where the
numerator and denominator have no common factors, and the denominator is
positive. The internal form is essentially a pair of polynomials (the
numerator and denominator) preceded by the variable ordering list. If
an expression to be displayed is in CRE form or if it contains any
subexpressions in CRE form, the symbol /R/ will follow the line label.
See the RAT function for converting an expression to CRE form. An
extended CRE form is used for the representation of Taylor series. The
notion of a rational expression is extended so that the exponents of the
variables can be positive or negative rational numbers rather than just
positive integers and the coefficients can themselves be rational
expressions as described above rather than just polynomials. These are
represented internally by a recursive polynomial form which is similar
to and is a generalization of CRE form, but carries additional
information such as the degree of truncation. As with CRE form, the
symbol /T/ follows the line label of such expressions.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p>
<p><a name="Item_003a-Functions-and-Variables-for-Polynomials"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-Polynomials"></a>
<a name="SEC76"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC75" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_15.html#SEC77" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC74" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_15.html#SEC77" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 14.2 Functions and Variables for Polynomials </h2>
<p><a name="algebraic"></a>
<a name="Item_003a-algebraic"></a>
</p><dl>
<dt><u>Option variable:</u> <b>algebraic</b>
<a name="IDX631"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>algebraic</code> must be set to <code>true</code> in order for the simplification of
algebraic integers to take effect.
</p>
<div class=categorybox>
·
<p>@ref{Category: Simplification flags and variables}
</div>
</p></dd></dl>
<p><a name="Item_003a-berlefact"></a>
</p><dl>
<dt><u>Option variable:</u> <b>berlefact</b>
<a name="IDX632"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>berlefact</code> is <code>false</code> then the Kronecker factoring
algorithm will be used otherwise the Berlekamp algorithm, which is the
default, will be used.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="bezout"></a>
<a name="Item_003a-bezout"></a>
</p><dl>
<dt><u>Function:</u> <b>bezout</b><i> (<var>p1</var>, <var>p2</var>, <var>x</var>)</i>
<a name="IDX633"></a>
</dt>
<dd><p>an alternative to the <code><a href="#resultant">resultant</a></code> command. It
returns a matrix. <code>determinant</code> of this matrix is the desired resultant.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) bezout(a*x+b, c*x^2+d, x);
[ b c - a d ]
(%o1) [ ]
[ a b ]
(%i2) determinant(%);
2 2
(%o2) a d + b c
(%i3) resultant(a*x+b, c*x^2+d, x);
2 2
(%o3) a d + b c
</pre><div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-bothcoef"></a>
</p><dl>
<dt><u>Function:</u> <b>bothcoef</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX634"></a>
</dt>
<dd><p>Returns a list whose first member is the coefficient of <var>x</var> in <var>expr</var>
(as found by <code>ratcoef</code> if <var>expr</var> is in CRE form
otherwise by <code>coeff</code>) and whose second member is the remaining part of
<var>expr</var>. That is, <code>[A, B]</code> where <code><var>expr</var> = A*<var>x</var> + B</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) islinear (expr, x) := block ([c],
c: bothcoef (rat (expr, x), x),
is (freeof (x, c) and c[1] # 0))$
(%i2) islinear ((r^2 - (x - r)^2)/x, x);
(%o2) true
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-coeff"></a>
</p><dl>
<dt><u>Function:</u> <b>coeff</b><i> (<var>expr</var>, <var>x</var>, <var>n</var>)</i>
<a name="IDX635"></a>
</dt>
<dt><u>Function:</u> <b>coeff</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX636"></a>
</dt>
<dd><p>Returns the coefficient of <code><var>x</var>^<var>n</var></code> in <var>expr</var>,
where <var>expr</var> is a polynomial or a monomial term in <var>x</var>.
</p>
<p><code>coeff(<var>expr</var>, <var>x</var>^<var>n</var>)</code> is equivalent
to <code>coeff(<var>expr</var>, <var>x</var>, <var>n</var>)</code>.
<code>coeff(<var>expr</var>, <var>x</var>, 0)</code> returns the remainder of <var>expr</var>
which is free of <var>x</var>.
If omitted, <var>n</var> is assumed to be 1.
</p>
<p><var>x</var> may be a simple variable or a subscripted variable,
or a subexpression of <var>expr</var> which
comprises an operator and all of its arguments.
</p>
<p>It may be possible to compute coefficients of expressions which are equivalent
to <var>expr</var> by applying <code>expand</code> or <code>factor</code>. <code>coeff</code> itself
does not apply <code>expand</code> or <code>factor</code> or any other function.
</p>
<p><code>coeff</code> distributes over lists, matrices, and equations.
</p>
<p>Examples:
</p>
<p><code>coeff</code> returns the coefficient <code><var>x</var>^<var>n</var></code> in <var>expr</var>.
</p>
<pre class="example">(%i1) coeff (b^3*a^3 + b^2*a^2 + b*a + 1, a^3);
3
(%o1) b
</pre>
<p><code>coeff(<var>expr</var>, <var>x</var>^<var>n</var>)</code> is equivalent
to <code>coeff(<var>expr</var>, <var>x</var>, <var>n</var>)</code>.
</p>
<pre class="example">(%i1) coeff (c[4]*z^4 - c[3]*z^3 - c[2]*z^2 + c[1]*z, z, 3);
(%o1) - c
3
(%i2) coeff (c[4]*z^4 - c[3]*z^3 - c[2]*z^2 + c[1]*z, z^3);
(%o2) - c
3
</pre>
<p><code>coeff(<var>expr</var>, <var>x</var>, 0)</code> returns the remainder of <var>expr</var>
which is free of <var>x</var>.
</p>
<pre class="example">(%i1) coeff (a*u + b^2*u^2 + c^3*u^3, b, 0);
3 3
(%o1) c u + a u
</pre>
<p><var>x</var> may be a simple variable or a subscripted variable,
or a subexpression of <var>expr</var> which
comprises an operator and all of its arguments.
</p>
<pre class="example">(%i1) coeff (h^4 - 2*%pi*h^2 + 1, h, 2);
(%o1) - 2 %pi
(%i2) coeff (v[1]^4 - 2*%pi*v[1]^2 + 1, v[1], 2);
(%o2) - 2 %pi
(%i3) coeff (sin(1+x)*sin(x) + sin(1+x)^3*sin(x)^3, sin(1+x)^3);
3
(%o3) sin (x)
(%i4) coeff ((d - a)^2*(b + c)^3 + (a + b)^4*(c - d), a + b, 4);
(%o4) c - d
</pre>
<p><code>coeff</code> itself does not apply <code>expand</code> or <code>factor</code> or any other
function.
</p>
<pre class="example">(%i1) coeff (c*(a + b)^3, a);
(%o1) 0
(%i2) expand (c*(a + b)^3);
3 2 2 3
(%o2) b c + 3 a b c + 3 a b c + a c
(%i3) coeff (%, a);
2
(%o3) 3 b c
(%i4) coeff (b^3*c + 3*a*b^2*c + 3*a^2*b*c + a^3*c, (a + b)^3);
(%o4) 0
(%i5) factor (b^3*c + 3*a*b^2*c + 3*a^2*b*c + a^3*c);
3
(%o5) (b + a) c
(%i6) coeff (%, (a + b)^3);
(%o6) c
</pre>
<p><code>coeff</code> distributes over lists, matrices, and equations.
</p>
<pre class="example">(%i1) coeff ([4*a, -3*a, 2*a], a);
(%o1) [4, - 3, 2]
(%i2) coeff (matrix ([a*x, b*x], [-c*x, -d*x]), x);
[ a b ]
(%o2) [ ]
[ - c - d ]
(%i3) coeff (a*u - b*v = 7*u + 3*v, u);
(%o3) a = 7
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-content"></a>
</p><dl>
<dt><u>Function:</u> <b>content</b><i> (<var>p_1</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX637"></a>
</dt>
<dd><p>Returns a list whose first element is
the greatest common divisor of the coefficients of the terms of the
polynomial <var>p_1</var> in the variable <var>x_n</var> (this is the content) and whose
second element is the polynomial <var>p_1</var> divided by the content.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) content (2*x*y + 4*x^2*y^2, y);
2
(%o1) [2 x, 2 x y + y]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-denom"></a>
</p><dl>
<dt><u>Function:</u> <b>denom</b><i> (<var>expr</var>)</i>
<a name="IDX638"></a>
</dt>
<dd><p>Returns the denominator of the rational expression <var>expr</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-divide"></a>
</p><dl>
<dt><u>Function:</u> <b>divide</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX639"></a>
</dt>
<dd><p>computes the quotient and remainder
of the polynomial <var>p_1</var> divided by the polynomial <var>p_2</var>, in a main
polynomial variable, <var>x_n</var>.
The other variables are as in the <code>ratvars</code> function.
The result is a list whose first element is the quotient
and whose second element is the remainder.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) divide (x + y, x - y, x);
(%o1) [1, 2 y]
(%i2) divide (x + y, x - y);
(%o2) [- 1, 2 x]
</pre>
<p>Note that <code>y</code> is the main variable in the second example.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-eliminate"></a>
</p><dl>
<dt><u>Function:</u> <b>eliminate</b><i> ([<var>eqn_1</var>, …, <var>eqn_n</var>], [<var>x_1</var>, …, <var>x_k</var>])</i>
<a name="IDX640"></a>
</dt>
<dd><p>Eliminates variables from equations (or expressions assumed equal to zero) by
taking successive resultants. This returns a list of <code><var>n</var> - <var>k</var></code>
expressions with the <var>k</var> variables <var>x_1</var>, …, <var>x_k</var> eliminated.
First <var>x_1</var> is eliminated yielding <code><var>n</var> - 1</code> expressions, then
<code>x_2</code> is eliminated, etc. If <code><var>k</var> = <var>n</var></code> then a single
expression in a list is returned free of the variables <var>x_1</var>, …,
<var>x_k</var>. In this case <code>solve</code> is called to solve the last resultant for
the last variable.
</p>
<p>Example:
</p>
<pre class="example">(%i1) expr1: 2*x^2 + y*x + z;
2
(%o1) z + x y + 2 x
(%i2) expr2: 3*x + 5*y - z - 1;
(%o2) - z + 5 y + 3 x - 1
(%i3) expr3: z^2 + x - y^2 + 5;
2 2
(%o3) z - y + x + 5
(%i4) eliminate ([expr3, expr2, expr1], [y, z]);
8 7 6 5 4
(%o4) [7425 x - 1170 x + 1299 x + 12076 x + 22887 x
3 2
- 5154 x - 1291 x + 7688 x + 15376]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="ezgcd"></a>
<a name="Item_003a-ezgcd"></a>
</p><dl>
<dt><u>Function:</u> <b>ezgcd</b><i> (<var>p_1</var>, <var>p_2</var>, <var>p_3</var>, …)</i>
<a name="IDX641"></a>
</dt>
<dd><p>Returns a list whose first element is the greatest common divisor of the
polynomials <var>p_1</var>, <var>p_2</var>, <var>p_3</var>, … and whose remaining
elements are the polynomials divided by the greatest common divisor. This
always uses the <code>ezgcd</code> algorithm.
</p>
<p>See also <code><a href="#gcd">gcd</a></code>, <code><a href="#gcdex">gcdex</a></code>, <code><a href="maxima_73.html#gcdivide">gcdivide</a></code>, and
<code><a href="maxima_57.html#poly_005fgcd">poly_gcd</a></code>.
</p>
<p>Examples:
</p>
<p>The three polynomials have the greatest common divisor <code>2*x-3</code>. The
gcd is first calculated with the function <code>gcd</code> and then with the function
<code>ezgcd</code>.
</p>
<pre class="example">(%i1) p1 : 6*x^3-17*x^2+14*x-3;
3 2
(%o1) 6 x - 17 x + 14 x - 3
(%i2) p2 : 4*x^4-14*x^3+12*x^2+2*x-3;
4 3 2
(%o2) 4 x - 14 x + 12 x + 2 x - 3
(%i3) p3 : -8*x^3+14*x^2-x-3;
3 2
(%o3) - 8 x + 14 x - x - 3
(%i4) gcd(p1, gcd(p2, p3));
(%o4) 2 x - 3
(%i5) ezgcd(p1, p2, p3);
2 3 2 2
(%o5) [2 x - 3, 3 x - 4 x + 1, 2 x - 4 x + 1, - 4 x + x + 1]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-facexpand"></a>
</p><dl>
<dt><u>Option variable:</u> <b>facexpand</b>
<a name="IDX642"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p><code>facexpand</code> controls whether the irreducible factors returned by
<code>factor</code> are in expanded (the default) or recursive (normal CRE) form.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="factor"></a>
<a name="Item_003a-factor"></a>
</p><dl>
<dt><u>Function:</u> <b>factor</b><i> (<var>expr</var>)</i>
<a name="IDX643"></a>
</dt>
<dt><u>Function:</u> <b>factor</b><i> (<var>expr</var>, <var>p</var>)</i>
<a name="IDX644"></a>
</dt>
<dd><p>Factors the expression <var>expr</var>, containing any number of variables or
functions, into factors irreducible over the integers.
<code>factor (<var>expr</var>, <var>p</var>)</code> factors <var>expr</var> over the field of
rationals with an element adjoined whose minimum polynomial is <var>p</var>.
</p>
<p><code>factor</code> uses <code>ifactors</code> function for factoring integers.
</p>
<p><code>factorflag</code> if <code>false</code> suppresses the factoring of integer factors
of rational expressions.
</p>
<p><code>dontfactor</code> may be set to a list of variables with respect to which
factoring is not to occur. (It is initially empty). Factoring also
will not take place with respect to any variables which are less
important (using the variable ordering assumed for CRE form) than
those on the <code>dontfactor</code> list.
</p>
<p><code>savefactors</code> if <code>true</code> causes the factors of an expression which
is a product of factors to be saved by certain functions in order to
speed up later factorizations of expressions containing some of the
same factors.
</p>
<p><code>berlefact</code> if <code>false</code> then the Kronecker factoring algorithm will
be used otherwise the Berlekamp algorithm, which is the default, will
be used.
</p>
<p><code>intfaclim</code> if <code>true</code> maxima will give up factorization of
integers if no factor is found after trial divisions and Pollard's rho
method. If set to <code>false</code> (this is the case when the user calls
<code>factor</code> explicitly), complete factorization of the integer will be
attempted. The user's setting of <code>intfaclim</code> is used for internal
calls to <code>factor</code>. Thus, <code>intfaclim</code> may be reset to prevent
Maxima from taking an inordinately long time factoring large integers.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) factor (2^63 - 1);
2
(%o1) 7 73 127 337 92737 649657
(%i2) factor (-8*y - 4*x + z^2*(2*y + x));
(%o2) (2 y + x) (z - 2) (z + 2)
(%i3) -1 - 2*x - x^2 + y^2 + 2*x*y^2 + x^2*y^2;
2 2 2 2 2
(%o3) x y + 2 x y + y - x - 2 x - 1
(%i4) block ([dontfactor: [x]], factor (%/36/(1 + 2*y + y^2)));
2
(x + 2 x + 1) (y - 1)
(%o4) ----------------------
36 (y + 1)
(%i5) factor (1 + %e^(3*x));
x 2 x x
(%o5) (%e + 1) (%e - %e + 1)
(%i6) factor (1 + x^4, a^2 - 2);
2 2
(%o6) (x - a x + 1) (x + a x + 1)
(%i7) factor (-y^2*z^2 - x*z^2 + x^2*y^2 + x^3);
2
(%o7) - (y + x) (z - x) (z + x)
(%i8) (2 + x)/(3 + x)/(b + x)/(c + x)^2;
x + 2
(%o8) ------------------------
2
(x + 3) (x + b) (x + c)
(%i9) ratsimp (%);
4 3
(%o9) (x + 2)/(x + (2 c + b + 3) x
2 2 2 2
+ (c + (2 b + 6) c + 3 b) x + ((b + 3) c + 6 b c) x + 3 b c )
(%i10) partfrac (%, x);
2 4 3
(%o10) - (c - 4 c - b + 6)/((c + (- 2 b - 6) c
2 2 2 2
+ (b + 12 b + 9) c + (- 6 b - 18 b) c + 9 b ) (x + c))
c - 2
- ---------------------------------
2 2
(c + (- b - 3) c + 3 b) (x + c)
b - 2
+ -------------------------------------------------
2 2 3 2
((b - 3) c + (6 b - 2 b ) c + b - 3 b ) (x + b)
1
- ----------------------------------------------
2
((b - 3) c + (18 - 6 b) c + 9 b - 27) (x + 3)
(%i11) map ('factor, %);
2
c - 4 c - b + 6 c - 2
(%o11) - ------------------------- - ------------------------
2 2 2
(c - 3) (c - b) (x + c) (c - 3) (c - b) (x + c)
b - 2 1
+ ------------------------ - ------------------------
2 2
(b - 3) (c - b) (x + b) (b - 3) (c - 3) (x + 3)
(%i12) ratsimp ((x^5 - 1)/(x - 1));
4 3 2
(%o12) x + x + x + x + 1
(%i13) subst (a, x, %);
4 3 2
(%o13) a + a + a + a + 1
(%i14) factor (%th(2), %);
2 3 3 2
(%o14) (x - a) (x - a ) (x - a ) (x + a + a + a + 1)
(%i15) factor (1 + x^12);
4 8 4
(%o15) (x + 1) (x - x + 1)
(%i16) factor (1 + x^99);
2 6 3
(%o16) (x + 1) (x - x + 1) (x - x + 1)
10 9 8 7 6 5 4 3 2
(x - x + x - x + x - x + x - x + x - x + 1)
20 19 17 16 14 13 11 10 9 7 6
(x + x - x - x + x + x - x - x - x + x + x
4 3 60 57 51 48 42 39 33
- x - x + x + 1) (x + x - x - x + x + x - x
30 27 21 18 12 9 3
- x - x + x + x - x - x + x + 1)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-factorflag"></a>
</p><dl>
<dt><u>Option variable:</u> <b>factorflag</b>
<a name="IDX645"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>factorflag</code> is <code>false</code>, suppresses the factoring of
integer factors of rational expressions.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-factorout"></a>
</p><dl>
<dt><u>Function:</u> <b>factorout</b><i> (<var>expr</var>, <var>x_1</var>, <var>x_2</var>, …)</i>
<a name="IDX646"></a>
</dt>
<dd><p>Rearranges the sum <var>expr</var> into a sum of terms of the form
<code>f (<var>x_1</var>, <var>x_2</var>, …)*g</code> where <code>g</code> is a product of
expressions not containing any <var>x_i</var> and <code>f</code> is factored.
</p>
<p>Note that the option variable <code>keepfloat</code> is ignored by <code>factorout</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) expand (a*(x+1)*(x-1)*(u+1)^2);
2 2 2 2 2
(%o1) a u x + 2 a u x + a x - a u - 2 a u - a
(%i2) factorout(%,x);
2
(%o2) a u (x - 1) (x + 1) + 2 a u (x - 1) (x + 1)
+ a (x - 1) (x + 1)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-factorsum"></a>
</p><dl>
<dt><u>Function:</u> <b>factorsum</b><i> (<var>expr</var>)</i>
<a name="IDX647"></a>
</dt>
<dd><p>Tries to group terms in factors of <var>expr</var> which are sums into groups of
terms such that their sum is factorable. <code>factorsum</code> can recover the
result of <code>expand ((x + y)^2 + (z + w)^2)</code> but it can't recover
<code>expand ((x + 1)^2 + (x + y)^2)</code> because the terms have variables in
common.
</p>
<p>Example:
</p>
<pre class="example">(%i1) expand ((x + 1)*((u + v)^2 + a*(w + z)^2));
2 2 2 2
(%o1) a x z + a z + 2 a w x z + 2 a w z + a w x + v x
2 2 2 2
+ 2 u v x + u x + a w + v + 2 u v + u
(%i2) factorsum (%);
2 2
(%o2) (x + 1) (a (z + w) + (v + u) )
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-fasttimes"></a>
</p><dl>
<dt><u>Function:</u> <b>fasttimes</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX648"></a>
</dt>
<dd><p>Returns the product of the polynomials <var>p_1</var> and <var>p_2</var> by using a
special algorithm for multiplication of polynomials. <code>p_1</code> and <code>p_2</code>
should be multivariate, dense, and nearly the same size. Classical
multiplication is of order <code>n_1 n_2</code> where
<code>n_1</code> is the degree of <code>p_1</code>
and <code>n_2</code> is the degree of <code>p_2</code>.
<code>fasttimes</code> is of order <code>max (n_1, n_2)^1.585</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-fullratsimp"></a>
</p><dl>
<dt><u>Function:</u> <b>fullratsimp</b><i> (<var>expr</var>)</i>
<a name="IDX649"></a>
</dt>
<dd><p><code>fullratsimp</code> repeatedly
applies <code>ratsimp</code> followed by non-rational simplification to an
expression until no further change occurs,
and returns the result.
</p>
<p>When non-rational expressions are involved, one call
to <code>ratsimp</code> followed as is usual by non-rational ("general")
simplification may not be sufficient to return a simplified result.
Sometimes, more than one such call may be necessary.
<code>fullratsimp</code> makes this process convenient.
</p>
<p><code>fullratsimp (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</code> takes one or more
arguments similar to <code>ratsimp</code> and <code>rat</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) expr: (x^(a/2) + 1)^2*(x^(a/2) - 1)^2/(x^a - 1);
a/2 2 a/2 2
(x - 1) (x + 1)
(%o1) -----------------------
a
x - 1
(%i2) ratsimp (expr);
2 a a
x - 2 x + 1
(%o2) ---------------
a
x - 1
(%i3) fullratsimp (expr);
a
(%o3) x - 1
(%i4) rat (expr);
a/2 4 a/2 2
(x ) - 2 (x ) + 1
(%o4)/R/ -----------------------
a
x - 1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Simplification functions} ·
@ref{Category: Rational expressions}
<div class=categorybox>
</p></dd></dl>
<p><a name="Item_003a-fullratsubst"></a>
</p><dl>
<dt><u>Function:</u> <b>fullratsubst</b><i> (<var>a</var>, <var>b</var>, <var>c</var>)</i>
<a name="IDX650"></a>
</dt>
<dd><p>is the same as <code>ratsubst</code> except that it calls
itself recursively on its result until that result stops changing.
This function is useful when the replacement expression and the
replaced expression have one or more variables in common.
</p>
<p><code>fullratsubst</code> will also accept its arguments in the format of
<code>lratsubst</code>. That is, the first argument may be a single substitution
equation or a list of such equations, while the second argument is the
expression being processed.
</p>
<p><code>load ("lrats")</code> loads <code>fullratsubst</code> and <code>lratsubst</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) load ("lrats")$
</pre><ul>
<li>
<code>subst</code> can carry out multiple substitutions.
<code>lratsubst</code> is analogous to <code>subst</code>.
</li></ul>
<pre class="example">(%i2) subst ([a = b, c = d], a + c);
(%o2) d + b
(%i3) lratsubst ([a^2 = b, c^2 = d], (a + e)*c*(a + c));
(%o3) (d + a c) e + a d + b c
</pre><ul>
<li>
If only one substitution is desired, then a single
equation may be given as first argument.
</li></ul>
<pre class="example">(%i4) lratsubst (a^2 = b, a^3);
(%o4) a b
</pre><ul>
<li>
<code>fullratsubst</code> is equivalent to <code>ratsubst</code>
except that it recurses until its result stops changing.
</li></ul>
<pre class="example">(%i5) ratsubst (b*a, a^2, a^3);
2
(%o5) a b
(%i6) fullratsubst (b*a, a^2, a^3);
2
(%o6) a b
</pre><ul>
<li>
<code>fullratsubst</code> also accepts a list of equations or a single
equation as first argument.
</li></ul>
<pre class="example">(%i7) fullratsubst ([a^2 = b, b^2 = c, c^2 = a], a^3*b*c);
(%o7) b
(%i8) fullratsubst (a^2 = b*a, a^3);
2
(%o8) a b
</pre><ul>
<li>
<code>fullratsubst</code> may cause an indefinite recursion.
</li></ul>
<pre class="example">(%i9) errcatch (fullratsubst (b*a^2, a^2, a^3));
*** - Lisp stack overflow. RESET
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="gcd"></a>
<a name="Item_003a-gcd"></a>
</p><dl>
<dt><u>Function:</u> <b>gcd</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, …)</i>
<a name="IDX651"></a>
</dt>
<dd><p>Returns the greatest common divisor of <var>p_1</var> and <var>p_2</var>. The flag
<code>gcd</code> determines which algorithm is employed. Setting <code>gcd</code> to
<code>ez</code>, <code>subres</code>, <code>red</code>, or <code>spmod</code> selects the <code>ezgcd</code>,
subresultant <code>prs</code>, reduced, or modular algorithm, respectively. If
<code>gcd</code> <code>false</code> then <code>gcd (<var>p_1</var>, <var>p_2</var>, <var>x</var>)</code> always
returns 1 for all <var>x</var>. Many functions (e.g. <code><a href="#ratsimp">ratsimp</a></code>,
<code><a href="#factor">factor</a></code>, etc.) cause gcd's to be taken implicitly. For homogeneous
polynomials it is recommended that <code>gcd</code> equal to <code>subres</code> be used.
To take the gcd when an algebraic is present, e.g.,
<code>gcd (<var>x</var>^2 - 2*sqrt(2)* <var>x</var> + 2, <var>x</var> - sqrt(2))</code>, the option
variable <code><a href="#algebraic">algebraic</a></code> must be <code>true</code> and <code>gcd</code> must not be
<code>ez</code>.
</p>
<p>The <code>gcd</code> flag, default: <code>spmod</code>, if <code>false</code> will also prevent
the greatest common divisor from being taken when expressions are converted to
canonical rational expression (CRE) form. This will sometimes speed the
calculation if gcds are not required.
</p>
<p>See also <code><a href="#ezgcd">ezgcd</a></code>, <code><a href="#gcdex">gcdex</a></code>, <code><a href="maxima_73.html#gcdivide">gcdivide</a></code>, and
<code><a href="maxima_57.html#poly_005fgcd">poly_gcd</a></code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) p1:6*x^3+19*x^2+19*x+6;
3 2
(%o1) 6 x + 19 x + 19 x + 6
(%i2) p2:6*x^5+13*x^4+12*x^3+13*x^2+6*x;
5 4 3 2
(%o2) 6 x + 13 x + 12 x + 13 x + 6 x
(%i3) gcd(p1, p2);
2
(%o3) 6 x + 13 x + 6
(%i4) p1/gcd(p1, p2), ratsimp;
(%o4) x + 1
(%i5) p2/gcd(p1, p2), ratsimp;
3
(%o5) x + x
</pre>
<p><code><a href="#ezgcd">ezgcd</a></code> returns a list whose first element is the greatest common divisor
of the polynomials <var>p_1</var> and <var>p_2</var>, and whose remaining elements are
the polynomials divided by the greatest common divisor.
</p>
<pre class="example">(%i6) ezgcd(p1, p2);
2 3
(%o6) [6 x + 13 x + 6, x + 1, x + x]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="gcdex"></a>
<a name="Item_003a-gcdex"></a>
</p><dl>
<dt><u>Function:</u> <b>gcdex</b><i> (<var>f</var>, <var>g</var>)</i>
<a name="IDX652"></a>
</dt>
<dt><u>Function:</u> <b>gcdex</b><i> (<var>f</var>, <var>g</var>, <var>x</var>)</i>
<a name="IDX653"></a>
</dt>
<dd><p>Returns a list <code>[<var>a</var>, <var>b</var>, <var>u</var>]</code> where <var>u</var> is the greatest
common divisor (gcd) of <var>f</var> and <var>g</var>, and <var>u</var> is equal to
<code><var>a</var> <var>f</var> + <var>b</var> <var>g</var></code>. The arguments <var>f</var> and <var>g</var>
should be univariate polynomials, or else polynomials in <var>x</var> a supplied
main variable since we need to be in a principal ideal domain for this to
work. The gcd means the gcd regarding <var>f</var> and <var>g</var> as univariate
polynomials with coefficients being rational functions in the other variables.
</p>
<p><code>gcdex</code> implements the Euclidean algorithm, where we have a sequence of
<code>L[i]: [a[i], b[i], r[i]]</code> which are all perpendicular to <code>[f, g, -1]</code>
and the next one is built as if <code>q = quotient(r[i]/r[i+1])</code> then
<code>L[i+2]: L[i] - q L[i+1]</code>, and it terminates at <code>L[i+1]</code> when the
remainder <code>r[i+2]</code> is zero.
</p>
<p>The arguments <var>f</var> and <var>g</var> can be integers. For this case the function
<code><a href="maxima_29.html#igcdex">igcdex</a></code> is called by <code>gcdex</code>.
</p>
<p>See also <code><a href="#ezgcd">ezgcd</a></code>, <code><a href="#gcd">gcd</a></code>, <code><a href="maxima_73.html#gcdivide">gcdivide</a></code>, and
<code><a href="maxima_57.html#poly_005fgcd">poly_gcd</a></code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) gcdex (x^2 + 1, x^3 + 4);
2
x + 4 x - 1 x + 4
(%o1)/R/ [- ------------, -----, 1]
17 17
(%i2) % . [x^2 + 1, x^3 + 4, -1];
(%o2)/R/ 0
</pre>
<p>Note that the gcd in the following is <code>1</code> since we work in <code>k(y)[x]</code>,
not the <code>y+1</code> we would expect in <code>k[y, x]</code>.
</p>
<pre class="example">(%i1) gcdex (x*(y + 1), y^2 - 1, x);
1
(%o1)/R/ [0, ------, 1]
2
y - 1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-gcfactor"></a>
</p><dl>
<dt><u>Function:</u> <b>gcfactor</b><i> (<var>n</var>)</i>
<a name="IDX654"></a>
</dt>
<dd><p>Factors the Gaussian integer <var>n</var> over the Gaussian integers, i.e., numbers
of the form <code><var>a</var> + <var>b</var> <code>%i</code></code> where <var>a</var> and <var>b</var> are
rational integers (i.e., ordinary integers). Factors are normalized by making
<var>a</var> and <var>b</var> non-negative.
</p>
<div class=categorybox>
·
<p>@ref{Category: Integers}
</div>
</p></dd></dl>
<p><a name="Item_003a-gfactor"></a>
</p><dl>
<dt><u>Function:</u> <b>gfactor</b><i> (<var>expr</var>)</i>
<a name="IDX655"></a>
</dt>
<dd><p>Factors the polynomial <var>expr</var> over the Gaussian integers
(that is, the integers with the imaginary unit <code>%i</code> adjoined).
This is like <code>factor (<var>expr</var>, <var>a</var>^2+1)</code> where <var>a</var> is <code>%i</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) gfactor (x^4 - 1);
(%o1) (x - 1) (x + 1) (x - %i) (x + %i)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-gfactorsum"></a>
</p><dl>
<dt><u>Function:</u> <b>gfactorsum</b><i> (<var>expr</var>)</i>
<a name="IDX656"></a>
</dt>
<dd><p>is similar to <code>factorsum</code> but applies <code>gfactor</code> instead
of <code>factor</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-hipow"></a>
</p><dl>
<dt><u>Function:</u> <b>hipow</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX657"></a>
</dt>
<dd><p>Returns the highest explicit exponent of <var>x</var> in <var>expr</var>.
<var>x</var> may be a variable or a general expression.
If <var>x</var> does not appear in <var>expr</var>,
<code>hipow</code> returns <code>0</code>.
</p>
<p><code>hipow</code> does not consider expressions equivalent to <code>expr</code>. In
particular, <code>hipow</code> does not expand <code>expr</code>, so
<code>hipow (<var>expr</var>, <var>x</var>)</code> and
<code>hipow (expand (<var>expr</var>, <var>x</var>))</code> may yield different results.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) hipow (y^3 * x^2 + x * y^4, x);
(%o1) 2
(%i2) hipow ((x + y)^5, x);
(%o2) 1
(%i3) hipow (expand ((x + y)^5), x);
(%o3) 5
(%i4) hipow ((x + y)^5, x + y);
(%o4) 5
(%i5) hipow (expand ((x + y)^5), x + y);
(%o5) 0
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-intfaclim"></a>
</p><dl>
<dt><u>Option variable:</u> <b>intfaclim</b>
<a name="IDX658"></a>
</dt>
<dd><p>Default value: true
</p>
<p>If <code>true</code>, maxima will give up factorization of
integers if no factor is found after trial divisions and Pollard's rho
method and factorization will not be complete.
</p>
<p>When <code>intfaclim</code> is <code>false</code> (this is the case when the user
calls <code>factor</code> explicitly), complete factorization will be
attempted. <code>intfaclim</code> is set to <code>false</code> when factors are
computed in <code>divisors</code>, <code>divsum</code> and <code>totient</code>.
</p>
<p>Internal calls to <code>factor</code> respect the user-specified value of
<code>intfaclim</code>. Setting <code>intfaclim</code> to <code>true</code> may reduce
the time spent factoring large integers.
</p>
<div class=categorybox>
·
<p>@ref{Category: Integers}
</div>
</p></dd></dl>
<p><a name="Item_003a-keepfloat"></a>
</p><dl>
<dt><u>Option variable:</u> <b>keepfloat</b>
<a name="IDX659"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>keepfloat</code> is <code>true</code>, prevents floating
point numbers from being rationalized when expressions which contain
them are converted to canonical rational expression (CRE) form.
</p>
<p>Note that the function <code>solve</code> and those functions calling it
(<code>eigenvalues</code>, for example) currently ignore this flag, converting
floating point numbers anyway.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) rat(x/2.0);
`rat' replaced 0.5 by 1/2 = 0.5
x
(%o1)/R/ -
2
(%i2) rat(x/2.0), keepfloat;
(%o2)/R/ 0.5 x
</pre>
<p><code>solve</code> ignores <code>keepfloat</code>:
</p>
<pre class="example">(%i3) solve(1.0-x,x), keepfloat;
`rat' replaced 1.0 by 1/1 = 1.0
(%o3) [x = 1]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Numerical evaluation}
</div>
</p></dd></dl>
<p><a name="lowpow"></a>
<a name="Item_003a-lopow"></a>
</p><dl>
<dt><u>Function:</u> <b>lopow</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX660"></a>
</dt>
<dd><p>Returns the lowest exponent of <var>x</var> which explicitly appears in
<var>expr</var>. Thus
</p>
<pre class="example">(%i1) lopow ((x+y)^2 + (x+y)^a, x+y);
(%o1) min(a, 2)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-lratsubst"></a>
</p><dl>
<dt><u>Function:</u> <b>lratsubst</b><i> (<var>L</var>, <var>expr</var>)</i>
<a name="IDX661"></a>
</dt>
<dd><p>is analogous to <code>subst (<var>L</var>, <var>expr</var>)</code>
except that it uses <code>ratsubst</code> instead of <code>subst</code>.
</p>
<p>The first argument of
<code>lratsubst</code> is an equation or a list of equations identical in
format to that accepted by <code>subst</code>. The
substitutions are made in the order given by the list of equations,
that is, from left to right.
</p>
<p><code>load ("lrats")</code> loads <code>fullratsubst</code> and <code>lratsubst</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) load ("lrats")$
</pre><ul>
<li>
<code>subst</code> can carry out multiple substitutions.
<code>lratsubst</code> is analogous to <code>subst</code>.
</li></ul>
<pre class="example">(%i2) subst ([a = b, c = d], a + c);
(%o2) d + b
(%i3) lratsubst ([a^2 = b, c^2 = d], (a + e)*c*(a + c));
(%o3) (d + a c) e + a d + b c
</pre><ul>
<li>
If only one substitution is desired, then a single
equation may be given as first argument.
</li></ul>
<pre class="example">(%i4) lratsubst (a^2 = b, a^3);
(%o4) a b
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="modulus"></a>
<a name="Item_003a-modulus"></a>
</p><dl>
<dt><u>Option variable:</u> <b>modulus</b>
<a name="IDX662"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>modulus</code> is a positive number <var>p</var>, operations on rational numbers
(as returned by <code>rat</code> and related functions) are carried out modulo
<var>p</var>, using the so-called "balanced" modulus system in which <code><var>n</var>
modulo <var>p</var></code> is defined as an integer <var>k</var> in
<code>[-(<var>p</var>-1)/2, ..., 0, ..., (<var>p</var>-1)/2]</code> when <var>p</var> is odd, or
<code>[-(<var>p</var>/2 - 1), ..., 0, ...., <var>p</var>/2]</code> when <var>p</var> is even, such
that <code><var>a</var> <var>p</var> + <var>k</var></code> equals <var>n</var> for some integer <var>a</var>.
</p>
<p>If <var>expr</var> is already in canonical rational expression (CRE) form when
<code>modulus</code> is reset, then you may need to re-rat <var>expr</var>, e.g.,
<code>expr: rat (ratdisrep (expr))</code>, in order to get correct results.
</p>
<p>Typically <code>modulus</code> is set to a prime number. If <code>modulus</code> is set to
a positive non-prime integer, this setting is accepted, but a warning message is
displayed. Maxima signals an error, when zero or a negative integer is
assigned to <code>modulus</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) modulus:7;
(%o1) 7
(%i2) polymod([0,1,2,3,4,5,6,7]);
(%o2) [0, 1, 2, 3, - 3, - 2, - 1, 0]
(%i3) modulus:false;
(%o3) false
(%i4) poly:x^6+x^2+1;
6 2
(%o4) x + x + 1
(%i5) factor(poly);
6 2
(%o5) x + x + 1
(%i6) modulus:13;
(%o6) 13
(%i7) factor(poly);
2 4 2
(%o7) (x + 6) (x - 6 x - 2)
(%i8) polymod(%);
6 2
(%o8) x + x + 1
</pre><div class=categorybox>
·
<p>@ref{Category: Integers}
</div>
</p></dd></dl>
<p><a name="Item_003a-num"></a>
</p><dl>
<dt><u>Function:</u> <b>num</b><i> (<var>expr</var>)</i>
<a name="IDX663"></a>
</dt>
<dd><p>Returns the numerator of <var>expr</var> if it is a ratio.
If <var>expr</var> is not a ratio, <var>expr</var> is returned.
</p>
<p><code>num</code> evaluates its argument.
</p>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="polydecomp"></a>
<a name="Item_003a-polydecomp"></a>
</p><dl>
<dt><u>Function:</u> <b>polydecomp</b><i> (<var>p</var>, <var>x</var>)</i>
<a name="IDX664"></a>
</dt>
<dd><p>Decomposes the polynomial <var>p</var> in the variable <var>x</var>
into the functional composition of polynomials in <var>x</var>.
<code>polydecomp</code> returns a list <code>[<var>p_1</var>, ..., <var>p_n</var>]</code> such that
</p>
<pre class="example">lambda ([x], p_1) (lambda ([x], p_2) (... (lambda ([x], p_n) (x))
...))
</pre>
<p>is equal to <var>p</var>.
The degree of <var>p_i</var> is greater than 1 for <var>i</var> less than <var>n</var>.
</p>
<p>Such a decomposition is not unique.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) polydecomp (x^210, x);
7 5 3 2
(%o1) [x , x , x , x ]
(%i2) p : expand (subst (x^3 - x - 1, x, x^2 - a));
6 4 3 2
(%o2) x - 2 x - 2 x + x + 2 x - a + 1
(%i3) polydecomp (p, x);
2 3
(%o3) [x - a, x - x - 1]
</pre>
<p>The following function composes <code>L = [e_1, ..., e_n]</code> as functions in
<code>x</code>; it is the inverse of polydecomp:
</p>
<pre class="example">compose (L, x) :=
block ([r : x], for e in L do r : subst (e, x, r), r) $
</pre>
<p>Re-express above example using <code>compose</code>:
</p>
<pre class="example">(%i3) polydecomp (compose ([x^2 - a, x^3 - x - 1], x), x);
2 3
(%o3) [x - a, x - x - 1]
</pre>
<p>Note that though <code>compose (polydecomp (<var>p</var>, <var>x</var>), <var>x</var>)</code> always
returns <var>p</var> (unexpanded), <code>polydecomp (compose ([<var>p_1</var>, ...,
<var>p_n</var>], <var>x</var>), <var>x</var>)</code> does <i>not</i> necessarily return
<code>[<var>p_1</var>, ..., <var>p_n</var>]</code>:
</p>
<pre class="example">(%i4) polydecomp (compose ([x^2 + 2*x + 3, x^2], x), x);
2 2
(%o4) [x + 2, x + 1]
(%i5) polydecomp (compose ([x^2 + x + 1, x^2 + x + 1], x), x);
2 2
x + 3 x + 5
(%o5) [------, ------, 2 x + 1]
4 2
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="polymod"></a>
<a name="Item_003a-polymod"></a>
</p><dl>
<dt><u>Function:</u> <b>polymod</b><i> (<var>p</var>)</i>
<a name="IDX665"></a>
</dt>
<dt><u>Function:</u> <b>polymod</b><i> (<var>p</var>, <var>m</var>)</i>
<a name="IDX666"></a>
</dt>
<dd><p>Converts the polynomial <var>p</var> to a modular representation with respect to the
current modulus which is the value of the variable <code>modulus</code>.
</p>
<p><code>polymod (<var>p</var>, <var>m</var>)</code> specifies a modulus <var>m</var> to be used
instead of the current value of <code>modulus</code>.
</p>
<p>See <code><a href="#modulus">modulus</a></code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="quotient"></a>
<a name="Item_003a-quotient"></a>
</p><dl>
<dt><u>Function:</u> <b>quotient</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX667"></a>
</dt>
<dt><u>Function:</u> <b>quotient</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX668"></a>
</dt>
<dd><p>Returns the polynomial <var>p_1</var> divided by the polynomial <var>p_2</var>. The
arguments <var>x_1</var>, …, <var>x_n</var> are interpreted as in <code>ratvars</code>.
</p>
<p><code>quotient</code> returns the first element of the two-element list returned by
<code>divide</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-rat"></a>
</p><dl>
<dt><u>Function:</u> <b>rat</b><i> (<var>expr</var>)</i>
<a name="IDX669"></a>
</dt>
<dt><u>Function:</u> <b>rat</b><i> (<var>expr</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX670"></a>
</dt>
<dd><p>Converts <var>expr</var> to canonical rational expression (CRE) form by expanding and
combining all terms over a common denominator and cancelling out the
greatest common divisor of the numerator and denominator, as well as
converting floating point numbers to rational numbers within a
tolerance of <code>ratepsilon</code>.
The variables are ordered according
to the <var>x_1</var>, …, <var>x_n</var>, if specified, as in <code>ratvars</code>.
</p>
<p><code>rat</code> does not generally simplify functions other than addition <code>+</code>,
subtraction <code>-</code>, multiplication <code>*</code>, division <code>/</code>, and
exponentiation to an integer power,
whereas <code>ratsimp</code> does handle those cases.
Note that atoms (numbers and variables) in CRE form are not the
same as they are in the general form.
For example, <code>rat(x)- x</code> yields
<code>rat(0)</code> which has a different internal representation than 0.
</p>
<p>When <code>ratfac</code> is <code>true</code>, <code>rat</code> yields a partially factored
form for CRE. During rational operations the expression is
maintained as fully factored as possible without an actual call to the
factor package. This should always save space and may save some time
in some computations. The numerator and denominator are still made
relatively prime
(e.g., <code>rat((x^2 - 1)^4/(x + 1)^2)</code> yields <code>(x - 1)^4 (x + 1)^2</code>
when <code>ratfac</code> is <code>true</code>),
but the factors within each part may not be relatively prime.
</p>
<p><code>ratprint</code> if <code>false</code> suppresses the printout of the message
informing the user of the conversion of floating point numbers to
rational numbers.
</p>
<p><code>keepfloat</code> if <code>true</code> prevents floating point numbers from being
converted to rational numbers.
</p>
<p>See also <code>ratexpand</code> and <code>ratsimp</code>.
</p>
<p>Examples:
</p><pre class="example">(%i1) ((x - 2*y)^4/(x^2 - 4*y^2)^2 + 1)*(y + a)*(2*y + x) /
(4*y^2 + x^2);
4
(x - 2 y)
(y + a) (2 y + x) (------------ + 1)
2 2 2
(x - 4 y )
(%o1) ------------------------------------
2 2
4 y + x
(%i2) rat (%, y, a, x);
2 a + 2 y
(%o2)/R/ ---------
x + 2 y
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratalgdenom"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratalgdenom</b>
<a name="IDX671"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratalgdenom</code> is <code>true</code>, allows rationalization of denominators
with respect to radicals to take effect. <code>ratalgdenom</code> has an effect only
when canonical rational expressions (CRE) are used in algebraic mode.
</p>
<div class=categorybox>
·
<p>@ref{Category: Simplification flags and variables}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratcoef"></a>
</p><dl>
<dt><u>Function:</u> <b>ratcoef</b><i> (<var>expr</var>, <var>x</var>, <var>n</var>)</i>
<a name="IDX672"></a>
</dt>
<dt><u>Function:</u> <b>ratcoef</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX673"></a>
</dt>
<dd><p>Returns the coefficient of the expression <code><var>x</var>^<var>n</var></code>
in the expression <var>expr</var>.
If omitted, <var>n</var> is assumed to be 1.
</p>
<p>The return value is free
(except possibly in a non-rational sense) of the variables in <var>x</var>.
If no coefficient of this type exists, 0 is returned.
</p>
<p><code>ratcoef</code>
expands and rationally simplifies its first argument and thus it may
produce answers different from those of <code>coeff</code> which is purely
syntactic.
Thus <code>ratcoef ((x + 1)/y + x, x)</code> returns <code>(y + 1)/y</code> whereas
<code>coeff</code> returns 1.
</p>
<p><code>ratcoef (<var>expr</var>, <var>x</var>, 0)</code>, viewing <var>expr</var> as a sum,
returns a sum of those terms which do not contain <var>x</var>.
Therefore if <var>x</var> occurs to any negative powers, <code>ratcoef</code> should not
be used.
</p>
<p>Since <var>expr</var> is rationally
simplified before it is examined, coefficients may not appear quite
the way they were envisioned.
</p>
<p>Example:
</p>
<pre class="example">(%i1) s: a*x + b*x + 5$
(%i2) ratcoef (s, a + b);
(%o2) x
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratdenom"></a>
</p><dl>
<dt><u>Function:</u> <b>ratdenom</b><i> (<var>expr</var>)</i>
<a name="IDX674"></a>
</dt>
<dd><p>Returns the denominator of <var>expr</var>,
after coercing <var>expr</var> to a canonical rational expression (CRE).
The return value is a CRE.
</p>
<p><var>expr</var> is coerced to a CRE by <code>rat</code>
if it is not already a CRE.
This conversion may change the form of <var>expr</var> by putting all terms
over a common denominator.
</p>
<p><code>denom</code> is similar, but returns an ordinary expression instead of a CRE.
Also, <code>denom</code> does not attempt to place all terms over a common
denominator, and thus some expressions which are considered ratios by
<code>ratdenom</code> are not considered ratios by <code>denom</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratdenomdivide"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratdenomdivide</b>
<a name="IDX675"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratdenomdivide</code> is <code>true</code>,
<code>ratexpand</code> expands a ratio in which the numerator is a sum
into a sum of ratios,
all having a common denominator.
Otherwise, <code>ratexpand</code> collapses a sum of ratios into a single ratio,
the numerator of which is the sum of the numerators of each ratio.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) expr: (x^2 + x + 1)/(y^2 + 7);
2
x + x + 1
(%o1) ----------
2
y + 7
(%i2) ratdenomdivide: true$
(%i3) ratexpand (expr);
2
x x 1
(%o3) ------ + ------ + ------
2 2 2
y + 7 y + 7 y + 7
(%i4) ratdenomdivide: false$
(%i5) ratexpand (expr);
2
x + x + 1
(%o5) ----------
2
y + 7
(%i6) expr2: a^2/(b^2 + 3) + b/(b^2 + 3);
2
b a
(%o6) ------ + ------
2 2
b + 3 b + 3
(%i7) ratexpand (expr2);
2
b + a
(%o7) ------
2
b + 3
</pre>
<div class=categorybox>
·
<p>@ref{Category: Simplification flags and variables} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratdiff"></a>
</p><dl>
<dt><u>Function:</u> <b>ratdiff</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX676"></a>
</dt>
<dd><p>Differentiates the rational expression <var>expr</var> with respect to <var>x</var>.
<var>expr</var> must be a ratio of polynomials or a polynomial in <var>x</var>.
The argument <var>x</var> may be a variable or a subexpression of <var>expr</var>.
</p>
<p>The result is equivalent to <code>diff</code>, although perhaps in a different form.
<code>ratdiff</code> may be faster than <code>diff</code>, for rational expressions.
</p>
<p><code>ratdiff</code> returns a canonical rational expression (CRE) if <code>expr</code> is
a CRE. Otherwise, <code>ratdiff</code> returns a general expression.
</p>
<p><code>ratdiff</code> considers only the dependence of <var>expr</var> on <var>x</var>,
and ignores any dependencies established by <code>depends</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) expr: (4*x^3 + 10*x - 11)/(x^5 + 5);
3
4 x + 10 x - 11
(%o1) ----------------
5
x + 5
(%i2) ratdiff (expr, x);
7 5 4 2
8 x + 40 x - 55 x - 60 x - 50
(%o2) - ---------------------------------
10 5
x + 10 x + 25
(%i3) expr: f(x)^3 - f(x)^2 + 7;
3 2
(%o3) f (x) - f (x) + 7
(%i4) ratdiff (expr, f(x));
2
(%o4) 3 f (x) - 2 f(x)
(%i5) expr: (a + b)^3 + (a + b)^2;
3 2
(%o5) (b + a) + (b + a)
(%i6) ratdiff (expr, a + b);
2 2
(%o6) 3 b + (6 a + 2) b + 3 a + 2 a
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratdisrep"></a>
</p><dl>
<dt><u>Function:</u> <b>ratdisrep</b><i> (<var>expr</var>)</i>
<a name="IDX677"></a>
</dt>
<dd><p>Returns its argument as a general expression.
If <var>expr</var> is a general expression, it is returned unchanged.
</p>
<p>Typically <code>ratdisrep</code> is called to convert a canonical rational expression
(CRE) into a general expression.
This is sometimes convenient if one wishes to stop the "contagion", or
use rational functions in non-rational contexts.
</p>
<p>See also <code>totaldisrep</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratexpand"></a>
</p><dl>
<dt><u>Function:</u> <b>ratexpand</b><i> (<var>expr</var>)</i>
<a name="IDX678"></a>
</dt>
<dt><u>Option variable:</u> <b>ratexpand</b>
<a name="IDX679"></a>
</dt>
<dd><p>Expands <var>expr</var> by multiplying out products of sums and
exponentiated sums, combining fractions over a common denominator,
cancelling the greatest common divisor of the numerator and
denominator, then splitting the numerator (if a sum) into its
respective terms divided by the denominator.
</p>
<p>The return value of <code>ratexpand</code> is a general expression,
even if <var>expr</var> is a canonical rational expression (CRE).
</p>
<p>The switch <code>ratexpand</code> if <code>true</code> will cause CRE
expressions to be fully expanded when they are converted back to
general form or displayed, while if it is <code>false</code> then they will be put
into a recursive form.
See also <code>ratsimp</code>.
</p>
<p>When <code>ratdenomdivide</code> is <code>true</code>,
<code>ratexpand</code> expands a ratio in which the numerator is a sum
into a sum of ratios,
all having a common denominator.
Otherwise, <code>ratexpand</code> collapses a sum of ratios into a single ratio,
the numerator of which is the sum of the numerators of each ratio.
</p>
<p>When <code>keepfloat</code> is <code>true</code>, prevents floating
point numbers from being rationalized when expressions which contain
them are converted to canonical rational expression (CRE) form.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) ratexpand ((2*x - 3*y)^3);
3 2 2 3
(%o1) - 27 y + 54 x y - 36 x y + 8 x
(%i2) expr: (x - 1)/(x + 1)^2 + 1/(x - 1);
x - 1 1
(%o2) -------- + -----
2 x - 1
(x + 1)
(%i3) expand (expr);
x 1 1
(%o3) ------------ - ------------ + -----
2 2 x - 1
x + 2 x + 1 x + 2 x + 1
(%i4) ratexpand (expr);
2
2 x 2
(%o4) --------------- + ---------------
3 2 3 2
x + x - x - 1 x + x - x - 1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="ratfac"></a>
<a name="Item_003a-ratfac"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratfac</b>
<a name="IDX680"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>ratfac</code> is <code>true</code>, canonical rational expressions (CRE) are
manipulated in a partially factored form.
</p>
<p>During rational operations the expression is maintained as fully factored as
possible without calling <code>factor</code>.
This should always save space and may save time in some computations.
The numerator and denominator are made relatively prime, for example
<code>factor ((x^2 - 1)^4/(x + 1)^2)</code> yields <code>(x - 1)^4 (x + 1)^2</code>,
but the factors within each part may not be relatively prime.
</p>
<p>In the <code>ctensr</code> (Component Tensor Manipulation) package,
Ricci, Einstein, Riemann, and Weyl tensors and the scalar curvature
are factored automatically when <code>ratfac</code> is <code>true</code>.
<i><code>ratfac</code> should only be
set for cases where the tensorial components are known to consist of
few terms.</i>
</p>
<p>The <code>ratfac</code> and <code>ratweight</code> schemes are incompatible and may not
both be used at the same time.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratnumer"></a>
</p><dl>
<dt><u>Function:</u> <b>ratnumer</b><i> (<var>expr</var>)</i>
<a name="IDX681"></a>
</dt>
<dd><p>Returns the numerator of <var>expr</var>,
after coercing <var>expr</var> to a canonical rational expression (CRE).
The return value is a CRE.
</p>
<p><var>expr</var> is coerced to a CRE by <code>rat</code>
if it is not already a CRE.
This conversion may change the form of <var>expr</var> by putting all terms
over a common denominator.
</p>
<p><code>num</code> is similar, but returns an ordinary expression instead of a CRE.
Also, <code>num</code> does not attempt to place all terms over a common denominator,
and thus some expressions which are considered ratios by <code>ratnumer</code>
are not considered ratios by <code>num</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratp"></a>
</p><dl>
<dt><u>Function:</u> <b>ratp</b><i> (<var>expr</var>)</i>
<a name="IDX682"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a canonical rational expression (CRE) or
extended CRE, otherwise <code>false</code>.
</p>
<p>CRE are created by <code>rat</code> and related functions.
Extended CRE are created by <code>taylor</code> and related functions.
</p>
<div class=categorybox>
·
<p>@ref{Category: Predicate functions} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratprint"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratprint</b>
<a name="IDX683"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratprint</code> is <code>true</code>,
a message informing the user of the conversion of floating point numbers
to rational numbers is displayed.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions} ·
@ref{Category: Numerical evaluation} ·
@ref{Category: Console interaction}
</div>
</p></dd></dl>
<p><a name="ratsimp"></a>
<a name="Item_003a-ratsimp"></a>
</p><dl>
<dt><u>Function:</u> <b>ratsimp</b><i> (<var>expr</var>)</i>
<a name="IDX684"></a>
</dt>
<dt><u>Function:</u> <b>ratsimp</b><i> (<var>expr</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX685"></a>
</dt>
<dd><p>Simplifies the expression <var>expr</var> and all of its subexpressions, including
the arguments to non-rational functions. The result is returned as the quotient
of two polynomials in a recursive form, that is, the coefficients of the main
variable are polynomials in the other variables. Variables may include
non-rational functions (e.g., <code>sin (x^2 + 1)</code>) and the arguments to any
such functions are also rationally simplified.
</p>
<p><code>ratsimp (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</code>
enables rational simplification with the
specification of variable ordering as in <code>ratvars</code>.
</p>
<p>When <code>ratsimpexpons</code> is <code>true</code>,
<code>ratsimp</code> is applied to the exponents of expressions during simplification.
</p>
<p>See also <code>ratexpand</code>.
Note that <code>ratsimp</code> is affected by some of the
flags which affect <code>ratexpand</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) sin (x/(x^2 + x)) = exp ((log(x) + 1)^2 - log(x)^2);
2 2
x (log(x) + 1) - log (x)
(%o1) sin(------) = %e
2
x + x
(%i2) ratsimp (%);
1 2
(%o2) sin(-----) = %e x
x + 1
(%i3) ((x - 1)^(3/2) - (x + 1)*sqrt(x - 1))/sqrt((x - 1)*(x + 1));
3/2
(x - 1) - sqrt(x - 1) (x + 1)
(%o3) --------------------------------
sqrt((x - 1) (x + 1))
(%i4) ratsimp (%);
2 sqrt(x - 1)
(%o4) - -------------
2
sqrt(x - 1)
(%i5) x^(a + 1/a), ratsimpexpons: true;
2
a + 1
------
a
(%o5) x
</pre>
<div class=categorybox>
·
<p>@ref{Category: Simplification functions} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratsimpexpons"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratsimpexpons</b>
<a name="IDX686"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>ratsimpexpons</code> is <code>true</code>,
<code>ratsimp</code> is applied to the exponents of expressions during simplification.
</p>
<div class=categorybox>
·
<p>@ref{Category: Simplification flags and variables} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="radsubstflag"></a>
<a name="Item_003a-radsubstflag"></a>
</p><dl>
<dt><u>Option variable:</u> <b>radsubstflag</b>
<a name="IDX687"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>radsubstflag</code>, if <code>true</code>, permits <code>ratsubst</code> to make
substitutions such as <code>u</code> for <code>sqrt (x)</code> in <code>x</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Simplification flags and variables}
</div>
</p></dd></dl>
<p><a name="ratsubst"></a>
<a name="Item_003a-ratsubst"></a>
</p><dl>
<dt><u>Function:</u> <b>ratsubst</b><i> (<var>a</var>, <var>b</var>, <var>c</var>)</i>
<a name="IDX688"></a>
</dt>
<dd><p>Substitutes <var>a</var> for <var>b</var> in <var>c</var> and returns the resulting expression.
<var>b</var> may be a sum, product, power, etc.
</p>
<p><code>ratsubst</code> knows something of the meaning of expressions
whereas <code>subst</code> does a purely syntactic substitution.
Thus <code>subst (a, x + y, x + y + z)</code> returns <code>x + y + z</code>
whereas <code>ratsubst</code> returns <code>z + a</code>.
</p>
<p>When <code>radsubstflag</code> is <code>true</code>,
<code>ratsubst</code> makes substitutions for radicals in expressions
which don't explicitly contain them.
</p>
<p><code>ratsubst</code> ignores the value <code>true</code> of the option variable
<code>keepfloat</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) ratsubst (a, x*y^2, x^4*y^3 + x^4*y^8);
3 4
(%o1) a x y + a
(%i2) cos(x)^4 + cos(x)^3 + cos(x)^2 + cos(x) + 1;
4 3 2
(%o2) cos (x) + cos (x) + cos (x) + cos(x) + 1
(%i3) ratsubst (1 - sin(x)^2, cos(x)^2, %);
4 2 2
(%o3) sin (x) - 3 sin (x) + cos(x) (2 - sin (x)) + 3
(%i4) ratsubst (1 - cos(x)^2, sin(x)^2, sin(x)^4);
4 2
(%o4) cos (x) - 2 cos (x) + 1
(%i5) radsubstflag: false$
(%i6) ratsubst (u, sqrt(x), x);
(%o6) x
(%i7) radsubstflag: true$
(%i8) ratsubst (u, sqrt(x), x);
2
(%o8) u
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratvars"></a>
</p><dl>
<dt><u>Function:</u> <b>ratvars</b><i> (<var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX689"></a>
</dt>
<dt><u>Function:</u> <b>ratvars</b><i> ()</i>
<a name="IDX690"></a>
</dt>
<dt><u>System variable:</u> <b>ratvars</b>
<a name="IDX691"></a>
</dt>
<dd><p>Declares main variables <var>x_1</var>, …, <var>x_n</var> for rational expressions.
<var>x_n</var>, if present in a rational expression, is considered the main variable.
Otherwise, <var>x_[n-1]</var> is considered the main variable if present, and so on
through the preceding variables to <var>x_1</var>, which is considered the main
variable only if none of the succeeding variables are present.
</p>
<p>If a variable in a rational expression is not present in the <code>ratvars</code>
list, it is given a lower priority than <var>x_1</var>.
</p>
<p>The arguments to <code>ratvars</code> can be either variables or non-rational
functions such as <code>sin(x)</code>.
</p>
<p>The variable <code>ratvars</code> is a list of the arguments of
the function <code>ratvars</code> when it was called most recently.
Each call to the function <code>ratvars</code> resets the list.
<code>ratvars ()</code> clears the list.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratvarswitch"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratvarswitch</b>
<a name="IDX692"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>Maxima keeps an internal list in the Lisp variable <code>VARLIST</code> of the main
variables for rational expressions. If <code>ratvarswitch</code> is <code>true</code>,
every evaluation starts with a fresh list <code>VARLIST</code>. This is the default
behavior. Otherwise, the main variables from previous evaluations are not
removed from the internal list <code>VARLIST</code>.
</p>
<p>The main variables, which are declared with the function <code>ratvars</code> are
not affected by the option variable <code>ratvarswitch</code>.
</p>
<p>Examples:
</p>
<p>If <code>ratvarswitch</code> is <code>true</code>, every evaluation starts with a fresh
list <code>VARLIST</code>.
</p>
<pre class="example">(%i1) ratvarswitch:true$
(%i2) rat(2*x+y^2);
2
(%o2)/R/ y + 2 x
(%i3) :lisp varlist
($X $Y)
(%i3) rat(2*a+b^2);
2
(%o3)/R/ b + 2 a
(%i4) :lisp varlist
($A $B)
</pre>
<p>If <code>ratvarswitch</code> is <code>false</code>, the main variables from the last
evaluation are still present.
</p>
<pre class="example">(%i4) ratvarswitch:false$
(%i5) rat(2*x+y^2);
2
(%o5)/R/ y + 2 x
(%i6) :lisp varlist
($X $Y)
(%i6) rat(2*a+b^2);
2
(%o6)/R/ b + 2 a
(%i7) :lisp varlist
($A $B $X $Y)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions} ·
@ref{Category: Global flags}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratweight"></a>
</p><dl>
<dt><u>Function:</u> <b>ratweight</b><i> (<var>x_1</var>, <var>w_1</var>, …, <var>x_n</var>, <var>w_n</var>)</i>
<a name="IDX693"></a>
</dt>
<dt><u>Function:</u> <b>ratweight</b><i> ()</i>
<a name="IDX694"></a>
</dt>
<dd><p>Assigns a weight <var>w_i</var> to the variable <var>x_i</var>.
This causes a term to be replaced by 0 if its weight exceeds the
value of the variable <code>ratwtlvl</code> (default yields no truncation).
The weight of a term is the sum of the products of the
weight of a variable in the term times its power.
For example, the weight of <code>3 x_1^2 x_2</code> is <code>2 w_1 + w_2</code>.
Truncation according to <code>ratwtlvl</code> is carried out only when multiplying
or exponentiating canonical rational expressions (CRE).
</p>
<p><code>ratweight ()</code> returns the cumulative list of weight assignments.
</p>
<p>Note: The <code>ratfac</code> and <code>ratweight</code> schemes are incompatible and may
not both be used at the same time.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) ratweight (a, 1, b, 1);
(%o1) [a, 1, b, 1]
(%i2) expr1: rat(a + b + 1)$
(%i3) expr1^2;
2 2
(%o3)/R/ b + (2 a + 2) b + a + 2 a + 1
(%i4) ratwtlvl: 1$
(%i5) expr1^2;
(%o5)/R/ 2 b + 2 a + 1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratweights"></a>
</p><dl>
<dt><u>System variable:</u> <b>ratweights</b>
<a name="IDX695"></a>
</dt>
<dd><p>Default value: <code>[]</code>
</p>
<p><code>ratweights</code> is the list of weights assigned by <code>ratweight</code>.
The list is cumulative:
each call to <code>ratweight</code> places additional items in the list.
</p>
<p><code>kill (ratweights)</code> and <code>save (ratweights)</code> both work as expected.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-ratwtlvl"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ratwtlvl</b>
<a name="IDX696"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>ratwtlvl</code> is used in combination with the <code>ratweight</code>
function to control the truncation of canonical rational expressions (CRE).
For the default value of <code>false</code>, no truncation occurs.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-remainder"></a>
</p><dl>
<dt><u>Function:</u> <b>remainder</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX697"></a>
</dt>
<dt><u>Function:</u> <b>remainder</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX698"></a>
</dt>
<dd><p>Returns the remainder of the polynomial <var>p_1</var> divided by the polynomial
<var>p_2</var>. The arguments <var>x_1</var>, …, <var>x_n</var> are interpreted as in
<code>ratvars</code>.
</p>
<p><code>remainder</code> returns the second element
of the two-element list returned by <code>divide</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="resultant"></a>
<a name="Item_003a-resultant"></a>
</p><dl>
<dt><u>Function:</u> <b>resultant</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x</var>)</i>
<a name="IDX699"></a>
</dt>
<dd><p>The function <code>resultant</code> computes the resultant of the two polynomials
<var>p_1</var> and <var>p_2</var>, eliminating the variable <var>x</var>. The resultant is a
determinant of the coefficients of <var>x</var> in <var>p_1</var> and <var>p_2</var>, which
equals zero if and only if <var>p_1</var> and <var>p_2</var> have a non-constant factor
in common.
</p>
<p>If <var>p_1</var> or <var>p_2</var> can be factored, it may be desirable to call
<code><a href="#factor">factor</a></code> before calling <code>resultant</code>.
</p>
<p>The option variable <code>resultant</code> controls which algorithm will be used to
compute the resultant. See the option variable
<code><a href="#option_005fresultant">resultant</a></code>.
</p>
<p>The function <code><a href="#bezout">bezout</a></code> takes the same arguments as <code>resultant</code> and
returns a matrix. The determinant of the return value is the desired resultant.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) resultant(2*x^2+3*x+1, 2*x^2+x+1, x);
(%o1) 8
(%i2) resultant(x+1, x+1, x);
(%o2) 0
(%i3) resultant((x+1)*x, (x+1), x);
(%o3) 0
(%i4) resultant(a*x^2+b*x+1, c*x + 2, x);
2
(%o4) c - 2 b c + 4 a
(%i5) bezout(a*x^2+b*x+1, c*x+2, x);
[ 2 a 2 b - c ]
(%o5) [ ]
[ c 2 ]
(%i6) determinant(%);
(%o6) 4 a - (2 b - c) c
</pre><div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="option_005fresultant"></a>
</p>
<dl>
<dt><u>Option variable:</u> <b>resultant</b>
<a name="IDX700"></a>
</dt>
<dd><p>Default value: <code>subres</code>
</p>
<p>The option variable <code>resultant</code> controls which algorithm will be used to
compute the resultant with the function <code><a href="#resultant">resultant</a></code>. The possible
values are:
</p>
<dl compact="compact">
<dt> <code>subres</code></dt>
<dd><p>for the subresultant polynomial remainder sequence (PRS) algorithm,
</p></dd>
<dt> <code>mod</code></dt>
<dd><p>for the modular resultant algorithm, and
</p></dd>
<dt> <code>red</code></dt>
<dd><p>for the reduced polynomial remainder sequence (PRS) algorithm.
</p></dd>
</dl>
<p>On most problems the default value <code>subres</code> should be best. On some
large degree univariate or bivariate problems <code>mod</code> may be better.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-savefactors"></a>
</p><dl>
<dt><u>Option variable:</u> <b>savefactors</b>
<a name="IDX701"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>savefactors</code> is <code>true</code>, causes the factors of an
expression which is a product of factors to be saved by certain
functions in order to speed up later factorizations of expressions
containing some of the same factors.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="showratvars"></a>
<a name="Item_003a-showratvars"></a>
</p><dl>
<dt><u>Function:</u> <b>showratvars</b><i> (<var>expr</var>)</i>
<a name="IDX702"></a>
</dt>
<dd><p>Returns a list of the canonical rational expression (CRE) variables in
expression <code>expr</code>.
</p>
<p>See also <code>ratvars</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions} ·
@ref{Category: Display functions}
</div>
</p></dd></dl>
<p><a name="sqfr"></a>
<a name="Item_003a-sqfr"></a>
</p><dl>
<dt><u>Function:</u> <b>sqfr</b><i> (<var>expr</var>)</i>
<a name="IDX703"></a>
</dt>
<dd><p>is similar to <code>factor</code> except that the polynomial factors are
"square-free." That is, they have factors only of degree one.
This algorithm, which is also used by the first stage of <code>factor</code>, utilizes
the fact that a polynomial has in common with its n'th derivative all
its factors of degree greater than n. Thus by taking greatest common divisors
with the polynomial of
the derivatives with respect to each variable in the polynomial, all
factors of degree greater than 1 can be found.
</p>
<p>Example:
</p>
<pre class="example">(%i1) sqfr (4*x^4 + 4*x^3 - 3*x^2 - 4*x - 1);
2 2
(%o1) (2 x + 1) (x - 1)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="Item_003a-tellrat"></a>
</p><dl>
<dt><u>Function:</u> <b>tellrat</b><i> (<var>p_1</var>, …, <var>p_n</var>)</i>
<a name="IDX704"></a>
</dt>
<dt><u>Function:</u> <b>tellrat</b><i> ()</i>
<a name="IDX705"></a>
</dt>
<dd><p>Adds to the ring of algebraic integers known to Maxima
the elements which are the solutions of the polynomials <var>p_1</var>, …,
<var>p_n</var>. Each argument <var>p_i</var> is a polynomial with integer coefficients.
</p>
<p><code>tellrat (<var>x</var>)</code> effectively means substitute 0 for <var>x</var> in rational
functions.
</p>
<p><code>tellrat ()</code> returns a list of the current substitutions.
</p>
<p><code>algebraic</code> must be set to <code>true</code> in order for the simplification of
algebraic integers to take effect.
</p>
<p>Maxima initially knows about the imaginary unit <code>%i</code>
and all roots of integers.
</p>
<p>There is a command <code>untellrat</code> which takes kernels and
removes <code>tellrat</code> properties.
</p>
<p>When <code>tellrat</code>'ing a multivariate
polynomial, e.g., <code>tellrat (x^2 - y^2)</code>, there would be an ambiguity as to
whether to substitute <code><var>y</var>^2</code> for <code><var>x</var>^2</code>
or vice versa.
Maxima picks a particular ordering, but if the user wants to specify which, e.g.
<code>tellrat (y^2 = x^2)</code> provides a syntax which says replace
<code><var>y</var>^2</code> by <code><var>x</var>^2</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) 10*(%i + 1)/(%i + 3^(1/3));
10 (%i + 1)
(%o1) -----------
1/3
%i + 3
(%i2) ev (ratdisrep (rat(%)), algebraic);
2/3 1/3 2/3 1/3
(%o2) (4 3 - 2 3 - 4) %i + 2 3 + 4 3 - 2
(%i3) tellrat (1 + a + a^2);
2
(%o3) [a + a + 1]
(%i4) 1/(a*sqrt(2) - 1) + a/(sqrt(3) + sqrt(2));
1 a
(%o4) ------------- + -----------------
sqrt(2) a - 1 sqrt(3) + sqrt(2)
(%i5) ev (ratdisrep (rat(%)), algebraic);
(7 sqrt(3) - 10 sqrt(2) + 2) a - 2 sqrt(2) - 1
(%o5) ----------------------------------------------
7
(%i6) tellrat (y^2 = x^2);
2 2 2
(%o6) [y - x , a + a + 1]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-totaldisrep"></a>
</p><dl>
<dt><u>Function:</u> <b>totaldisrep</b><i> (<var>expr</var>)</i>
<a name="IDX706"></a>
</dt>
<dd><p>Converts every subexpression of <var>expr</var> from canonical rational expressions
(CRE) to general form and returns the result.
If <var>expr</var> is itself in CRE form then <code>totaldisrep</code> is identical to
<code>ratdisrep</code>.
</p>
<p><code>totaldisrep</code> may be useful for
ratdisrepping expressions such as equations, lists, matrices, etc., which
have some subexpressions in CRE form.
</p>
<div class=categorybox>
·
<p>@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-untellrat"></a>
</p><dl>
<dt><u>Function:</u> <b>untellrat</b><i> (<var>x_1</var>, …, <var>x_n</var>)</i>
<a name="IDX707"></a>
</dt>
<dd><p>Removes <code>tellrat</code> properties from <var>x_1</var>, …, <var>x_n</var>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Rational expressions}
</div>
</p></dd></dl>
<p><a name="Item_003a-Special-Functions"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC74" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_15.html#SEC77" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|