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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 20 2006 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 Manual: 6. Expressions</title>
<meta name="description" content="Maxima Manual: 6. Expressions">
<meta name="keywords" content="Maxima Manual: 6. Expressions">
<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: none;
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 */
font-family: "Lucida Console", monospace
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
-->
</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="Expressions"></a>
<a name="SEC21"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_5.html#SEC20" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC22" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_5.html#SEC14" 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_7.html#SEC31" 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_72.html#SEC264" 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"> 6. Expressions </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC22">6.1 Introduction to Expressions</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC23">6.2 Assignment</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC24">6.3 Complex</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC25">6.4 Nouns and Verbs</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC26">6.5 Identifiers</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC27">6.6 Strings</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC28">6.7 Inequality</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC29">6.8 Syntax</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC30">6.9 Definitions for Expressions</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr size="6">
<a name="Introduction-to-Expressions"></a>
<a name="SEC22"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC21" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC23" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.1 Introduction to Expressions </h2>
<p>There are a number of reserved words which cannot be used as
variable names. Their use would cause a possibly cryptic syntax error.
</p>
<table><tr><td> </td><td><pre class="example">integrate next from diff
in at limit sum
for and elseif then
else do or if
unless product while thru
step
</pre></td></tr></table>
<p>Most things in Maxima are expressions. A sequence of expressions
can be made into an expression by separating them by commas and
putting parentheses around them. This is similar to the <b>C</b>
<i>comma expression</i>.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) x: 3$
(%i2) (x: x+1, x: x^2);
(%o2) 16
(%i3) (if (x > 17) then 2 else 4);
(%o3) 4
(%i4) (if (x > 17) then x: 2 else y: 4, y+x);
(%o4) 20
</pre></td></tr></table>
<p>Even loops in Maxima are expressions, although the value they
return is the not too useful <code>done</code>.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) y: (x: 1, for i from 1 thru 10 do (x: x*i))$
(%i2) y;
(%o2) done
</pre></td></tr></table>
<p>whereas what you really want is probably to include a third
term in the <i>comma expression</i> which actually gives back the value.
</p>
<table><tr><td> </td><td><pre class="example">(%i3) y: (x: 1, for i from 1 thru 10 do (x: x*i), x)$
(%i4) y;
(%o4) 3628800
</pre></td></tr></table>
<hr size="6">
<a name="Assignment"></a>
<a name="SEC23"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC22" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC24" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.2 Assignment </h2>
<p>There are two assignment operators in Maxima, <code>:</code> and <code>::</code>.
E.g., <code>a: 3</code> sets the variable <code>a</code> to 3. <code>::</code> assigns the value of the
expression on its right to the value of the quantity on its left,
which must evaluate to an atomic variable or subscripted variable.
</p>
<hr size="6">
<a name="Complex"></a>
<a name="SEC24"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC23" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC25" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.3 Complex </h2>
<p>A complex expression is specified in Maxima by adding the
real part of the expression to <code>%i</code> times the imaginary part. Thus the
roots of the equation <code>x^2 - 4*x + 13 = 0</code> are <code>2 + 3*%i</code> and <code>2 - 3*%i</code>. Note that
simplification of products of complex expressions can be effected by
expanding the product. Simplification of quotients, roots, and other
functions of complex expressions can usually be accomplished by using
the <code>realpart</code>, <code>imagpart</code>, <code>rectform</code>, <code>polarform</code>, <code>abs</code>, <code>carg</code> functions.
</p>
<hr size="6">
<a name="Nouns-and-Verbs"></a>
<a name="SEC25"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC24" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC26" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.4 Nouns and Verbs </h2>
<p>Maxima distinguishes between operators which are "nouns" and operators which are "verbs".
A verb is an operator which can be executed.
A noun is an operator which appears as a symbol in an expression, without being executed.
By default, function names are verbs.
A verb can be changed into a noun by quoting the function name
or applying the <code>nounify</code> function.
A noun can be changed into a verb by applying the <code>verbify</code> function.
The evaluation flag <code>nouns</code> causes <code>ev</code> to evaluate nouns in an expression.
</p>
<p>The verb form is distinguished by
a leading dollar sign <code>$</code> on the corresponding Lisp symbol.
In contrast,
the noun form is distinguished by
a leading percent sign <code>%</code> on the corresponding Lisp symbol.
Some nouns have special display properties, such as <code>'integrate</code> and <code>'derivative</code>
(returned by <code>diff</code>), but most do not.
By default, the noun and verb forms of a function are identical when displayed.
The global flag <code>noundisp</code> causes Maxima to display nouns with a leading quote mark <code>'</code>.
</p>
<p>See also <code>noun</code>, <code>nouns</code>, <code>nounify</code>, and <code>verbify</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) foo (x) := x^2;
2
(%o1) foo(x) := x
(%i2) foo (42);
(%o2) 1764
(%i3) 'foo (42);
(%o3) foo(42)
(%i4) 'foo (42), nouns;
(%o4) 1764
(%i5) declare (bar, noun);
(%o5) done
(%i6) bar (x) := x/17;
x
(%o6) ''bar(x) := --
17
(%i7) bar (52);
(%o7) bar(52)
(%i8) bar (52), nouns;
52
(%o8) --
17
(%i9) integrate (1/x, x, 1, 42);
(%o9) log(42)
(%i10) 'integrate (1/x, x, 1, 42);
42
/
[ 1
(%o10) I - dx
] x
/
1
(%i11) ev (%, nouns);
(%o11) log(42)
</pre></td></tr></table>
<hr size="6">
<a name="Identifiers"></a>
<a name="SEC26"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC25" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC27" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.5 Identifiers </h2>
<p>Maxima identifiers may comprise alphabetic characters,
plus the numerals 0 through 9,
plus any special character preceded by the backslash <code>\</code> character.
</p>
<p>A numeral may be the first character of an identifier
if it is preceded by a backslash.
Numerals which are the second or later characters need not be preceded by a backslash.
</p>
<p>A special character may be declared alphabetic by the <code>declare</code> function.
If so declared, it need not be preceded by a backslash in an identifier.
The alphabetic characters are initially
<code>A</code> through <code>Z</code>, <code>a</code> through <code>z</code>, <code>%</code>, and <code>_</code>.
</p>
<p>Maxima is case-sensitive. The identifiers <code>foo</code>, <code>FOO</code>, and <code>Foo</code> are distinct.
See <a href="maxima_3.html#SEC7">Lisp and Maxima</a> for more on this point.
</p>
<p>A Maxima identifier is a Lisp symbol which begins with a dollar sign <code>$</code>.
Any other Lisp symbol is preceded by a question mark <code>?</code> when it appears in Maxima.
See <a href="maxima_3.html#SEC7">Lisp and Maxima</a> for more on this point.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) %an_ordinary_identifier42;
(%o1) %an_ordinary_identifier42
(%i2) embedded\ spaces\ in\ an\ identifier;
(%o2) embedded spaces in an identifier
(%i3) symbolp (%);
(%o3) true
(%i4) [foo+bar, foo\+bar];
(%o4) [foo + bar, foo+bar]
(%i5) [1729, \1729];
(%o5) [1729, 1729]
(%i6) [symbolp (foo\+bar), symbolp (\1729)];
(%o6) [true, true]
(%i7) [is (foo\+bar = foo+bar), is (\1729 = 1729)];
(%o7) [false, false]
(%i8) baz\~quux;
(%o8) baz~quux
(%i9) declare ("~", alphabetic);
(%o9) done
(%i10) baz~quux;
(%o10) baz~quux
(%i11) [is (foo = FOO), is (FOO = Foo), is (Foo = foo)];
(%o11) [false, false, false]
(%i12) :lisp (defvar *my-lisp-variable* '$foo)
*MY-LISP-VARIABLE*
(%i12) ?\*my\-lisp\-variable\*;
(%o12) foo
</pre></td></tr></table>
<hr size="6">
<a name="Strings"></a>
<a name="SEC27"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC26" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC28" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.6 Strings </h2>
<p>Strings (quoted character sequences) are enclosed in double quote marks <code>"</code> for input,
and displayed with or without the quote marks,
depending on the global variable <code>?stringdisp</code>.
</p>
<p>Strings may contain any characters,
including embedded tab, newline, and carriage return characters.
The sequence <code>\"</code> is recognized as a literal double quote,
and <code>\\</code> as a literal backslash.
When backslash appears at the end of a line,
the backslash and the line termination
(either newline or carriage return and newline)
are ignored,
so that the string continues with the next line.
No other special combinations of backslash with another character are recognized;
when backslash appears before any character other than <code>"</code>, <code>\</code>,
or a line termination, the backslash is ignored.
There is no way to represent a special character
(such as tab, newline, or carriage return)
except by embedding the literal character in the string.
</p>
<p>There is no character type in Maxima;
a single character is represented as a one-character string.
</p>
<p>Maxima strings are implemented as Lisp symbols, not Lisp strings;
that may change in a future version of Maxima.
Maxima can display Lisp strings and Lisp characters,
although some other operations (for example, equality tests) may fail.
</p>
<p>The <code>stringproc</code> add-on package contains many functions for working with strings.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) s_1 : "This is a Maxima string.";
(%o1) This is a Maxima string.
(%i2) s_2 : "Embedded \"double quotes\" and backslash \\ characters.";
(%o2) Embedded "double quotes" and backslash \ characters.
(%i3) s_3 : "Embedded line termination
in this string.";
(%o3) Embedded line termination
in this string.
(%i4) s_4 : "Ignore the \
line termination \
characters in \
this string.";
(%o4) Ignore the line termination characters in this string.
(%i5) ?stringdisp : false;
(%o5) false
(%i6) s_1;
(%o6) This is a Maxima string.
(%i7) ?stringdisp : true;
(%o7) true
(%i8) s_1;
(%o8) "This is a Maxima string."
</pre></td></tr></table>
<hr size="6">
<a name="Inequality"></a>
<a name="SEC28"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC27" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC29" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.7 Inequality </h2>
<p>Maxima has the inequality operators <code><</code>, <code><=</code>, <code>>=</code>, <code>></code>, <code>#</code>, and <code>notequal</code>.
See <code>if</code> for a description of conditional expressions.
</p>
<hr size="6">
<a name="Syntax"></a>
<a name="SEC29"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC28" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC30" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.8 Syntax </h2>
<p>It is possible to define new operators with specified precedence,
to undefine existing operators,
or to redefine the precedence of existing operators.
An operator may be unary prefix or unary postfix, binary infix, n-ary infix, matchfix, or nofix.
"Matchfix" means a pair of symbols which enclose their argument or arguments,
and "nofix" means an operator which takes no arguments.
As examples of the different types of operators, there are the following.
</p>
<dl compact="compact">
<dt> unary prefix</dt>
<dd><p>negation <code>- a</code>
</p></dd>
<dt> unary postfix</dt>
<dd><p>factorial <code>a!</code>
</p></dd>
<dt> binary infix</dt>
<dd><p>exponentiation <code>a^b</code>
</p></dd>
<dt> n-ary infix</dt>
<dd><p>addition <code>a + b</code>
</p></dd>
<dt> matchfix</dt>
<dd><p>list construction <code>[a, b]</code>
</p></dd>
</dl>
<p>(There are no built-in nofix operators;
for an example of such an operator, see <code>nofix</code>.)
</p>
<p>The mechanism to define a new operator is straightforward.
It is only necessary to declare a function as an operator;
the operator function might or might not be defined.
</p>
<p>An example of user-defined operators is the following.
Note that the explicit function call <code>"dd" (a)</code> is equivalent to <code>dd a</code>,
likewise <code>"<-" (a, b)</code> is equivalent to <code>a <- b</code>.
Note also that the functions <code>"dd"</code> and <code>"<-"</code> are undefined in this example.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) prefix ("dd");
(%o1) dd
(%i2) dd a;
(%o2) dd a
(%i3) "dd" (a);
(%o3) dd a
(%i4) infix ("<-");
(%o4) <-
(%i5) a <- dd b;
(%o5) a <- dd b
(%i6) "<-" (a, "dd" (b));
(%o6) a <- dd b
</pre></td></tr></table>
<p>The Maxima functions which define new operators are summarized in this table,
stating the default left and right binding powers (lbp and rbp, respectively).
(Binding power determines operator precedence. However, since left and right
binding powers can differ, binding power is somewhat more complicated than precedence.)
Some of the operation definition functions take additional arguments;
see the function descriptions for details.
</p>
<dl compact="compact">
<dt> <code>prefix</code></dt>
<dd><p>rbp=180
</p></dd>
<dt> <code>postfix</code></dt>
<dd><p>lbp=180
</p></dd>
<dt> <code>infix</code></dt>
<dd><p>lbp=180, rbp=180
</p></dd>
<dt> <code>nary</code></dt>
<dd><p>lbp=180, rbp=180
</p></dd>
<dt> <code>matchfix</code></dt>
<dd><p>(binding power not applicable)
</p></dd>
<dt> <code>nofix</code></dt>
<dd><p>(binding power not applicable)
</p></dd>
</dl>
<p>For comparison,
here are some built-in operators and their left and right binding powers.
</p>
<table><tr><td> </td><td><pre class="example">Operator lbp rbp
: 180 20
:: 180 20
:= 180 20
::= 180 20
! 160
!! 160
^ 140 139
. 130 129
* 120
/ 120 120
+ 100 100
- 100 134
= 80 80
# 80 80
> 80 80
>= 80 80
< 80 80
<= 80 80
not 70
and 65
or 60
, 10
$ -1
; -1
</pre></td></tr></table>
<p><code>remove</code> and <code>kill</code> remove operator properties from an atom.
<code>remove ("<var>a</var>", op)</code> removes only the operator properties of <var>a</var>.
<code>kill ("<var>a</var>")</code> removes all properties of <var>a</var>, including the operator properties.
Note that the name of the operator must be enclosed in quotation marks.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) infix ("@");
(%o1) @
(%i2) "@" (a, b) := a^b;
b
(%o2) a @ b := a
(%i3) 5 @ 3;
(%o3) 125
(%i4) remove ("@", op);
(%o4) done
(%i5) 5 @ 3;
Incorrect syntax: @ is not an infix operator
5 @
^
(%i5) "@" (5, 3);
(%o5) 125
(%i6) infix ("@");
(%o6) @
(%i7) 5 @ 3;
(%o7) 125
(%i8) kill ("@");
(%o8) done
(%i9) 5 @ 3;
Incorrect syntax: @ is not an infix operator
5 @
^
(%i9) "@" (5, 3);
(%o9) @(5, 3)
</pre></td></tr></table>
<hr size="6">
<a name="Definitions-for-Expressions"></a>
<a name="SEC30"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC29" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC21" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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"> 6.9 Definitions for Expressions </h2>
<dl>
<dt><u>Function:</u> <b>at</b><i> (<var>expr</var>, [<var>eqn_1</var>, ..., <var>eqn_n</var>])</i>
<a name="IDX121"></a>
</dt>
<dt><u>Function:</u> <b>at</b><i> (<var>expr</var>, <var>eqn</var>)</i>
<a name="IDX122"></a>
</dt>
<dd><p>Evaluates the expression <var>expr</var> with
the variables assuming the values as specified for them in the list of
equations <code>[<var>eqn_1</var>, ..., <var>eqn_n</var>]</code> or the single equation <var>eqn</var>.
</p>
<p>If a subexpression depends on any of the variables for which a value is specified
but there is no atvalue specified and it can't be otherwise evaluated,
then a noun form of the <code>at</code> is returned which displays in a two-dimensional form.
</p>
<p><code>at</code> carries out multiple substitutions in series, not parallel.
</p>
<p>See also <code>atvalue</code>.
For other functions which carry out substitutions,
see also <code>subst</code> and <code>ev</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) atvalue (f(x,y), [x = 0, y = 1], a^2);
2
(%o1) a
(%i2) atvalue ('diff (f(x,y), x), x = 0, 1 + y);
(%o2) @2 + 1
(%i3) printprops (all, atvalue);
!
d !
--- (f(@1, @2))! = @2 + 1
d@1 !
!@1 = 0
2
f(0, 1) = a
(%o3) done
(%i4) diff (4*f(x, y)^2 - u(x, y)^2, x);
d d
(%o4) 8 f(x, y) (-- (f(x, y))) - 2 u(x, y) (-- (u(x, y)))
dx dx
(%i5) at (%, [x = 0, y = 1]);
!
2 d !
(%o5) 16 a - 2 u(0, 1) (-- (u(x, y))! )
dx !
!x = 0, y = 1
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>box</b><i> (<var>expr</var>)</i>
<a name="IDX123"></a>
</dt>
<dt><u>Function:</u> <b>box</b><i> (<var>expr</var>, <var>a</var>)</i>
<a name="IDX124"></a>
</dt>
<dd><p>Returns <var>expr</var> enclosed in a box.
The return value is an expression with <code>box</code> as the operator and <var>expr</var> as the argument.
A box is drawn on the display when <code>display2d</code> is <code>true</code>.
</p>
<p><code>box (<var>expr</var>, <var>a</var>)</code>
encloses <var>expr</var> in a box labelled by the symbol <var>a</var>.
The label is truncated if it is longer than the width of the box.
</p>
<p><code>box</code> evaluates its argument.
However, a boxed expression does not evaluate to its content,
so boxed expressions are effectively excluded from computations.
</p>
<p><code>boxchar</code> is the character used to draw the box in <code>box</code>
and in the <code>dpart</code> and <code>lpart</code> functions.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) box (a^2 + b^2);
"""""""""
" 2 2"
(%o1) "b + a "
"""""""""
(%i2) a : 1234;
(%o2) 1234
(%i3) b : c - d;
(%o3) c - d
(%i4) box (a^2 + b^2);
""""""""""""""""""""
" 2 "
(%o4) "(c - d) + 1522756"
""""""""""""""""""""
(%i5) box (a^2 + b^2, term_1);
term_1""""""""""""""
" 2 "
(%o5) "(c - d) + 1522756"
""""""""""""""""""""
(%i6) 1729 - box (1729);
""""""
(%o6) 1729 - "1729"
""""""
(%i7) boxchar: "-";
(%o7) -
(%i8) box (sin(x) + cos(y));
-----------------
(%o8) -cos(y) + sin(x)-
-----------------
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>boxchar</b>
<a name="IDX125"></a>
</dt>
<dd><p>Default value: <code>"</code>
</p>
<p><code>boxchar</code> is the character used to draw the box in the <code>box</code>
and in the <code>dpart</code> and <code>lpart</code> functions.
</p>
<p>All boxes in an expression are drawn with the current value of <code>boxchar</code>;
the drawing character is not stored with the box expression.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>carg</b><i> (<var>z</var>)</i>
<a name="IDX126"></a>
</dt>
<dd><p>Returns the complex argument of <var>z</var>.
The complex argument is an angle <code>theta</code> in <code>(-%pi, %pi]</code>
such that <code>r exp (theta %i) = <var>z</var></code> where <code>r</code> is the magnitude of <var>z</var>.
</p>
<p><code>carg</code> is a computational function,
not a simplifying function.
</p>
<p><code>carg</code> ignores the declaration <code>declare (<var>x</var>, complex)</code>,
and treats <var>x</var> as a real variable.
This is a bug. </p>
<p>See also <code>abs</code> (complex magnitude), <code>polarform</code>, <code>rectform</code>,
<code>realpart</code>, and <code>imagpart</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) carg (1);
(%o1) 0
(%i2) carg (1 + %i);
%pi
(%o2) ---
4
(%i3) carg (exp (%i));
(%o3) 1
(%i4) carg (exp (%pi * %i));
(%o4) %pi
(%i5) carg (exp (3/2 * %pi * %i));
%pi
(%o5) - ---
2
(%i6) carg (17 * exp (2 * %i));
(%o6) 2
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Special operator:</u> <b>constant</b>
<a name="IDX127"></a>
</dt>
<dd><p><code>declare (<var>a</var>, constant)</code> declares <var>a</var> to be a constant.
See <code>declare</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>constantp</b><i> (<var>expr</var>)</i>
<a name="IDX128"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a constant expression,
otherwise returns <code>false</code>.
</p>
<p>An expression is considered a constant expression if its arguments are
numbers (including rational numbers, as displayed with <code>/R/</code>),
symbolic constants such as <code>%pi</code>, <code>%e</code>, and <code>%i</code>,
variables bound to a constant or declared constant by <code>declare</code>,
or functions whose arguments are constant.
</p>
<p><code>constantp</code> evaluates its arguments.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) constantp (7 * sin(2));
(%o1) true
(%i2) constantp (rat (17/29));
(%o2) true
(%i3) constantp (%pi * sin(%e));
(%o3) true
(%i4) constantp (exp (x));
(%o4) false
(%i5) declare (x, constant);
(%o5) done
(%i6) constantp (exp (x));
(%o6) true
(%i7) constantp (foo (x) + bar (%e) + baz (2));
(%o7) false
(%i8)
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>declare</b><i> (<var>a_1</var>, <var>p_1</var>, <var>a_2</var>, <var>p_2</var>, ...)</i>
<a name="IDX129"></a>
</dt>
<dd><p>Assigns the atom or list of atoms <var>a_i</var> the property or list of properties <var>p_i</var>.
When <var>a_i</var> and/or <var>p_i</var> are lists,
each of the atoms gets all of the properties.
</p>
<p><code>declare</code> quotes its arguments.
<code>declare</code> always returns <code>done</code>.
</p>
<p>As noted in the description for each declaration flag,
for some flags
<code>featurep(<var>object</var>, <var>feature</var>)</code>
returns <code>true</code> if <var>object</var> has been declared to have <var>feature</var>.
However, <code>featurep</code> does not recognize some flags; this is a bug.
</p>
<p>See also <code>features</code>.
</p>
<p><code>declare</code> recognizes the following properties:
</p>
<dl compact="compact">
<dt> <code>evfun</code></dt>
<dd><p>Makes <var>a_i</var> known to <code>ev</code> so that the function named by <var>a_i</var>
is applied when <var>a_i</var> appears as a flag argument of <code>ev</code>.
See <code>evfun</code>.
</p>
</dd>
<dt> <code>evflag</code></dt>
<dd><p>Makes <var>a_i</var> known to the <code>ev</code> function so that <var>a_i</var> is bound to <code>true</code>
during the execution of <code>ev</code> when <var>a_i</var> appears as a flag argument of <code>ev</code>.
See <code>evflag</code>.
</p>
</dd>
<dt> <code>bindtest</code></dt>
<dd><p>Tells Maxima to trigger an error when <var>a_i</var> is evaluated unbound.
</p>
</dd>
<dt> <code>noun</code></dt>
<dd><p>Tells Maxima to parse <var>a_i</var> as a noun.
The effect of this is to replace instances of <var>a_i</var> with <code>'<var>a_i</var></code>
or <code>nounify(<var>a_i</var>)</code>, depending on the context.
</p>
</dd>
<dt> <code>constant</code></dt>
<dd><p>Tells Maxima to consider <var>a_i</var> a symbolic constant.
</p>
</dd>
<dt> <code>scalar</code></dt>
<dd><p>Tells Maxima to consider <var>a_i</var> a scalar variable.
</p>
</dd>
<dt> <code>nonscalar</code></dt>
<dd><p>Tells Maxima to consider <var>a_i</var> a nonscalar variable.
The usual application is to declare a variable as a symbolic vector or matrix.
</p>
</dd>
<dt> <code>mainvar</code></dt>
<dd><p>Tells Maxima to consider <var>a_i</var> a "main variable" (<code>mainvar</code>).
<code>ordergreatp</code> determines the ordering of atoms as follows:
</p>
<p>(main variables) > (other variables) > (scalar variables) > (constants) > (numbers)
</p>
</dd>
<dt> <code>alphabetic</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an alphabetic character.
</p>
</dd>
<dt> <code>feature</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as the name of a feature.
Other atoms may then be declared to have the <var>a_i</var> property.
</p>
</dd>
<dt> <code>rassociative</code>, <code>lassociative</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as a right-associative or left-associative function.
</p>
</dd>
<dt> <code>nary</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an n-ary function.
</p>
<p>The <code>nary</code> declaration is not the same as calling the <code>nary</code> function.
The sole effect of <code>declare(foo, nary)</code> is to instruct the Maxima simplifier
to flatten nested expressions,
for example, to simplify <code>foo(x, foo(y, z))</code> to <code>foo(x, y, z)</code>.
</p>
</dd>
<dt> <code>symmetric</code>, <code>antisymmetric</code>, <code>commutative</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as a symmetric or antisymmetric function.
<code>commutative</code> is the same as <code>symmetric</code>.
</p>
</dd>
<dt> <code>oddfun</code>, <code>evenfun</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an odd or even function.
</p>
</dd>
<dt> <code>outative</code></dt>
<dd><p>Tells Maxima to simplify <var>a_i</var> expressions
by pulling constant factors out of the first argument.
</p>
<p>When <var>a_i</var> has one argument,
a factor is considered constant if it is a literal or declared constant.
</p>
<p>When <var>a_i</var> has two or more arguments,
a factor is considered constant
if the second argument is a symbol
and the factor is free of the second argument.
</p>
</dd>
<dt> <code>multiplicative</code></dt>
<dd><p>Tells Maxima to simplify <var>a_i</var> expressions
by the substitution <code><var>a_i</var>(x * y * z * ...)</code> <code>--></code>
<code><var>a_i</var>(x) * <var>a_i</var>(y) * <var>a_i</var>(z) * ...</code>.
The substitution is carried out on the first argument only.
</p>
</dd>
<dt> <code>additive</code></dt>
<dd><p>Tells Maxima to simplify <var>a_i</var> expressions
by the substitution <code><var>a_i</var>(x + y + z + ...)</code> <code>--></code>
<code><var>a_i</var>(x) + <var>a_i</var>(y) + <var>a_i</var>(z) + ...</code>.
The substitution is carried out on the first argument only.
</p>
</dd>
<dt> <code>linear</code></dt>
<dd><p>Equivalent to declaring <var>a_i</var> both <code>outative</code> and <code>additive</code>.
</p>
</dd>
<dt> <code>integer</code>, <code>noninteger</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an integer or noninteger variable.
</p>
</dd>
<dt> <code>even</code>, <code>odd</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an even or odd integer variable.
</p>
</dd>
<dt> <code>rational</code>, <code>irrational</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as a rational or irrational real variable.
</p>
</dd>
<dt> <code>real</code>, <code>imaginary</code>, <code>complex</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as a real, pure imaginary, or complex variable.
</p>
</dd>
<dt> <code>increasing</code>, <code>decreasing</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an increasing or decreasing function.
</p>
</dd>
<dt> <code>posfun</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as a positive function.
</p>
</dd>
<dt> <code>integervalued</code></dt>
<dd><p>Tells Maxima to recognize <var>a_i</var> as an integer-valued function.
</p>
</dd>
</dl>
<p>Examples:
</p>
<p><code>evfun</code> and <code>evflag</code> declarations.
</p><table><tr><td> </td><td><pre class="example">(%i1) declare (expand, evfun);
(%o1) done
(%i2) (a + b)^3;
3
(%o2) (b + a)
(%i3) (a + b)^3, expand;
3 2 2 3
(%o3) b + 3 a b + 3 a b + a
(%i4) declare (demoivre, evflag);
(%o4) done
(%i5) exp (a + b*%i);
%i b + a
(%o5) %e
(%i6) exp (a + b*%i), demoivre;
a
(%o6) %e (%i sin(b) + cos(b))
</pre></td></tr></table>
<p><code>bindtest</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) aa + bb;
(%o1) bb + aa
(%i2) declare (aa, bindtest);
(%o2) done
(%i3) aa + bb;
aa unbound variable
-- an error. Quitting. To debug this try debugmode(true);
(%i4) aa : 1234;
(%o4) 1234
(%i5) aa + bb;
(%o5) bb + 1234
</pre></td></tr></table>
<p><code>noun</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) factor (12345678);
2
(%o1) 2 3 47 14593
(%i2) declare (factor, noun);
(%o2) done
(%i3) factor (12345678);
(%o3) factor(12345678)
(%i4) ''%, nouns;
2
(%o4) 2 3 47 14593
</pre></td></tr></table>
<p><code>constant</code>, <code>scalar</code>, <code>nonscalar</code>, and <code>mainvar</code> declarations.
</p>
<p><code>alphabetic</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) xx\~yy : 1729;
(%o1) 1729
(%i2) declare ("~", alphabetic);
(%o2) done
(%i3) xx~yy + yy~xx + ~xx~~yy~;
(%o3) ~xx~~yy~ + yy~xx + 1729
</pre></td></tr></table>
<p><code>feature</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) declare (FOO, feature);
(%o1) done
(%i2) declare (x, FOO);
(%o2) done
(%i3) featurep (x, FOO);
(%o3) true
</pre></td></tr></table>
<p><code>rassociative</code> and <code>lassociative</code> declarations.
</p>
<p><code>nary</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) H (H (a, b), H (c, H (d, e)));
(%o1) H(H(a, b), H(c, H(d, e)))
(%i2) declare (H, nary);
(%o2) done
(%i3) H (H (a, b), H (c, H (d, e)));
(%o3) H(a, b, c, d, e)
</pre></td></tr></table>
<p><code>symmetric</code> and <code>antisymmetric</code> declarations.
</p><table><tr><td> </td><td><pre class="example">(%i1) S (b, a);
(%o1) S(b, a)
(%i2) declare (S, symmetric);
(%o2) done
(%i3) S (b, a);
(%o3) S(a, b)
(%i4) S (a, c, e, d, b);
(%o4) S(a, b, c, d, e)
(%i5) T (b, a);
(%o5) T(b, a)
(%i6) declare (T, antisymmetric);
(%o6) done
(%i7) T (b, a);
(%o7) - T(a, b)
(%i8) T (a, c, e, d, b);
(%o8) T(a, b, c, d, e)
</pre></td></tr></table>
<p><code>oddfun</code> and <code>evenfun</code> declarations.
</p><table><tr><td> </td><td><pre class="example">(%i1) o (- u) + o (u);
(%o1) o(u) + o(- u)
(%i2) declare (o, oddfun);
(%o2) done
(%i3) o (- u) + o (u);
(%o3) 0
(%i4) e (- u) - e (u);
(%o4) e(- u) - e(u)
(%i5) declare (e, evenfun);
(%o5) done
(%i6) e (- u) - e (u);
(%o6) 0
</pre></td></tr></table>
<p><code>outative</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) F1 (100 * x);
(%o1) F1(100 x)
(%i2) declare (F1, outative);
(%o2) done
(%i3) F1 (100 * x);
(%o3) 100 F1(x)
(%i4) declare (zz, constant);
(%o4) done
(%i5) F1 (zz * y);
(%o5) zz F1(y)
</pre></td></tr></table>
<p><code>multiplicative</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) F2 (a * b * c);
(%o1) F2(a b c)
(%i2) declare (F2, multiplicative);
(%o2) done
(%i3) F2 (a * b * c);
(%o3) F2(a) F2(b) F2(c)
</pre></td></tr></table>
<p><code>additive</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) F3 (a + b + c);
(%o1) F3(c + b + a)
(%i2) declare (F3, additive);
(%o2) done
(%i3) F3 (a + b + c);
(%o3) F3(c) + F3(b) + F3(a)
</pre></td></tr></table>
<p><code>linear</code> declaration.
</p><table><tr><td> </td><td><pre class="example">(%i1) 'sum (F(k) + G(k), k, 1, inf);
inf
====
\
(%o1) > (G(k) + F(k))
/
====
k = 1
(%i2) declare (nounify (sum), linear);
(%o2) done
(%i3) 'sum (F(k) + G(k), k, 1, inf);
inf inf
==== ====
\ \
(%o3) > G(k) + > F(k)
/ /
==== ====
k = 1 k = 1
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>disolate</b><i> (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX130"></a>
</dt>
<dd><p>is similar to <code>isolate (<var>expr</var>, <var>x</var>)</code>
except that it enables the user to isolate
more than one variable simultaneously. This might be useful, for
example, if one were attempting to change variables in a multiple
integration, and that variable change involved two or more of the
integration variables. This function is autoloaded from
<tt>`simplification/disol.mac'</tt>. A demo is available by
<code>demo("disol")$</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>dispform</b><i> (<var>expr</var>)</i>
<a name="IDX131"></a>
</dt>
<dd><p>Returns the external representation of <var>expr</var> with respect to its
main operator. This should be useful in conjunction with <code>part</code> which
also deals with the external representation. Suppose <var>expr</var> is -A .
Then the internal representation of <var>expr</var> is "*"(-1,A), while the
external representation is "-"(A). <code>dispform (<var>expr</var>, all)</code> converts the
entire expression (not just the top-level) to external format. For
example, if <code>expr: sin (sqrt (x))</code>, then <code>freeof (sqrt, expr)</code> and
<code>freeof (sqrt, dispform (expr))</code> give <code>true</code>, while
<code>freeof (sqrt, dispform (expr, all))</code> gives <code>false</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>distrib</b><i> (<var>expr</var>)</i>
<a name="IDX132"></a>
</dt>
<dd><p>Distributes sums over products. It differs from <code>expand</code>
in that it works at only the top level of an expression, i.e., it doesn't
recurse and it is faster than <code>expand</code>. It differs from <code>multthru</code> in
that it expands all sums at that level.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) distrib ((a+b) * (c+d));
(%o1) b d + a d + b c + a c
(%i2) multthru ((a+b) * (c+d));
(%o2) (b + a) d + (b + a) c
(%i3) distrib (1/((a+b) * (c+d)));
1
(%o3) ---------------
(b + a) (d + c)
(%i4) expand (1/((a+b) * (c+d)), 1, 0);
1
(%o4) ---------------------
b d + a d + b c + a c
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>dpart</b><i> (<var>expr</var>, <var>n_1</var>, ..., <var>n_k</var>)</i>
<a name="IDX133"></a>
</dt>
<dd><p>Selects the same subexpression as <code>part</code>, but
instead of just returning that subexpression as its value, it returns
the whole expression with the selected subexpression displayed inside
a box. The box is actually part of the expression.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) dpart (x+y/z^2, 1, 2, 1);
y
(%o1) ---- + x
2
"""
"z"
"""
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>exp</b><i> (<var>x</var>)</i>
<a name="IDX134"></a>
</dt>
<dd><p>Represents the exponential function.
Instances of <code>exp (<var>x</var>)</code> in input are simplified to <code>%e^<var>x</var></code>;
<code>exp</code> does not appear in simplified expressions.
</p>
<p><code>demoivre</code> if <code>true</code> causes <code>%e^(a + b %i)</code> to simplify to
<code>%e^(a (cos(b) + %i sin(b)))</code> if <code>b</code> is free of <code>%i</code>. See <code>demoivre</code>.
</p>
<p><code>%emode</code>, when <code>true</code>,
causes <code>%e^(%pi %i x)</code> to be simplified. See <code>%emode</code>.
</p>
<p><code>%enumer</code>, when <code>true</code> causes <code>%e</code> to be replaced by
2.718... whenever <code>numer</code> is <code>true</code>. See <code>%enumer</code>.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>%emode</b>
<a name="IDX135"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>%emode</code> is <code>true</code>,
<code>%e^(%pi %i x)</code> is simplified as
follows.
</p>
<p><code>%e^(%pi %i x)</code> simplifies to <code>cos (%pi x) + %i sin (%pi x)</code> if <code>x</code> is an integer or
a multiple of 1/2, 1/3, 1/4, or 1/6, and then further simplified.
</p>
<p>For other numerical <code>x</code>,
<code>%e^(%pi %i x)</code> simplifies to <code>%e^(%pi %i y)</code> where <code>y</code> is <code>x - 2 k</code>
for some integer <code>k</code> such that <code>abs(y) < 1</code>.
</p>
<p>When <code>%emode</code> is <code>false</code>, no
special simplification of <code>%e^(%pi %i x)</code> is carried out.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>%enumer</b>
<a name="IDX136"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>%enumer</code> is <code>true</code>,
<code>%e</code> is replaced by its numeric value
2.718... whenever <code>numer</code> is <code>true</code>.
</p>
<p>When <code>%enumer</code> is <code>false</code>, this substitution is carried out
only if the exponent in <code>%e^x</code> evaluates to a number.
</p>
<p>See also <code>ev</code> and <code>numer</code>.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>exptisolate</b>
<a name="IDX137"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>exptisolate</code>, when <code>true</code>, causes <code>isolate (expr, var)</code> to
examine exponents of atoms (such as <code>%e</code>) which contain <code>var</code>.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>exptsubst</b>
<a name="IDX138"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>exptsubst</code>, when <code>true</code>, permits substitutions such as <code>y</code>
for <code>%e^x</code> in <code>%e^(a x)</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>freeof</b><i> (<var>x_1</var>, ..., <var>x_n</var>, <var>expr</var>)</i>
<a name="IDX139"></a>
</dt>
<dd><p><code>freeof (<var>x_1</var>, <var>expr</var>)</code>
Returns <code>true</code>
if no subexpression of <var>expr</var> is equal to <var>x_1</var>
or if <var>x_1</var> occurs only as a dummy variable in <var>expr</var>,
and returns <code>false</code> otherwise.
</p>
<p><code>freeof (<var>x_1</var>, ..., <var>x_n</var>, <var>expr</var>)</code>
is equivalent to <code>freeof (<var>x_1</var>, <var>expr</var>) and ... and freeof (<var>x_n</var>, <var>expr</var>)</code>.
</p>
<p>The arguments <var>x_1</var>, ..., <var>x_n</var>
may be names of functions and variables, subscripted names,
operators (enclosed in double quotes), or general expressions.
<code>freeof</code> evaluates its arguments.
</p>
<p><code>freeof</code> operates only on <var>expr</var> as it stands (after simplification and evaluation) and
does not attempt to determine if some equivalent expression would give a different result.
In particular, simplification may yield an equivalent but different expression which comprises
some different elements than the original form of <var>expr</var>.
</p>
<p>A variable is a dummy variable in an expression if it has no binding outside of the expression.
Dummy variables recognized by <code>freeof</code> are
the index of a sum or product, the limit variable in <code>limit</code>,
the integration variable in the definite integral form of <code>integrate</code>,
the original variable in <code>laplace</code>,
formal variables in <code>at</code> expressions,
and arguments in <code>lambda</code> expressions.
Local variables in <code>block</code> are not recognized by <code>freeof</code> as dummy variables;
this is a bug.
</p>
<p>The indefinite form of <code>integrate</code> is <i>not</i> free of its variable of integration.
</p>
<ul>
<li>
Arguments are names of functions, variables, subscripted names, operators, and expressions.
<code>freeof (a, b, expr)</code> is equivalent to
<code>freeof (a, expr) and freeof (b, expr)</code>.
<table><tr><td> </td><td><pre class="example">(%i1) expr: z^3 * cos (a[1]) * b^(c+d);
d + c 3
(%o1) cos(a ) b z
1
(%i2) freeof (z, expr);
(%o2) false
(%i3) freeof (cos, expr);
(%o3) false
(%i4) freeof (a[1], expr);
(%o4) false
(%i5) freeof (cos (a[1]), expr);
(%o5) false
(%i6) freeof (b^(c+d), expr);
(%o6) false
(%i7) freeof ("^", expr);
(%o7) false
(%i8) freeof (w, sin, a[2], sin (a[2]), b*(c+d), expr);
(%o8) true
</pre></td></tr></table>
</li><li>
<code>freeof</code> evaluates its arguments.
<table><tr><td> </td><td><pre class="example">(%i1) expr: (a+b)^5$
(%i2) c: a$
(%i3) freeof (c, expr);
(%o3) false
</pre></td></tr></table>
</li><li>
<code>freeof</code> does not consider equivalent expressions.
Simplification may yield an equivalent but different expression.
<table><tr><td> </td><td><pre class="example">(%i1) expr: (a+b)^5$
(%i2) expand (expr);
5 4 2 3 3 2 4 5
(%o2) b + 5 a b + 10 a b + 10 a b + 5 a b + a
(%i3) freeof (a+b, %);
(%o3) true
(%i4) freeof (a+b, expr);
(%o4) false
(%i5) exp (x);
x
(%o5) %e
(%i6) freeof (exp, exp (x));
(%o6) true
</pre></td></tr></table>
</li><li> A summation or definite integral is free of its dummy variable.
An indefinite integral is not free of its variable of integration.
<table><tr><td> </td><td><pre class="example">(%i1) freeof (i, 'sum (f(i), i, 0, n));
(%o1) true
(%i2) freeof (x, 'integrate (x^2, x, 0, 1));
(%o2) true
(%i3) freeof (x, 'integrate (x^2, x));
(%o3) false
</pre></td></tr></table></li></ul>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>genfact</b><i> (<var>x</var>, <var>y</var>, <var>z</var>)</i>
<a name="IDX140"></a>
</dt>
<dd><p>Returns the generalized factorial, defined as
<code>x (x-z) (x - 2 z) ... (x - (y - 1) z)</code>. Thus, for integral <var>x</var>,
<code>genfact (x, x, 1) = x!</code> and <code>genfact (x, x/2, 2) = x!!</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>imagpart</b><i> (<var>expr</var>)</i>
<a name="IDX141"></a>
</dt>
<dd><p>Returns the imaginary part of the expression <var>expr</var>.
</p>
<p><code>imagpart</code> is a computational function,
not a simplifying function.
</p>
<p>See also <code>abs</code>, <code>carg</code>, <code>polarform</code>, <code>rectform</code>,
and <code>realpart</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>infix</b><i> (<var>op</var>)</i>
<a name="IDX142"></a>
</dt>
<dt><u>Function:</u> <b>infix</b><i> (<var>op</var>, <var>lbp</var>, <var>rbp</var>)</i>
<a name="IDX143"></a>
</dt>
<dt><u>Function:</u> <b>infix</b><i> (<var>op</var>, <var>lbp</var>, <var>rbp</var>, <var>lpos</var>, <var>rpos</var>, <var>pos</var>)</i>
<a name="IDX144"></a>
</dt>
<dd><p>Declares <var>op</var> to be an infix operator.
An infix operator is a function of two arguments,
with the name of the function written between the arguments.
For example, the subtraction operator <code>-</code> is an infix operator.
</p>
<p><code>infix (<var>op</var>)</code> declares <var>op</var> to be an infix operator
with default binding powers (left and right both equal to 180)
and parts of speech (left and right both equal to <code>any</code>).
</p>
<p><code>infix (<var>op</var>, <var>lbp</var>, <var>rbp</var>)</code> declares <var>op</var> to be an infix operator
with stated left and right binding powers
and default parts of speech (left and right both equal to <code>any</code>).
</p>
<p><code>infix (<var>op</var>, <var>lbp</var>, <var>rbp</var>, <var>lpos</var>, <var>rpos</var>, <var>pos</var>)</code>
declares <var>op</var> to be an infix operator
with stated left and right binding powers and parts of speech.
</p>
<p>The precedence of <var>op</var> with respect to other operators
derives from the left and right binding powers of the operators in question.
If the left and right binding powers of <var>op</var> are both greater
the left and right binding powers of some other operator,
then <var>op</var> takes precedence over the other operator.
If the binding powers are not both greater or less,
some more complicated relation holds.
</p>
<p>The associativity of <var>op</var> depends on its binding powers.
Greater left binding power (<var>lbp</var>) implies an instance of
<var>op</var> is evaluated before other operators to its left in an expression,
while greater right binding power (<var>rbp</var>) implies an instance of
<var>op</var> is evaluated before other operators to its right in an expression.
Thus greater <var>lbp</var> makes <var>op</var> right-associative,
while greater <var>rbp</var> makes <var>op</var> left-associative.
If <var>lbp</var> is equal to <var>rbp</var>, <var>op</var> is left-associative.
</p>
<p>See also <code>Syntax</code>.
</p>
<p>Examples:
</p>
<ul>
<li>
If the left and right binding powers of <var>op</var> are both greater
the left and right binding powers of some other operator,
then <var>op</var> takes precedence over the other operator.
</li></ul>
<table><tr><td> </td><td><pre class="example">(%i1) "@"(a, b) := sconcat("(", a, ",", b, ")")$
(%i2) :lisp (get '$+ 'lbp)
100
(%i2) :lisp (get '$+ 'rbp)
100
(%i2) infix ("@", 101, 101)$
(%i3) 1 + a@b + 2;
(%o3) (a,b) + 3
(%i4) infix ("@", 99, 99)$
(%i5) 1 + a@b + 2;
(%o5) (a+1,b+2)
</pre></td></tr></table>
<ul>
<li>
Greater <var>lbp</var> makes <var>op</var> right-associative,
while greater <var>rbp</var> makes <var>op</var> left-associative.
</li></ul>
<table><tr><td> </td><td><pre class="example">(%i1) "@"(a, b) := sconcat("(", a, ",", b, ")")$
(%i2) infix ("@", 100, 99)$
(%i3) foo @ bar @ baz;
(%o3) (foo,(bar,baz))
(%i4) infix ("@", 100, 101)$
(%i5) foo @ bar @ baz;
(%o5) ((foo,bar),baz)
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>inflag</b>
<a name="IDX145"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>inflag</code> is <code>true</code>, functions for part
extraction inspect the internal form of <code>expr</code>.
</p>
<p>Note that the simplifier re-orders expressions.
Thus <code>first (x + y)</code> returns <code>x</code> if <code>inflag</code>
is <code>true</code> and <code>y</code> if <code>inflag</code> is <code>false</code>.
(<code>first (y + x)</code> gives the same results.)
</p>
<p>Also, setting <code>inflag</code> to <code>true</code> and calling <code>part</code> or <code>substpart</code> is
the same as calling <code>inpart</code> or <code>substinpart</code>.
</p>
<p>Functions affected by the setting of <code>inflag</code> are:
<code>part</code>, <code>substpart</code>, <code>first</code>, <code>rest</code>, <code>last</code>, <code>length</code>,
the <code>for</code> ... <code>in</code> construct,
<code>map</code>, <code>fullmap</code>, <code>maplist</code>, <code>reveal</code> and <code>pickapart</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>inpart</b><i> (<var>expr</var>, <var>n_1</var>, ..., <var>n_k</var>)</i>
<a name="IDX146"></a>
</dt>
<dd><p>is similar to <code>part</code> but works on the internal
representation of the expression rather than the displayed form and
thus may be faster since no formatting is done. Care should be taken
with respect to the order of subexpressions in sums and products
(since the order of variables in the internal form is often different
from that in the displayed form) and in dealing with unary minus,
subtraction, and division (since these operators are removed from the
expression). <code>part (x+y, 0)</code> or <code>inpart (x+y, 0)</code> yield <code>+</code>, though in order to
refer to the operator it must be enclosed in "s. For example
<code>... if inpart (%o9,0) = "+" then ...</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) x + y + w*z;
(%o1) w z + y + x
(%i2) inpart (%, 3, 2);
(%o2) z
(%i3) part (%th (2), 1, 2);
(%o3) z
(%i4) 'limit (f(x)^g(x+1), x, 0, minus);
g(x + 1)
(%o4) limit f(x)
x -> 0-
(%i5) inpart (%, 1, 2);
(%o5) g(x + 1)
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>isolate</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX147"></a>
</dt>
<dd><p>Returns <var>expr</var> with subexpressions which are sums and
which do not contain var replaced by intermediate expression labels
(these being atomic symbols like <code>%t1</code>, <code>%t2</code>, ...). This is often useful
to avoid unnecessary expansion of subexpressions which don't contain
the variable of interest. Since the intermediate labels are bound to
the subexpressions they can all be substituted back by evaluating the
expression in which they occur.
</p>
<p><code>exptisolate</code> (default value: <code>false</code>) if <code>true</code> will cause <code>isolate</code> to examine exponents of
atoms (like <code>%e</code>) which contain var.
</p>
<p><code>isolate_wrt_times</code> if <code>true</code>, then <code>isolate</code> will also isolate with respect to
products. See <code>isolate_wrt_times</code>.
</p>
<p>Do <code>example (isolate)</code> for examples.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>isolate_wrt_times</b>
<a name="IDX148"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>isolate_wrt_times</code> is <code>true</code>, <code>isolate</code>
will also isolate with respect to products. E.g. compare both settings of the
switch on
</p>
<table><tr><td> </td><td><pre class="example">(%i1) isolate_wrt_times: true$
(%i2) isolate (expand ((a+b+c)^2), c);
(%t2) 2 a
(%t3) 2 b
2 2
(%t4) b + 2 a b + a
2
(%o4) c + %t3 c + %t2 c + %t4
(%i4) isolate_wrt_times: false$
(%i5) isolate (expand ((a+b+c)^2), c);
2
(%o5) c + 2 b c + 2 a c + %t4
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>listconstvars</b>
<a name="IDX149"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>listconstvars</code> is <code>true</code>, it will cause <code>listofvars</code> to
include <code>%e</code>, <code>%pi</code>, <code>%i</code>, and any variables declared constant in the list
it returns if they appear in the expression <code>listofvars</code> is called on.
The default is to omit these.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>listdummyvars</b>
<a name="IDX150"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>listdummyvars</code> is <code>false</code>, "dummy variables" in the
expression will not be included in the list returned by <code>listofvars</code>.
(The meaning of "dummy variables" is as given in <code>freeof</code>.
"Dummy variables" are mathematical things like the index of a sum or
product, the limit variable, and the definite integration variable.)
Example:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) listdummyvars: true$
(%i2) listofvars ('sum(f(i), i, 0, n));
(%o2) [i, n]
(%i3) listdummyvars: false$
(%i4) listofvars ('sum(f(i), i, 0, n));
(%o4) [n]
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>listofvars</b><i> (<var>expr</var>)</i>
<a name="IDX151"></a>
</dt>
<dd><p>Returns a list of the variables in <var>expr</var>.
</p>
<p><code>listconstvars</code> if <code>true</code> causes <code>listofvars</code> to include <code>%e</code>, <code>%pi</code>,
<code>%i</code>, and any variables declared constant in the list it returns if they
appear in <var>expr</var>. The default is to omit these.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) listofvars (f (x[1]+y) / g^(2+a));
(%o1) [g, a, x , y]
1
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>lfreeof</b><i> (<var>list</var>, <var>expr</var>)</i>
<a name="IDX152"></a>
</dt>
<dd><p>For each member <var>m</var> of list, calls <code>freeof (<var>m</var>, <var>expr</var>)</code>.
It returns <code>false</code> if any call to <code>freeof</code> does and <code>true</code> otherwise.
</p></dd></dl>
<dl>
<dt><u>Function:</u> <b>lopow</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX153"></a>
</dt>
<dd><p>Returns the lowest exponent of <var>x</var> which explicitly appears in
<var>expr</var>. Thus
</p>
<table><tr><td> </td><td><pre class="example">(%i1) lopow ((x+y)^2 + (x+y)^a, x+y);
(%o1) min(a, 2)
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>lpart</b><i> (<var>label</var>, <var>expr</var>, <var>n_1</var>, ..., <var>n_k</var>)</i>
<a name="IDX154"></a>
</dt>
<dd><p>is similar to <code>dpart</code> but uses a
labelled box. A labelled box is similar to the one produced by <code>dpart</code>
but it has a name in the top line.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>multthru</b><i> (<var>expr</var>)</i>
<a name="IDX155"></a>
</dt>
<dt><u>Function:</u> <b>multthru</b><i> (<var>expr_1</var>, <var>expr_2</var>)</i>
<a name="IDX156"></a>
</dt>
<dd><p>Multiplies a factor (which should be a sum) of <var>expr</var> by
the other factors of <var>expr</var>. That is, <var>expr</var> is <code><var>f_1</var> <var>f_2</var> ... <var>f_n</var></code>
where at least
one factor, say <var>f_i</var>, is a sum of terms. Each term in that sum is
multiplied by the other factors in the product. (Namely all the
factors except <var>f_i</var>). <code>multthru</code> does not expand exponentiated sums.
This function is the fastest way to distribute products (commutative
or noncommutative) over sums. Since quotients are represented as
products <code>multthru</code> can be used to divide sums by products as well.
</p>
<p><code>multthru (<var>expr_1</var>, <var>expr_2</var>)</code> multiplies each term in <var>expr_2</var> (which should be a
sum or an equation) by <var>expr_1</var>. If <var>expr_1</var> is not itself a sum then this
form is equivalent to <code>multthru (<var>expr_1</var>*<var>expr_2</var>)</code>.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) x/(x-y)^2 - 1/(x-y) - f(x)/(x-y)^3;
1 x f(x)
(%o1) - ----- + -------- - --------
x - y 2 3
(x - y) (x - y)
(%i2) multthru ((x-y)^3, %);
2
(%o2) - (x - y) + x (x - y) - f(x)
(%i3) ratexpand (%);
2
(%o3) - y + x y - f(x)
(%i4) ((a+b)^10*s^2 + 2*a*b*s + (a*b)^2)/(a*b*s^2);
10 2 2 2
(b + a) s + 2 a b s + a b
(%o4) ------------------------------
2
a b s
(%i5) multthru (%); /* note that this does not expand (b+a)^10 */
10
2 a b (b + a)
(%o5) - + --- + ---------
s 2 a b
s
(%i6) multthru (a.(b+c.(d+e)+f));
(%o6) a . f + a . c . (e + d) + a . b
(%i7) expand (a.(b+c.(d+e)+f));
(%o7) a . f + a . c . e + a . c . d + a . b
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>nounify</b><i> (<var>f</var>)</i>
<a name="IDX157"></a>
</dt>
<dd><p>Returns the noun form of the function name <var>f</var>. This is
needed if one wishes to refer to the name of a verb function as if it
were a noun. Note that some verb functions will return their noun
forms if they can't be evaluated for certain arguments. This is also
the form returned if a function call is preceded by a quote.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>nterms</b><i> (<var>expr</var>)</i>
<a name="IDX158"></a>
</dt>
<dd><p>Returns the number of terms that <var>expr</var> would have if it were
fully expanded out and no cancellations or combination of terms
occurred.
Note that expressions like <code>sin (<var>expr</var>)</code>, <code>sqrt (<var>expr</var>)</code>, <code>exp (<var>expr</var>)</code>, etc.
count as just one term regardless of how many terms <var>expr</var> has (if it is a
sum).
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>op</b><i> (<var>expr</var>)</i>
<a name="IDX159"></a>
</dt>
<dd><p>Returns the main operator of the expression <var>expr</var>.
<code>op (<var>expr</var>)</code> is equivalent to <code>part (<var>expr</var>, 0)</code>.
</p>
<p><code>op</code> returns a string if the main operator is
a built-in or user-defined
prefix, binary or n-ary infix, postfix, matchfix, or nofix operator.
Otherwise <code>op</code> returns a symbol.
</p>
<p><code>op</code> observes the value of the global flag <code>inflag</code>.
</p>
<p><code>op</code> evaluates it argument.
</p>
<p>See also <code>args</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) ?stringdisp: true$
(%i2) op (a * b * c);
(%o2) "*"
(%i3) op (a * b + c);
(%o3) "+"
(%i4) op ('sin (a + b));
(%o4) sin
(%i5) op (a!);
(%o5) "!"
(%i6) op (-a);
(%o6) "-"
(%i7) op ([a, b, c]);
(%o7) "["
(%i8) op ('(if a > b then c else d));
(%o8) "if"
(%i9) op ('foo (a));
(%o9) foo
(%i10) prefix (foo);
(%o10) "foo"
(%i11) op (foo a);
(%o11) "foo"
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>operatorp</b><i> (<var>expr</var>, <var>op</var>)</i>
<a name="IDX160"></a>
</dt>
<dt><u>Function:</u> <b>operatorp</b><i> (<var>expr</var>, [<var>op_1</var>, ..., <var>op_n</var>])</i>
<a name="IDX161"></a>
</dt>
<dd><p><code>operatorp (<var>expr</var>, <var>op</var>)</code> returns <code>true</code>
if <var>op</var> is equal to the operator of <var>expr</var>.
</p>
<p><code>operatorp (<var>expr</var>, [<var>op_1</var>, ..., <var>op_n</var>])</code> returns <code>true</code>
if some element <var>op_1</var>, ..., <var>op_n</var> is equal to the operator of <var>expr</var>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>optimize</b><i> (<var>expr</var>)</i>
<a name="IDX162"></a>
</dt>
<dd><p>Returns an expression that produces the same value and
side effects as <var>expr</var> but does so more efficiently by avoiding the
recomputation of common subexpressions. <code>optimize</code> also has the side
effect of "collapsing" its argument so that all common subexpressions
are shared.
Do <code>example (optimize)</code> for examples.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>optimprefix</b>
<a name="IDX163"></a>
</dt>
<dd><p>Default value: <code>%</code>
</p>
<p><code>optimprefix</code> is the prefix used for generated symbols by
the <code>optimize</code> command.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>ordergreat</b><i> (<var>v_1</var>, ..., <var>v_n</var>)</i>
<a name="IDX164"></a>
</dt>
<dd><p>Sets up aliases for the variables <var>v_1</var>, ..., <var>v_n</var>
such that <var>v_1</var> > <var>v_2</var> > ... > <var>v_n</var>,
and <var>v_n</var> > any other variable not mentioned as an
argument.
</p>
<p>See also <code>orderless</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>ordergreatp</b><i> (<var>expr_1</var>, <var>expr_2</var>)</i>
<a name="IDX165"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr_2</var> precedes <var>expr_1</var> in the
ordering set up with the <code>ordergreat</code> function.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>orderless</b><i> (<var>v_1</var>, ..., <var>v_n</var>)</i>
<a name="IDX166"></a>
</dt>
<dd><p>Sets up aliases for the variables <var>v_1</var>, ..., <var>v_n</var>
such that <var>v_1</var> < <var>v_2</var> < ... < <var>v_n</var>,
and <var>v_n</var> < any other variable not mentioned as an
argument.
</p>
<p>Thus the complete ordering scale is: numerical constants <
declared constants < declared scalars < first argument to <code>orderless</code> <
... < last argument to <code>orderless</code> < variables which begin with A < ...
< variables which begin with Z < last argument to <code>ordergreat</code> <
... < first argument to <code>ordergreat</code> < declared <code>mainvar</code>s.
</p>
<p>See also <code>ordergreat</code> and <code>mainvar</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>orderlessp</b><i> (<var>expr_1</var>, <var>expr_2</var>)</i>
<a name="IDX167"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr_1</var> precedes <var>expr_2</var> in the
ordering set up by the <code>orderless</code> command.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>part</b><i> (<var>expr</var>, <var>n_1</var>, ..., <var>n_k</var>)</i>
<a name="IDX168"></a>
</dt>
<dd><p>Returns parts of the displayed form of <code>expr</code>. It
obtains the part of <code>expr</code> as specified by the indices <var>n_1</var>, ..., <var>n_k</var>. First
part <var>n_1</var> of <code>expr</code> is obtained, then part <var>n_2</var> of that, etc. The result is
part <var>n_k</var> of ... part <var>n_2</var> of part <var>n_1</var> of <code>expr</code>.
</p>
<p><code>part</code> can be used to obtain an element of a list, a row of a matrix, etc.
</p>
<p>If the last argument to a part function is a list of indices then
several subexpressions are picked out, each one corresponding to an
index of the list. Thus <code>part (x + y + z, [1, 3])</code> is <code>z+x</code>.
</p>
<p><code>piece</code> holds the last expression selected when using the part
functions. It is set during the execution of the function and thus
may be referred to in the function itself as shown below.
</p>
<p>If <code>partswitch</code> is set to <code>true</code> then <code>end</code> is returned when a
selected part of an expression doesn't exist, otherwise an error
message is given.
</p>
<p>Example: <code>part (z+2*y, 2, 1)</code> yields 2.
</p>
<p><code>example (part)</code> displays additional examples.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>partition</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX169"></a>
</dt>
<dd><p>Returns a list of two expressions. They are (1)
the factors of <var>expr</var> (if it is a product), the terms of <var>expr</var> (if it is a
sum), or the list (if it is a list) which don't contain var and, (2)
the factors, terms, or list which do.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) partition (2*a*x*f(x), x);
(%o1) [2 a, x f(x)]
(%i2) partition (a+b, x);
(%o2) [b + a, 0]
(%i3) partition ([a, b, f(a), c], a);
(%o3) [[b, c], [a, f(a)]]
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>partswitch</b>
<a name="IDX170"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>partswitch</code> is <code>true</code>, <code>end</code> is returned
when a selected part of an expression doesn't exist, otherwise an
error message is given.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>pickapart</b><i> (<var>expr</var>, <var>n</var>)</i>
<a name="IDX171"></a>
</dt>
<dd><p>Assigns intermediate expression labels to subexpressions of
<var>expr</var> at depth <var>n</var>, an integer.
Subexpressions at greater or lesser depths are not assigned labels.
<code>pickapart</code> returns an expression in terms of intermediate expressions
equivalent to the original expression <var>expr</var>.
</p>
<p>See also <code>part</code>, <code>dpart</code>, <code>lpart</code>, <code>inpart</code>, and <code>reveal</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) expr: (a+b)/2 + sin (x^2)/3 - log (1 + sqrt(x+1));
2
sin(x ) b + a
(%o1) - log(sqrt(x + 1) + 1) + ------- + -----
3 2
(%i2) pickapart (expr, 0);
2
sin(x ) b + a
(%t2) - log(sqrt(x + 1) + 1) + ------- + -----
3 2
(%o2) %t2
(%i3) pickapart (expr, 1);
(%t3) - log(sqrt(x + 1) + 1)
2
sin(x )
(%t4) -------
3
b + a
(%t5) -----
2
(%o5) %t5 + %t4 + %t3
(%i5) pickapart (expr, 2);
(%t6) log(sqrt(x + 1) + 1)
2
(%t7) sin(x )
(%t8) b + a
%t8 %t7
(%o8) --- + --- - %t6
2 3
(%i8) pickapart (expr, 3);
(%t9) sqrt(x + 1) + 1
2
(%t10) x
b + a sin(%t10)
(%o10) ----- - log(%t9) + ---------
2 3
(%i10) pickapart (expr, 4);
(%t11) sqrt(x + 1)
2
sin(x ) b + a
(%o11) ------- + ----- - log(%t11 + 1)
3 2
(%i11) pickapart (expr, 5);
(%t12) x + 1
2
sin(x ) b + a
(%o12) ------- + ----- - log(sqrt(%t12) + 1)
3 2
(%i12) pickapart (expr, 6);
2
sin(x ) b + a
(%o12) ------- + ----- - log(sqrt(x + 1) + 1)
3 2
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>System variable:</u> <b>piece</b>
<a name="IDX172"></a>
</dt>
<dd><p>Holds the last expression selected when using the <code>part</code>
functions.
It is set during the execution of the function and thus
may be referred to in the function itself.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>polarform</b><i> (<var>expr</var>)</i>
<a name="IDX173"></a>
</dt>
<dd><p>Returns an expression <code>r %e^(%i theta)</code> equivalent to <var>expr</var>,
such that <code>r</code> and <code>theta</code> are purely real.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>powers</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX174"></a>
</dt>
<dd><p>Gives the powers of <var>x</var> occuring in <var>expr</var>.
</p>
<p><code>load (powers)</code> loads this function.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>product</b><i> (<var>expr</var>, <var>i</var>, <var>i_0</var>, <var>i_1</var>)</i>
<a name="IDX175"></a>
</dt>
<dd><p>Represents a product of the values of <var>expr</var> as
the index <var>i</var> varies from <var>i_0</var> to <var>i_1</var>.
The noun form <code>'product</code> is displayed as an uppercase letter pi.
</p>
<p><code>product</code> evaluates <var>expr</var> and lower and upper limits <var>i_0</var> and <var>i_1</var>,
<code>product</code> quotes (does not evaluate) the index <var>i</var>.
</p>
<p>If the upper and lower limits differ by an integer,
<var>expr</var> is evaluated for each value of the index <var>i</var>,
and the result is an explicit product.
</p>
<p>Otherwise, the range of the index is indefinite.
Some rules are applied to simplify the product.
When the global variable <code>simpproduct</code> is <code>true</code>, additional rules are applied.
In some cases, simplification yields a result which is not a product;
otherwise, the result is a noun form <code>'product</code>.
</p>
<p>See also <code>nouns</code> and <code>evflag</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) product (x + i*(i+1)/2, i, 1, 4);
(%o1) (x + 1) (x + 3) (x + 6) (x + 10)
(%i2) product (i^2, i, 1, 7);
(%o2) 25401600
(%i3) product (a[i], i, 1, 7);
(%o3) a a a a a a a
1 2 3 4 5 6 7
(%i4) product (a(i), i, 1, 7);
(%o4) a(1) a(2) a(3) a(4) a(5) a(6) a(7)
(%i5) product (a(i), i, 1, n);
n
/===\
! !
(%o5) ! ! a(i)
! !
i = 1
(%i6) product (k, k, 1, n);
n
/===\
! !
(%o6) ! ! k
! !
k = 1
(%i7) product (k, k, 1, n), simpproduct;
(%o7) n!
(%i8) product (integrate (x^k, x, 0, 1), k, 1, n);
n
/===\
! ! 1
(%o8) ! ! -----
! ! k + 1
k = 1
(%i9) product (if k <= 5 then a^k else b^k, k, 1, 10);
15 40
(%o9) a b
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>realpart</b><i> (<var>expr</var>)</i>
<a name="IDX176"></a>
</dt>
<dd><p>Returns the real part of <var>expr</var>. <code>realpart</code> and <code>imagpart</code> will
work on expressions involving trigonometic and hyperbolic functions,
as well as square root, logarithm, and exponentiation.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>rectform</b><i> (<var>expr</var>)</i>
<a name="IDX177"></a>
</dt>
<dd><p>Returns an expression <code>a + b %i</code> equivalent to <var>expr</var>,
such that <var>a</var> and <var>b</var> are purely real.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>rembox</b><i> (<var>expr</var>, unlabelled)</i>
<a name="IDX178"></a>
</dt>
<dt><u>Function:</u> <b>rembox</b><i> (<var>expr</var>, <var>label</var>)</i>
<a name="IDX179"></a>
</dt>
<dt><u>Function:</u> <b>rembox</b><i> (<var>expr</var>)</i>
<a name="IDX180"></a>
</dt>
<dd><p>Removes boxes from <var>expr</var>.
</p>
<p><code>rembox (<var>expr</var>, unlabelled)</code> removes all unlabelled boxes from <var>expr</var>.
</p>
<p><code>rembox (<var>expr</var>, <var>label</var>)</code> removes only boxes bearing <var>label</var>.
</p>
<p><code>rembox (<var>expr</var>)</code> removes all boxes, labelled and unlabelled.
</p>
<p>Boxes are drawn by the <code>box</code>, <code>dpart</code>, and <code>lpart</code> functions.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) expr: (a*d - b*c)/h^2 + sin(%pi*x);
a d - b c
(%o1) sin(%pi x) + ---------
2
h
(%i2) dpart (dpart (expr, 1, 1), 2, 2);
""""""" a d - b c
(%o2) sin("%pi x") + ---------
""""""" """"
" 2"
"h "
""""
(%i3) expr2: lpart (BAR, lpart (FOO, %, 1), 2);
FOO""""""""""" BAR""""""""
" """"""" " "a d - b c"
(%o3) "sin("%pi x")" + "---------"
" """"""" " " """" "
"""""""""""""" " " 2" "
" "h " "
" """" "
"""""""""""
(%i4) rembox (expr2, unlabelled);
BAR""""""""
FOO""""""""" "a d - b c"
(%o4) "sin(%pi x)" + "---------"
"""""""""""" " 2 "
" h "
"""""""""""
(%i5) rembox (expr2, FOO);
BAR""""""""
""""""" "a d - b c"
(%o5) sin("%pi x") + "---------"
""""""" " """" "
" " 2" "
" "h " "
" """" "
"""""""""""
(%i6) rembox (expr2, BAR);
FOO"""""""""""
" """"""" " a d - b c
(%o6) "sin("%pi x")" + ---------
" """"""" " """"
"""""""""""""" " 2"
"h "
""""
(%i7) rembox (expr2);
a d - b c
(%o7) sin(%pi x) + ---------
2
h
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>sum</b><i> (<var>expr</var>, <var>i</var>, <var>i_0</var>, <var>i_1</var>)</i>
<a name="IDX181"></a>
</dt>
<dd><p>Represents a summation of the values of <var>expr</var> as
the index <var>i</var> varies from <var>i_0</var> to <var>i_1</var>.
The noun form <code>'sum</code> is displayed as an uppercase letter sigma.
</p>
<p><code>sum</code> evaluates its summand <var>expr</var> and lower and upper limits <var>i_0</var> and <var>i_1</var>,
<code>sum</code> quotes (does not evaluate) the index <var>i</var>.
</p>
<p>If the upper and lower limits differ by an integer,
the summand <var>expr</var> is evaluated for each value of the summation index <var>i</var>,
and the result is an explicit sum.
</p>
<p>Otherwise, the range of the index is indefinite.
Some rules are applied to simplify the summation.
When the global variable <code>simpsum</code> is <code>true</code>, additional rules are applied.
In some cases, simplification yields a result which is not a summation;
otherwise, the result is a noun form <code>'sum</code>.
</p>
<p>When the <code>evflag</code> (evaluation flag) <code>cauchysum</code> is <code>true</code>,
a product of summations is expressed as a Cauchy product,
in which the index of the inner summation is a function of the
index of the outer one, rather than varying independently.
</p>
<p>The global variable <code>genindex</code> is the alphabetic prefix used to generate the next index of summation,
when an automatically generated index is needed.
</p>
<p><code>gensumnum</code> is the numeric suffix used to generate the next index of summation,
when an automatically generated index is needed.
When <code>gensumnum</code> is <code>false</code>, an automatically-generated index is only
<code>genindex</code> with no numeric suffix.
</p>
<p>See also <code>sumcontract</code>, <code>intosum</code>,
<code>bashindices</code>, <code>niceindices</code>,
<code>nouns</code>, <code>evflag</code>, and <code>zeilberger</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) sum (i^2, i, 1, 7);
(%o1) 140
(%i2) sum (a[i], i, 1, 7);
(%o2) a + a + a + a + a + a + a
7 6 5 4 3 2 1
(%i3) sum (a(i), i, 1, 7);
(%o3) a(7) + a(6) + a(5) + a(4) + a(3) + a(2) + a(1)
(%i4) sum (a(i), i, 1, n);
n
====
\
(%o4) > a(i)
/
====
i = 1
(%i5) sum (2^i + i^2, i, 0, n);
n
====
\ i 2
(%o5) > (2 + i )
/
====
i = 0
(%i6) sum (2^i + i^2, i, 0, n), simpsum;
3 2
n + 1 2 n + 3 n + n
(%o6) 2 + --------------- - 1
6
(%i7) sum (1/3^i, i, 1, inf);
inf
====
\ 1
(%o7) > --
/ i
==== 3
i = 1
(%i8) sum (1/3^i, i, 1, inf), simpsum;
1
(%o8) -
2
(%i9) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf);
inf
====
\ 1
(%o9) 30 > --
/ 2
==== i
i = 1
(%i10) sum (i^2, i, 1, 4) * sum (1/i^2, i, 1, inf), simpsum;
2
(%o10) 5 %pi
(%i11) sum (integrate (x^k, x, 0, 1), k, 1, n);
n
====
\ 1
(%o11) > -----
/ k + 1
====
k = 1
(%i12) sum (if k <= 5 then a^k else b^k, k, 1, 10));
Incorrect syntax: Too many )'s
else b^k, k, 1, 10))
^
(%i12) linenum:11;
(%o11) 11
(%i12) sum (integrate (x^k, x, 0, 1), k, 1, n);
n
====
\ 1
(%o12) > -----
/ k + 1
====
k = 1
(%i13) sum (if k <= 5 then a^k else b^k, k, 1, 10);
10 9 8 7 6 5 4 3 2
(%o13) b + b + b + b + b + a + a + a + a + a
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>lsum</b><i> (<var>expr</var>, <var>x</var>, <var>L</var>)</i>
<a name="IDX182"></a>
</dt>
<dd><p>Represents the sum of <var>expr</var> for each element <var>x</var> in <var>L</var>.
</p>
<p>A noun form <code>'lsum</code> is returned
if the argument <var>L</var> does not evaluate to a list.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) lsum (x^i, i, [1, 2, 7]);
7 2
(%o1) x + x + x
(%i2) lsum (i^2, i, rootsof (x^3 - 1));
====
\ 2
(%o2) > i
/
====
3
i in rootsof(x - 1)
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>verbify</b><i> (<var>f</var>)</i>
<a name="IDX183"></a>
</dt>
<dd><p>Returns the verb form of the function name <var>f</var>.
</p>
<p>See also <code>verb</code>, <code>noun</code>, and <code>nounify</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) verbify ('foo);
(%o1) foo
(%i2) :lisp $%
$FOO
(%i2) nounify (foo);
(%o2) foo
(%i3) :lisp $%
%FOO
</pre></td></tr></table>
</dd></dl>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC21" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_7.html#SEC31" 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_72.html#SEC264" 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>Robert Dodier</em> on <em>September, 20 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|