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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Maxima 5.47.0 Manual: Functions and Variables for Expressions</title>
<meta name="description" content="Maxima 5.47.0 Manual: Functions and Variables for Expressions">
<meta name="keywords" content="Maxima 5.47.0 Manual: Functions and Variables for Expressions">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="maxima_toc.html#Top" rel="start" title="Top">
<link href="maxima_423.html#Function-and-Variable-Index" rel="index" title="Function and Variable Index">
<link href="maxima_toc.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="maxima_28.html#Expressions" rel="up" title="Expressions">
<link href="maxima_34.html#Operators" rel="next" title="Operators">
<link href="maxima_32.html#Inequality" rel="previous" title="Inequality">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
body {color: black; background: white; margin-left: 8%; margin-right: 13%;
font-family: "FreeSans", sans-serif}
h1 {font-size: 150%; font-family: "FreeSans", sans-serif}
h2 {font-size: 125%; font-family: "FreeSans", sans-serif}
h3 {font-size: 100%; font-family: "FreeSans", sans-serif}
a[href] {color: rgb(0,0,255); text-decoration: none;}
a[href]:hover {background: rgb(220,220,220);}
div.textbox {border: solid; border-width: thin; 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);}
pre.example {border: 1px solid rgb(180,180,180); padding-top: 1em;
padding-bottom: 1em; padding-left: 1em; padding-right: 1em;
background-color: rgb(238,238,255)}
div.spacerbox {border: none; padding-top: 2em; padding-bottom: 2em}
div.image {margin: 0; padding: 1em; text-align: center}
div.categorybox {border: 1px solid gray; padding-top: 1em; padding-bottom: 1em;
padding-left: 1em; padding-right: 1em; background: rgb(247,242,220)}
img {max-width:80%; max-height: 80%; display: block; margin-left: auto; margin-right: auto}
-->
</style>
<link rel="icon" href="figures/favicon.ico">
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6>"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Functions-and-Variables-for-Expressions"></a>
<div class="header">
<p>
Previous: <a href="maxima_32.html#Inequality" accesskey="p" rel="previous">Inequality</a>, Up: <a href="maxima_28.html#Expressions" accesskey="u" rel="up">Expressions</a> [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-and-Variables-for-Expressions-1"></a>
<h3 class="section">6.5 Functions and Variables for Expressions</h3>
<a name="alias"></a><a name="Item_003a-Expressions_002fdeffn_002falias"></a><dl>
<dt><a name="index-alias"></a>Function: <strong>alias</strong> <em>(<var>new_name_1</var>, <var>old_name_1</var>, …, <var>new_name_n</var>, <var>old_name_n</var>)</em></dt>
<dd>
<p>provides an alternate name for a (user or system) function, variable, array,
etc. Any even number of arguments may be used.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Declarations-and-inferences">Declarations and inferences</a>
·</div></dd></dl>
<a name="aliases"></a><a name="Item_003a-Expressions_002fdefvr_002faliases"></a><dl>
<dt><a name="index-aliases"></a>System variable: <strong>aliases</strong></dt>
<dd><p>Default value: <code>[]</code>
</p>
<p><code>aliases</code> is the list of atoms which have a user defined alias (set up by
the <code><a href="#alias">alias</a></code>, <code><a href="#ordergreat">ordergreat</a></code>, <code><a href="#orderless">orderless</a></code> functions or by
declaring the atom a <code><a href="#noun">noun</a></code> with <code><a href="maxima_62.html#declare">declare</a></code>.)
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Declarations-and-inferences">Declarations and inferences</a>
·<a href="maxima_424.html#Category_003a-Global-variables">Global variables</a>
·</div></dd></dl>
<a name="allbut"></a><a name="Item_003a-Expressions_002fdefvr_002fallbut"></a><dl>
<dt><a name="index-allbut"></a>Keyword: <strong>allbut</strong></dt>
<dd>
<p>works with the <code>part</code> commands (i.e. <code><a href="#part">part</a></code>,<!-- /@w -->
<code><a href="#inpart">inpart</a></code>, <code><a href="#substpart">substpart</a></code>, <code><a href="#substinpart">substinpart</a></code>,<!-- /@w -->
<code><a href="#dpart">dpart</a></code>, and <code><a href="#lpart">lpart</a></code>).
For example,
</p>
<div class="example">
<pre class="example">(%i1) expr : e + d + c + b + a;
(%o1) e + d + c + b + a
</pre><pre class="example">(%i2) part (expr, [2, 5]);
(%o2) d + a
</pre></div>
<p>while
</p>
<div class="example">
<pre class="example">(%i1) expr : e + d + c + b + a;
(%o1) e + d + c + b + a
</pre><pre class="example">(%i2) part (expr, allbut (2, 5));
(%o2) e + c + b
</pre></div>
<p><code>allbut</code> is also recognized by <code><a href="maxima_8.html#kill">kill</a></code>.
</p>
<div class="example">
<pre class="example">(%i1) [aa : 11, bb : 22, cc : 33, dd : 44, ee : 55];
(%o1) [11, 22, 33, 44, 55]
</pre><pre class="example">(%i2) kill (allbut (cc, dd));
(%o0) done
</pre><pre class="example">(%i1) [aa, bb, cc, dd];
(%o1) [aa, bb, 33, 44]
</pre></div>
<p><code>kill(allbut(<var>a_1</var>, <var>a_2</var>, ...))</code> has the effect of
<code>kill(all)</code> except that it does not kill the symbols <var>a_1</var>, <var>a_2</var>,
…
</p></dd></dl>
<a name="args"></a><a name="Item_003a-Expressions_002fdeffn_002fargs"></a><dl>
<dt><a name="index-args"></a>Function: <strong>args</strong> <em>(<var>expr</var>)</em></dt>
<dd>
<p>Returns the list of arguments of <code>expr</code>, which may be any kind of
expression other than an atom. Only the arguments of the top-level operator
are extracted; subexpressions of <code>expr</code> appear as elements or
subexpressions of elements of the list of arguments.
</p>
<p>The order of the items in the list may depend on the global flag
<code><a href="#inflag">inflag</a></code>.
</p>
<p><code>args (<var>expr</var>)</code> is equivalent to <code>substpart ("[", <var>expr</var>, 0)</code>.
See also <code><a href="#substpart">substpart</a></code>, <code><a href="maxima_170.html#apply">apply</a></code>, <code><a href="maxima_170.html#funmake">funmake</a></code>, and <code><a href="#op">op</a></code>.
</p>
<p>How to convert a matrix to a nested list:
</p>
<div class="example">
<pre class="example">(%i1) M:matrix([1,2],[3,4]);
[ 1 2 ]
(%o1) [ ]
[ 3 4 ]
</pre><pre class="example">(%i2) args(M);
(%o2) [[1, 2], [3, 4]]
</pre></div>
<p>Since maxima internally treats a sum of <code>n</code> terms as a summation command
with <code>n</code> arguments args() can extract the list of terms in a sum:
</p>
<div class="example">
<pre class="example">(%i1) a+b+c;
(%o1) c + b + a
</pre><pre class="example">(%i2) args(%);
(%o2) [c, b, a]
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="atom"></a><a name="Item_003a-Expressions_002fdeffn_002fatom"></a><dl>
<dt><a name="index-atom"></a>Function: <strong>atom</strong> <em>(<var>expr</var>)</em></dt>
<dd>
<p>Returns <code>true</code> if <var>expr</var> is atomic (i.e. a number, name or string) else
<code>false</code>. Thus <code>atom(5)</code> is <code>true</code> while <code>atom(a[1])</code> and
<code>atom(sin(x))</code> are <code>false</code> (assuming <code>a[1]</code> and <code>x</code> are
unbound).
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·<a href="maxima_424.html#Category_003a-Predicate-functions">Predicate functions</a>
·</div></dd></dl>
<a name="box"></a><a name="Item_003a-Expressions_002fdeffn_002fbox"></a><dl>
<dt><a name="index-box"></a>Function: <strong>box</strong> <em><br> <tt>box</tt> (<var>expr</var>) <br> <tt>box</tt> (<var>expr</var>, <var>a</var>)</em></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><a href="maxima_9.html#display2d">display2d</a></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. <code><a href="#rembox">rembox</a></code> removes the box again.
</p>
<p><code><a href="#boxchar">boxchar</a></code> is the character used to draw the box in <code>box</code> and in the
<code><a href="#dpart">dpart</a></code> and <code><a href="#lpart">lpart</a></code> functions.
</p>
<p>See also <code><a href="#rembox">rembox</a></code>, <code><a href="#dpart">dpart</a></code> and <code><a href="#lpart">lpart</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) box (a^2 + b^2);
"""""""""
" 2 2"
(%o1) "b + a "
"""""""""
</pre><pre class="example">(%i2) a : 1234;
(%o2) 1234
</pre><pre class="example">(%i3) b : c - d;
(%o3) c - d
</pre><pre class="example">(%i4) box (a^2 + b^2);
""""""""""""""""""""
" 2 "
(%o4) "(c - d) + 1522756"
""""""""""""""""""""
</pre><pre class="example">(%i5) box (a^2 + b^2, term_1);
term_1""""""""""""""
" 2 "
(%o5) "(c - d) + 1522756"
""""""""""""""""""""
</pre><pre class="example">(%i6) 1729 - box (1729);
""""""
(%o6) 1729 - "1729"
""""""
</pre><pre class="example">(%i7) boxchar: "-";
(%o7) -
</pre><pre class="example">(%i8) box (sin(x) + cos(y));
-----------------
(%o8) -cos(y) + sin(x)-
-----------------
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="boxchar"></a><a name="Item_003a-Expressions_002fdefvr_002fboxchar"></a><dl>
<dt><a name="index-boxchar"></a>Option variable: <strong>boxchar</strong></dt>
<dd><p>Default value: <code>"</code>
</p>
<p><code>boxchar</code> is the character used to draw the box in the <code><a href="#box">box</a></code><!-- /@w -->
and in the <code><a href="#dpart">dpart</a></code> and <code><a href="#lpart">lpart</a></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="collapse"></a><a name="Item_003a-Expressions_002fdeffn_002fcollapse"></a><dl>
<dt><a name="index-collapse"></a>Function: <strong>collapse</strong> <em>(<var>expr</var>)</em></dt>
<dd>
<p>Collapses <var>expr</var> by causing all of its common (i.e., equal) subexpressions
to share (i.e., use the same cells), thereby saving space. (<code>collapse</code> is
a subroutine used by the <code><a href="#optimize">optimize</a></code> command.) Thus, calling
<code>collapse</code> may be useful after loading in a <code><a href="maxima_75.html#save">save</a></code> file. You can
collapse several expressions together by using
<code>collapse ([<var>expr_1</var>, ..., <var>expr_n</var>])</code>. Similarly, you can
collapse the elements of the array <code>A</code> by doing
<code>collapse (listarray ('A))</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="copy"></a><a name="Item_003a-Expressions_002fdeffn_002fcopy"></a><dl>
<dt><a name="index-copy"></a>Function: <strong>copy</strong> <em>(<var>e</var>)</em></dt>
<dd>
<p>Return a copy of the Maxima expression <var>e</var>. Although <var>e</var> can be any
Maxima expression, the copy function is the most useful when <var>e</var> is either
a list or a matrix; consider:
</p>
<div class="example">
<pre class="example">(%i1) m : [1,[2,3]]$
(%i2) mm : m$
(%i3) mm[2][1] : x$
</pre><pre class="example">(%i4) m;
(%o4) [1, [x, 3]]
</pre><pre class="example">(%i5) mm;
(%o5) [1, [x, 3]]
</pre></div>
<p>Let’s try the same experiment, but this time let <var>mm</var> be a copy of <var>m</var>
</p>
<div class="example">
<pre class="example">(%i1) m : [1,[2,3]]$
(%i2) mm : copy(m)$
(%i3) mm[2][1] : x$
</pre><pre class="example">(%i4) m;
(%o4) [1, [2, 3]]
</pre><pre class="example">(%i5) mm;
(%o5) [1, [x, 3]]
</pre></div>
<p>This time, the assignment to <var>mm</var> does not change the value of <var>m</var>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="disolate"></a><a name="Item_003a-Expressions_002fdeffn_002fdisolate"></a><dl>
<dt><a name="index-disolate"></a>Function: <strong>disolate</strong> <em>(<var>expr</var>, <var>x_1</var>, …, <var>x_n</var>)</em></dt>
<dd>
<p>is similar to <code><a href="#isolate">isolate</a></code><code> (<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 <samp>simplification/disol.mac</samp>.
A demo is available by <code>demo("disol")$</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="dispform"></a><a name="Item_003a-Expressions_002fdeffn_002fdispform"></a><dl>
<dt><a name="index-dispform"></a>Function: <strong>dispform</strong> <em><br> <tt>dispform</tt> (<var>expr</var>) <br> <tt>dispform</tt> (<var>expr</var>, all)</em></dt>
<dd>
<p>Returns the external representation of <var>expr</var>.
</p>
<p><code>dispform(<var>expr</var>)</code> returns the external representation with respect to
the main (top-level) operator. <code>dispform(<var>expr</var>, all)</code> returns the
external representation with respect to all operators in <var>expr</var>.
</p>
<p>See also <code><a href="#part">part</a></code>, <code><a href="#inpart">inpart</a></code>, and <code><a href="#inflag">inflag</a></code>.
</p>
<p>Examples:
</p>
<p>The internal representation of <code>- x</code> is "negative one times <code>x</code>"
while the external representation is "minus <code>x</code>".
</p>
<div class="example">
<pre class="example">(%i1) - x;
(%o1) - x
</pre><pre class="example">(%i2) ?format (true, "~S~%", %);
((MTIMES SIMP) -1 $X)
(%o2) false
</pre><pre class="example">(%i3) dispform (- x);
(%o3) - x
</pre><pre class="example">(%i4) ?format (true, "~S~%", %);
((MMINUS SIMP) $X)
(%o4) false
</pre></div>
<p>The internal representation of <code>sqrt(x)</code> is "<code>x</code> to the power 1/2"
while the external representation is "square root of <code>x</code>".
</p>
<div class="example">
<pre class="example">(%i1) sqrt (x);
(%o1) sqrt(x)
</pre><pre class="example">(%i2) ?format (true, "~S~%", %);
((MEXPT SIMP) $X ((RAT SIMP) 1 2))
(%o2) false
</pre><pre class="example">(%i3) dispform (sqrt (x));
(%o3) sqrt(x)
</pre><pre class="example">(%i4) ?format (true, "~S~%", %);
((%SQRT SIMP) $X)
(%o4) false
</pre></div>
<p>Use of the optional argument <code>all</code>.
</p>
<div class="example">
<pre class="example">(%i1) expr : sin (sqrt (x));
(%o1) sin(sqrt(x))
</pre><pre class="example">(%i2) freeof (sqrt, expr);
(%o2) true
</pre><pre class="example">(%i3) freeof (sqrt, dispform (expr));
(%o3) true
</pre><pre class="example">(%i4) freeof (sqrt, dispform (expr, all));
(%o4) false
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="dpart"></a><a name="Item_003a-Expressions_002fdeffn_002fdpart"></a><dl>
<dt><a name="index-dpart"></a>Function: <strong>dpart</strong> <em>(<var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></dt>
<dd>
<p>Selects the same subexpression as <code><a href="#part">part</a></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>
<div class="example">
<pre class="example">(%i1) dpart (x+y/z^2, 1, 2, 1);
y
(%o1) ---- + x
2
"""
"z"
"""
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="exptisolate"></a><a name="Item_003a-Expressions_002fdefvr_002fexptisolate"></a><dl>
<dt><a name="index-exptisolate"></a>Option variable: <strong>exptisolate</strong></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="exptsubst"></a><a name="Item_003a-Expressions_002fdefvr_002fexptsubst"></a><dl>
<dt><a name="index-exptsubst"></a>Option variable: <strong>exptsubst</strong></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>
<div class="example">
<pre class="example">(%i1) %e^(a*x);
a x
(%o1) %e
</pre><pre class="example">(%i2) exptsubst;
(%o2) false
</pre><pre class="example">(%i3) subst(y, %e^x, %e^(a*x));
a x
(%o3) %e
</pre><pre class="example">(%i4) exptsubst: not exptsubst;
(%o4) true
</pre><pre class="example">(%i5) subst(y, %e^x, %e^(a*x));
a
(%o5) y
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Exponential-and-logarithm-functions">Exponential and logarithm functions</a>
·<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="freeof"></a><a name="Item_003a-Expressions_002fdeffn_002ffreeof"></a><dl>
<dt><a name="index-freeof"></a>Function: <strong>freeof</strong> <em>(<var>x_1</var>, …, <var>x_n</var>, <var>expr</var>)</em></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>, or if <var>x_1</var> is neither the noun nor verb form of any operator
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><a href="maxima_99.html#limit">limit</a></code>, the integration variable
in the definite integral form of <code><a href="maxima_104.html#integrate">integrate</a></code>, the original variable in
<code><a href="maxima_104.html#laplace">laplace</a></code>, formal variables in <code><a href="maxima_101.html#at">at</a></code> expressions, and arguments in
<code><a href="maxima_170.html#lambda">lambda</a></code> expressions.
</p>
<p>The indefinite form of <code>integrate</code> is <i>not</i> free of its variable of
integration.
</p>
<p>Examples:
</p>
<p>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>.
</p>
<div class="example">
<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></div>
<p><code>freeof</code> evaluates its arguments.
</p>
<div class="example">
<pre class="example">(%i1) expr: (a+b)^5$
(%i2) c: a$
(%i3) freeof (c, expr);
(%o3) false
</pre></div>
<p><code>freeof</code> does not consider equivalent expressions.
Simplification may yield an equivalent but different expression.
</p>
<div class="example">
<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></div>
<p>A summation or definite integral is free of its dummy variable.
An indefinite integral is not free of its variable of integration.
</p>
<div class="example">
<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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="inflag"></a><a name="Item_003a-Expressions_002fdefvr_002finflag"></a><dl>
<dt><a name="index-inflag"></a>Option variable: <strong>inflag</strong></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><a href="#part">part</a></code> or
<code><a href="#substpart">substpart</a></code> is the same as calling <code><a href="#inpart">inpart</a></code> or <code><a href="#substinpart">substinpart</a></code>.
</p>
<p>Functions affected by the setting of <code>inflag</code> are: <code><a href="#part">part</a></code>,<!-- /@w -->
<code><a href="#substpart">substpart</a></code>, <code><a href="maxima_21.html#first">first</a></code>, <code><a href="maxima_21.html#rest">rest</a></code>, <code><a href="maxima_21.html#last">last</a></code>,<!-- /@w -->
<code><a href="maxima_21.html#length">length</a></code>, the <code><a href="maxima_175.html#for">for</a></code> … <code>in</code> construct,
<code><a href="maxima_175.html#map">map</a></code>, <code><a href="maxima_170.html#fullmap">fullmap</a></code>, <code><a href="maxima_175.html#maplist">maplist</a></code>, <code><a href="#reveal">reveal</a></code> and
<code><a href="#pickapart">pickapart</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="inpart"></a><a name="Item_003a-Expressions_002fdeffn_002finpart"></a><dl>
<dt><a name="index-inpart"></a>Function: <strong>inpart</strong> <em>(<var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></dt>
<dd>
<p>is similar to <code><a href="#part">part</a></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>
<div class="example">
<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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="isolate"></a><a name="Item_003a-Expressions_002fdeffn_002fisolate"></a><dl>
<dt><a name="index-isolate"></a>Function: <strong>isolate</strong> <em>(<var>expr</var>, <var>x</var>)</em></dt>
<dd>
<p>Returns <var>expr</var> with subexpressions which are sums and which do not contain
<var>var</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><a href="#exptisolate">exptisolate</a></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>var</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><a href="#isolate_005fwrt_005ftimes">isolate_wrt_times</a></code>. See also <code><a href="#disolate">disolate</a></code>.
</p>
<p>Do <code>example (isolate)</code> for examples.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="isolate_005fwrt_005ftimes"></a><a name="Item_003a-Expressions_002fdefvr_002fisolate_005fwrt_005ftimes"></a><dl>
<dt><a name="index-isolate_005fwrt_005ftimes"></a>Option variable: <strong>isolate_wrt_times</strong></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>
<div class="example">
<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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="listconstvars"></a><a name="Item_003a-Expressions_002fdefvr_002flistconstvars"></a><dl>
<dt><a name="index-listconstvars"></a>Option variable: <strong>listconstvars</strong></dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>listconstvars</code> is <code>true</code> the list returned by
<code>listofvars</code> contains constant variables, such as <code>%e</code>,
<code>%pi</code>, <code>%i</code> or any variables declared as constant that
occur in <var>expr</var>. A variable is declared as <code>constant</code>
type via <code><a href="maxima_62.html#declare">declare</a></code>, and <code><a href="maxima_62.html#constantp">constantp</a></code> returns <code>true</code>
for all variables declared as <code>constant</code>. The default is to
omit constant variables from <code>listofvars</code> return value.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="listdummyvars"></a><a name="Item_003a-Expressions_002fdefvr_002flistdummyvars"></a><dl>
<dt><a name="index-listdummyvars"></a>Option variable: <strong>listdummyvars</strong></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><a href="#listofvars">listofvars</a></code>. (The meaning
of "dummy variables" is as given in <code><a href="#freeof">freeof</a></code>. "Dummy variables" are
mathematical things like the index of a sum or product, the limit variable,
and the definite integration variable.)
</p>
<p>Example:
</p>
<div class="example">
<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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="listofvars"></a><a name="Item_003a-Expressions_002fdeffn_002flistofvars"></a><dl>
<dt><a name="index-listofvars"></a>Function: <strong>listofvars</strong> <em>(<var>expr</var>)</em></dt>
<dd>
<p>Returns a list of the variables in <var>expr</var>.
</p>
<p><code><a href="#listconstvars">listconstvars</a></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>
<p>See also the option variable <code><a href="#listdummyvars">listdummyvars</a></code> to exclude or include
"dummy variables" in the list of variables.
</p>
<div class="example">
<pre class="example">(%i1) listofvars (f (x[1]+y) / g^(2+a));
(%o1) [g, a, x , y]
1
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="lfreeof"></a><a name="Item_003a-Expressions_002fdeffn_002flfreeof"></a><dl>
<dt><a name="index-lfreeof"></a>Function: <strong>lfreeof</strong> <em>(<var>list</var>, <var>expr</var>)</em></dt>
<dd>
<p>For each member <var>m</var> of <var>list</var>, calls
<code>freeof (<var>m</var>, <var>expr</var>)</code>. It returns <code>false</code> if any call to
<code><a href="#freeof">freeof</a></code> does and <code>true</code> otherwise.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) lfreeof ([ a, x], x^2+b);
(%o1) false
</pre><pre class="example">(%i2) lfreeof ([ b, x], x^2+b);
(%o2) false
</pre><pre class="example">(%i3) lfreeof ([ a, y], x^2+b);
(%o3) true
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="lpart"></a><a name="Item_003a-Expressions_002fdeffn_002flpart"></a><dl>
<dt><a name="index-lpart"></a>Function: <strong>lpart</strong> <em>(<var>label</var>, <var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></dt>
<dd>
<p>is similar to <code><a href="#dpart">dpart</a></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="mainvar"></a><a name="Item_003a-Expressions_002fdefvr_002fmainvar"></a><dl>
<dt><a name="index-mainvar"></a>Property: <strong>mainvar</strong></dt>
<dd>
<p>You may declare variables to be <code>mainvar</code>. The ordering scale for atoms is
essentially: numbers <code><</code> constants (e.g., <code>%e</code>, <code>%pi</code>) <code><</code> scalars <code><</code> other
variables <code><</code> mainvars. E.g., compare <code>expand ((X+Y)^4)</code> with
<code>(declare (x, mainvar), expand ((x+y)^4))</code>. (Note: Care should be taken if
you elect to use the above feature. E.g., if you subtract an expression in
which <code>x</code> is a <code>mainvar</code> from one in which <code>x</code> isn’t a
<code>mainvar</code>, resimplification e.g. with <code>ev (expr, simp)</code> may be
necessary if cancellation is to occur. Also, if you save an expression in which
<code>x</code> is a <code>mainvar</code>, you probably should also save <code>x</code>.)
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Declarations-and-inferences">Declarations and inferences</a>
·<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="noun"></a><a name="Item_003a-Expressions_002fdefvr_002fnoun"></a><dl>
<dt><a name="index-noun"></a>Property: <strong>noun</strong></dt>
<dd>
<p><code>noun</code> is one of the options of the <code><a href="maxima_62.html#declare">declare</a></code> command. It makes a
function so declared a "noun", meaning that it won’t be evaluated
automatically.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) factor (12345678);
2
(%o1) 2 3 47 14593
</pre><pre class="example">(%i2) declare (factor, noun);
(%o2) done
</pre><pre class="example">(%i3) factor (12345678);
(%o3) factor(12345678)
</pre><pre class="example">(%i4) ''%, nouns;
2
(%o4) 2 3 47 14593
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Nouns-and-verbs">Nouns and verbs</a>
·</div></dd></dl>
<a name="noundisp"></a><a name="Item_003a-Expressions_002fdefvr_002fnoundisp"></a><dl>
<dt><a name="index-noundisp"></a>Option variable: <strong>noundisp</strong></dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>noundisp</code> is <code>true</code>, nouns display with
a single quote. This switch is always <code>true</code> when displaying function
definitions.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Display-flags-and-variables">Display flags and variables</a>
·<a href="maxima_424.html#Category_003a-Nouns-and-verbs">Nouns and verbs</a>
·</div></dd></dl>
<a name="nounify"></a><a name="Item_003a-Expressions_002fdeffn_002fnounify"></a><dl>
<dt><a name="index-nounify"></a>Function: <strong>nounify</strong> <em>(<var>f</var>)</em></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>
<p>See also <code><a href="#verbify">verbify</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Nouns-and-verbs">Nouns and verbs</a>
·</div></dd></dl>
<a name="nterms"></a><a name="Item_003a-Expressions_002fdeffn_002fnterms"></a><dl>
<dt><a name="index-nterms"></a>Function: <strong>nterms</strong> <em>(<var>expr</var>)</em></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="op"></a><a name="Item_003a-Expressions_002fdeffn_002fop"></a><dl>
<dt><a name="index-op"></a>Function: <strong>op</strong> <em>(<var>expr</var>)</em></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, if <var>expr</var> is a subscripted function expression, <code>op</code>
returns the subscripted function; in this case the return value is not an atom.
Otherwise, <var>expr</var> is a <code><a href="maxima_168.html#memoizing-function">memoizing function</a></code> or ordinary function expression,
and <code>op</code> returns a symbol.
</p>
<p><code>op</code> observes the value of the global flag <code><a href="#inflag">inflag</a></code>.
</p>
<p><code>op</code> evaluates it argument.
</p>
<p>See also <code><a href="#args">args</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) stringdisp: true$
</pre><pre class="example">(%i2) op (a * b * c);
(%o2) "*"
</pre><pre class="example">(%i3) op (a * b + c);
(%o3) "+"
</pre><pre class="example">(%i4) op ('sin (a + b));
(%o4) sin
</pre><pre class="example">(%i5) op (a!);
(%o5) "!"
</pre><pre class="example">(%i6) op (-a);
(%o6) "-"
</pre><pre class="example">(%i7) op ([a, b, c]);
(%o7) "["
</pre><pre class="example">(%i8) op ('(if a > b then c else d));
(%o8) "if"
</pre><pre class="example">(%i9) op ('foo (a));
(%o9) foo
</pre><pre class="example">(%i10) prefix (foo);
(%o10) "foo"
</pre><pre class="example">(%i11) op (foo a);
(%o11) "foo"
</pre><pre class="example">(%i12) op (F [x, y] (a, b, c));
(%o12) F
x, y
</pre><pre class="example">(%i13) op (G [u, v, w]);
(%o13) G
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·<a href="maxima_424.html#Category_003a-Operators">Operators</a>
·</div></dd></dl>
<a name="operatorp"></a><a name="Item_003a-Expressions_002fdeffn_002foperatorp"></a><dl>
<dt><a name="index-operatorp"></a>Function: <strong>operatorp</strong> <em><br> <tt>operatorp</tt> (<var>expr</var>, <var>op</var>) <br> <tt>operatorp</tt> (<var>expr</var>, [<var>op_1</var>, …, <var>op_n</var>])</em></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Operators">Operators</a>
·<a href="maxima_424.html#Category_003a-Predicate-functions">Predicate functions</a>
·</div></dd></dl>
<a name="option_005fopsubst"></a><a name="Item_003a-Expressions_002fdefvr_002fopsubst"></a><dl>
<dt><a name="index-opsubst-1"></a>Option variable: <strong>opsubst</strong></dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>opsubst</code> is <code>false</code>, <code><a href="#subst">subst</a></code> does not attempt to
substitute into the operator of an expression. E.g.,
<code>(opsubst: false, subst (x^2, r, r+r[0]))</code> will work.
</p>
<div class="example">
<pre class="example">(%i1) r+r[0];
(%o1) r + r
0
</pre><pre class="example">(%i2) opsubst;
(%o2) true
</pre><pre class="example">(%i3) subst (x^2, r, r+r[0]);
2 2
(%o3) x + (x )
0
</pre><pre class="example">(%i4) opsubst: not opsubst;
(%o4) false
</pre><pre class="example">(%i5) subst (x^2, r, r+r[0]);
2
(%o5) x + r
0
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="optimize"></a><a name="Item_003a-Expressions_002fdeffn_002foptimize"></a><dl>
<dt><a name="index-optimize"></a>Function: <strong>optimize</strong> <em>(<var>expr</var>)</em></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="optimprefix"></a><a name="Item_003a-Expressions_002fdefvr_002foptimprefix"></a><dl>
<dt><a name="index-optimprefix"></a>Option variable: <strong>optimprefix</strong></dt>
<dd><p>Default value: <code>%</code>
</p>
<p><code>optimprefix</code> is the prefix used for generated symbols by
the <code><a href="#optimize">optimize</a></code> command.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="ordergreat"></a><a name="orderless"></a><a name="Item_003a-Expressions_002fdeffn_002fordergreat"></a><dl>
<dt><a name="index-ordergreat"></a>Function: <strong>ordergreat</strong> <em>(<var>v_1</var>, …, <var>v_n</var>)</em></dt>
<dd><a name="Item_003a-Expressions_002fdeffn_002forderless"></a></dd><dt><a name="index-orderless"></a>Function: <strong>orderless</strong> <em>(<var>v_1</var>, …, <var>v_n</var>)</em></dt>
<dd>
<p><code>ordergreat</code> changes the canonical ordering of Maxima expressions
such that <var>v_1</var> succeeds <var>v_2</var> succeeds … succeeds <var>v_n</var>,
and <var>v_n</var> succeeds any other symbol not mentioned as an argument.
</p>
<p><code>orderless</code> changes the canonical ordering of Maxima expressions
such that <var>v_1</var> precedes <var>v_2</var> precedes … precedes <var>v_n</var>,
and <var>v_n</var> precedes any other variable not mentioned as an argument.
</p>
<p>The order established by <code>ordergreat</code> and <code>orderless</code> is dissolved
by <code><a href="#unorder">unorder</a></code>. <code>ordergreat</code> and <code>orderless</code> can be called only
once each, unless <code>unorder</code> is called; only the last call to
<code>ordergreat</code> and <code>orderless</code> has any effect.
</p>
<p>See also <code><a href="#ordergreatp">ordergreatp</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="ordergreatp"></a><a name="orderlessp"></a><a name="Item_003a-Expressions_002fdeffn_002fordergreatp"></a><dl>
<dt><a name="index-ordergreatp"></a>Function: <strong>ordergreatp</strong> <em>(<var>expr_1</var>, <var>expr_2</var>)</em></dt>
<dd><a name="Item_003a-Expressions_002fdeffn_002forderlessp"></a></dd><dt><a name="index-orderlessp"></a>Function: <strong>orderlessp</strong> <em>(<var>expr_1</var>, <var>expr_2</var>)</em></dt>
<dd>
<p><code>ordergreatp</code> returns <code>true</code> if <var>expr_1</var> succeeds <var>expr_2</var> in
the canonical ordering of Maxima expressions, and <code>false</code> otherwise.
</p>
<p><code>orderlessp</code> returns <code>true</code> if <var>expr_1</var> precedes <var>expr_2</var> in
the canonical ordering of Maxima expressions, and <code>false</code> otherwise.
</p>
<p>All Maxima atoms and expressions are comparable under <code>ordergreatp</code> and
<code>orderlessp</code>, although there are isolated examples of expressions for which
these predicates are not transitive; that is a bug.
</p>
<p>The canonical ordering of atoms (symbols, literal numbers, and strings) is the
following.
</p>
<p>(integers and floats) precede (bigfloats) precede
(declared constants) precede (strings) precede (declared scalars)
precede (first argument to <code><a href="#orderless">orderless</a></code>) precedes … precedes
(last argument to <code>orderless</code>) precedes (other symbols) precede
(last argument to <code><a href="#ordergreat">ordergreat</a></code>) precedes … precedes
(first argument to <code>ordergreat</code>) precedes (declared main variables)
</p>
<p>For non-atomic expressions, the canonical ordering is derived from the ordering
for atoms. For the built-in <code>+</code> <code>*</code> and <code>^</code> operators,
the ordering is not easily summarized. For other built-in operators and all
other functions and operators, expressions are ordered by their arguments
(beginning with the first argument), then by the name of the operator or
function. In the case of subscripted expressions, the subscripted symbol is
considered the operator and the subscript is considered an argument.
</p>
<p>The canonical ordering of expressions is modified by the functions
<code><a href="#ordergreat">ordergreat</a></code> and <code><a href="#orderless">orderless</a></code>, and the <code><a href="#mainvar">mainvar</a></code>,<!-- /@w -->
<code><a href="maxima_62.html#constant">constant</a></code>, and <code>scalar</code> declarations.
</p>
<p>See also <code><a href="maxima_21.html#sort">sort</a></code>.
</p>
<p>Examples:
</p>
<p>Ordering ordinary symbols and constants.
Note that <code>%pi</code> is not ordered according to its numerical value.
</p>
<div class="example">
<pre class="example">(%i1) stringdisp : true;
(%o1) true
</pre><pre class="example">(%i2) sort ([%pi, 3b0, 3.0, x, X, "foo", 3, a, 4, "bar", 4.0, 4b0]);
(%o2) [3, 3.0, 4, 4.0, 3.0b0, 4.0b0, %pi, "bar", "foo", X, a, x]
</pre></div>
<p>Effect of <code>ordergreat</code> and <code>orderless</code> functions.
</p>
<div class="example">
<pre class="example">(%i1) sort ([M, H, K, T, E, W, G, A, P, J, S]);
(%o1) [A, E, G, H, J, K, M, P, S, T, W]
</pre><pre class="example">(%i2) ordergreat (S, J);
(%o2) done
</pre><pre class="example">(%i3) orderless (M, H);
(%o3) done
</pre><pre class="example">(%i4) sort ([M, H, K, T, E, W, G, A, P, J, S]);
(%o4) [M, H, A, E, G, K, P, T, W, J, S]
</pre></div>
<p>Effect of <code>mainvar</code>, <code>constant</code>, and <code>scalar</code> declarations.
</p>
<div class="example">
<pre class="example">(%i1) sort ([aa, foo, bar, bb, baz, quux, cc, dd, A1, B1, C1]);
(%o1) [A1, B1, C1, aa, bar, baz, bb, cc, dd, foo, quux]
</pre><pre class="example">(%i2) declare (aa, mainvar);
(%o2) done
</pre><pre class="example">(%i3) declare ([baz, quux], constant);
(%o3) done
</pre><pre class="example">(%i4) declare ([A1, B1], scalar);
(%o4) done
</pre><pre class="example">(%i5) sort ([aa, foo, bar, bb, baz, quux, cc, dd, A1, B1, C1]);
(%o5) [baz, quux, A1, B1, C1, bar, bb, cc, dd, foo, aa]
</pre></div>
<p>Ordering non-atomic expressions.
</p>
<div class="example">
<pre class="example">(%i1) sort ([1, 2, n, f(1), f(2), f(2, 1), g(1), g(1, 2), g(n),
f(n, 1)]);
(%o1) [1, 2, f(1), g(1), g(1, 2), f(2), f(2, 1), n, g(n),
f(n, 1)]
</pre><pre class="example">(%i2) sort ([foo(1), X[1], X[k], foo(k), 1, k]);
(%o2) [1, X , foo(1), k, X , foo(k)]
1 k
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·<a href="maxima_424.html#Category_003a-Predicate-functions">Predicate functions</a>
·</div></dd></dl>
<a name="part"></a><a name="Item_003a-Expressions_002fdeffn_002fpart"></a><dl>
<dt><a name="index-part"></a>Function: <strong>part</strong> <em>(<var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></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>. If no indices are specified <code>expr</code> is returned.
</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 <code>part</code> 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><a href="#piece">piece</a></code> 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 as shown below.
</p>
<p>If <code><a href="#partswitch">partswitch</a></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>See also <code><a href="#inpart">inpart</a></code>, <code><a href="#substpart">substpart</a></code>, <code><a href="#substinpart">substinpart</a></code>,<!-- /@w -->
<code><a href="#dpart">dpart</a></code>, and <code><a href="#lpart">lpart</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) part(z+2*y+a,2);
(%o1) 2 y
</pre><pre class="example">(%i2) part(z+2*y+a,[1,3]);
(%o2) z + a
</pre><pre class="example">(%i3) part(z+2*y+a,2,1);
(%o3) 2
</pre></div>
<p><code>example (part)</code> displays additional examples.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="partition"></a><a name="Item_003a-Expressions_002fdeffn_002fpartition"></a><dl>
<dt><a name="index-partition"></a>Function: <strong>partition</strong> <em>(<var>expr</var>, <var>x</var>)</em></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>x</var> and, (2) the factors, terms,
or list which do.
</p>
<p>Examples:
</p>
<div class="example">
<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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="partswitch"></a><a name="Item_003a-Expressions_002fdefvr_002fpartswitch"></a><dl>
<dt><a name="index-partswitch"></a>Option variable: <strong>partswitch</strong></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>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="pickapart"></a><a name="Item_003a-Expressions_002fdeffn_002fpickapart"></a><dl>
<dt><a name="index-pickapart"></a>Function: <strong>pickapart</strong> <em>(<var>expr</var>, <var>n</var>)</em></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><a href="#part">part</a></code>, <code><a href="#dpart">dpart</a></code>, <code><a href="#lpart">lpart</a></code>,<!-- /@w -->
<code><a href="#inpart">inpart</a></code>, and <code><a href="#reveal">reveal</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<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);
</pre><pre class="example"> 2
sin(x ) b + a
(%t2) - log(sqrt(x + 1) + 1) + ------- + -----
3 2
</pre><pre class="example">(%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)
</pre><pre class="example"> 2
sin(x ) b + a
(%o11) ------- + ----- - log(%t11 + 1)
3 2
</pre><pre class="example">(%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></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="piece"></a><a name="Item_003a-Expressions_002fdefvr_002fpiece"></a><dl>
<dt><a name="index-piece"></a>System variable: <strong>piece</strong></dt>
<dd>
<p>Holds the last expression selected when using the <code><a href="#part">part</a></code> functions.
It is set during the execution of the function and thus may be referred to in
the function itself.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="psubst"></a><a name="Item_003a-Expressions_002fdeffn_002fpsubst"></a><dl>
<dt><a name="index-psubst"></a>Function: <strong>psubst</strong> <em><br> <tt>psubst</tt> (<var>list</var>, <var>expr</var>) <br> <tt>psubst</tt> (<var>a</var>, <var>b</var>, <var>expr</var>)</em></dt>
<dd>
<p><code>psubst(<var>a</var>, <var>b</var>, <var>expr</var>)</code> is similar to <code>subst</code>. See
<code><a href="#subst">subst</a></code>.
</p>
<p>In distinction from <code>subst</code> the function <code>psubst</code> makes parallel
substitutions, if the first argument <var>list</var> is a list of equations.
</p>
<p>See also <code><a href="#sublis">sublis</a></code> for making parallel substitutions and <code><a href="maxima_162.html#let">let</a></code> and
<code><a href="maxima_162.html#letsimp">letsimp</a></code> for others ways to do substitutions.
</p>
<p>Example:
</p>
<p>The first example shows parallel substitution with <code>psubst</code>. The second
example shows the result for the function <code>subst</code>, which does a serial
substitution.
</p>
<div class="example">
<pre class="example">(%i1) psubst ([a^2=b, b=a], sin(a^2) + sin(b));
(%o1) sin(b) + sin(a)
</pre><pre class="example">(%i2) subst ([a^2=b, b=a], sin(a^2) + sin(b));
(%o2) 2 sin(a)
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="rembox"></a><a name="Item_003a-Expressions_002fdeffn_002frembox"></a><dl>
<dt><a name="index-rembox"></a>Function: <strong>rembox</strong> <em><br> <tt>rembox</tt> (<var>expr</var>, unlabelled) <br> <tt>rembox</tt> (<var>expr</var>, <var>label</var>) <br> <tt>rembox</tt> (<var>expr</var>)</em></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><a href="#box">box</a></code>, <code><a href="#dpart">dpart</a></code>, and <code><a href="#lpart">lpart</a></code><!-- /@w -->
functions.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) expr: (a*d - b*c)/h^2 + sin(%pi*x);
a d - b c
(%o1) sin(%pi x) + ---------
2
h
</pre><pre class="example">(%i2) dpart (dpart (expr, 1, 1), 2, 2);
dpart: fell off the end.
-- an error. To debug this try: debugmode(true);
</pre><pre class="example">(%i3) expr2: lpart (BAR, lpart (FOO, %, 1), 2);
BAR""""""""
FOO""""""""" "a d - b c"
(%o3) "sin(%pi x)" + "---------"
"""""""""""" " 2 "
" h "
"""""""""""
</pre><pre class="example">(%i4) rembox (expr2, unlabelled);
BAR""""""""
FOO""""""""" "a d - b c"
(%o4) "sin(%pi x)" + "---------"
"""""""""""" " 2 "
" h "
"""""""""""
</pre><pre class="example">(%i5) rembox (expr2, FOO);
BAR""""""""
"a d - b c"
(%o5) sin(%pi x) + "---------"
" 2 "
" h "
"""""""""""
</pre><pre class="example">(%i6) rembox (expr2, BAR);
FOO""""""""" a d - b c
(%o6) "sin(%pi x)" + ---------
"""""""""""" 2
h
</pre><pre class="example">(%i7) rembox (expr2);
a d - b c
(%o7) sin(%pi x) + ---------
2
h
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="reveal"></a><a name="Item_003a-Expressions_002fdeffn_002freveal"></a><dl>
<dt><a name="index-reveal"></a>Function: <strong>reveal</strong> <em>(<var>expr</var>, <var>depth</var>)</em></dt>
<dd>
<p>Replaces parts of <var>expr</var> at the specified integer <var>depth</var>
with descriptive summaries.
</p>
<ul>
<li> Sums and differences are replaced by <code>Sum(<var>n</var>)</code>
where <var>n</var> is the number of operands of the sum.
</li><li> Products are replaced by <code>Product(<var>n</var>)</code>
where <var>n</var> is the number of operands of the product.
</li><li> Exponentials are replaced by <code>Expt</code>.
</li><li> Quotients are replaced by <code>Quotient</code>.
</li><li> Unary negation is replaced by <code>Negterm</code>.
</li><li> Lists are replaced by <code>List(<var>n</var>)</code> where <var>n</var> is the number of
elements of the list.
</li></ul>
<p>When <var>depth</var> is greater than or equal to the maximum depth of <var>expr</var>,
<code>reveal (<var>expr</var>, <var>depth</var>)</code> returns <var>expr</var> unmodified.
</p>
<p><code>reveal</code> evaluates its arguments.
<code>reveal</code> returns the summarized expression.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) e: expand ((a - b)^2)/expand ((exp(a) + exp(b))^2);
2 2
b - 2 a b + a
(%o1) -------------------------
b + a 2 b 2 a
2 %e + %e + %e
(%i2) reveal (e, 1);
(%o2) Quotient
(%i3) reveal (e, 2);
Sum(3)
(%o3) ------
Sum(3)
(%i4) reveal (e, 3);
</pre><pre class="example"> Expt + Negterm + Expt
(%o4) ------------------------
Product(2) + Expt + Expt
</pre><pre class="example">(%i5) reveal (e, 4);
2 2
b - Product(3) + a
(%o5) ------------------------------------
Product(2) Product(2)
2 Expt + %e + %e
(%i6) reveal (e, 5);
2 2
b - 2 a b + a
(%o6) --------------------------
Sum(2) 2 b 2 a
2 %e + %e + %e
(%i7) reveal (e, 6);
2 2
b - 2 a b + a
(%o7) -------------------------
b + a 2 b 2 a
2 %e + %e + %e
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·<a href="maxima_424.html#Category_003a-Display-functions">Display functions</a>
·</div></dd></dl>
<a name="sqrtdenest"></a><a name="Item_003a-Expressions_002fdeffn_002fsqrtdenest"></a><dl>
<dt><a name="index-sqrtdenest"></a>Function: <strong>sqrtdenest</strong> <em>(<var>expr</var>)</em></dt>
<dd><p>Denests <code>sqrt</code> of simple, numerical, binomial surds, where possible. E.g.
</p>
<div class="example">
<pre class="example">(%i1) sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12);
sqrt(3)
sqrt(------- + 1)
2
(%o1) ---------------------
sqrt(11 sqrt(2) - 12)
</pre><pre class="example">(%i2) sqrtdenest(%);
sqrt(3) 1
------- + -
2 2
(%o2) -------------
1/4 3/4
3 2 - 2
</pre></div>
<p>Sometimes it helps to apply <code>sqrtdenest</code> more than once, on such as
<code>(19601-13860 sqrt(2))^(7/4)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div>
</dd></dl>
<a name="sublis"></a><a name="Item_003a-Expressions_002fdeffn_002fsublis"></a><dl>
<dt><a name="index-sublis"></a>Function: <strong>sublis</strong> <em>(<var>list</var>, <var>expr</var>)</em></dt>
<dd>
<p>Makes multiple parallel substitutions into an expression. <var>list</var> is a list
of equations. The left hand side of the equations must be an atom.
</p>
<p>The variable <code><a href="#sublis_005fapply_005flambda">sublis_apply_lambda</a></code> controls simplification after
<code>sublis</code>.
</p>
<p>See also <code><a href="#psubst">psubst</a></code> for making parallel substitutions.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) sublis ([a=b, b=a], sin(a) + cos(b));
(%o1) sin(b) + cos(a)
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="sublis_005fapply_005flambda"></a><a name="Item_003a-Expressions_002fdefvr_002fsublis_005fapply_005flambda"></a><dl>
<dt><a name="index-sublis_005fapply_005flambda"></a>Option variable: <strong>sublis_apply_lambda</strong></dt>
<dd><p>Default value: <code>true</code>
</p>
<p>Controls whether <code>lambda</code>’s substituted are applied in simplification after
<code>sublis</code> is used or whether you have to do an <code><a href="maxima_43.html#ev">ev</a></code> to get things to
apply. <code>true</code> means do the application.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="subnumsimp"></a><a name="Item_003a-Expressions_002fdefvr_002fsubnumsimp"></a><dl>
<dt><a name="index-subnumsimp"></a>Option variable: <strong>subnumsimp</strong></dt>
<dd><p>Default value: <code>false</code>
</p>
<p>If <code>true</code> then the functions <code><a href="#subst">subst</a></code> and <code><a href="#psubst">psubst</a></code> can substitute
a subscripted variable <code>f[x]</code> with a number, when only the symbol <code>f</code>
is given.
</p>
<p>See also <code><a href="#subst">subst</a></code>.
</p>
<div class="example">
<pre class="example">(%i1) subst(100,g,g[x]+2);
subst: cannot substitute 100 for operator g in expression g
x
-- an error. To debug this try: debugmode(true);
(%i2) subst(100,g,g[x]+2),subnumsimp:true;
(%o2) 102
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="subst"></a><a name="Item_003a-Expressions_002fdeffn_002fsubst"></a><dl>
<dt><a name="index-subst"></a>Function: <strong>subst</strong> <em>(<var>a</var>, <var>b</var>, <var>c</var>)</em></dt>
<dd>
<p>Substitutes <var>a</var> for <var>b</var> in <var>c</var>. <var>b</var> must be an atom or a
complete subexpression of <var>c</var>. For example, <code>x+y+z</code> is a complete
subexpression of <code>2*(x+y+z)/w</code> while <code>x+y</code> is not. When <var>b</var> does
not have these characteristics, one may sometimes use <code><a href="#substpart">substpart</a></code> or
<code><a href="maxima_80.html#ratsubst">ratsubst</a></code> (see below). Alternatively, if <var>b</var> is of the form
<code>e/f</code> then one could use <code>subst (a*f, e, c)</code> while if <var>b</var> is of
the form <code>e^(1/f)</code> then one could use <code>subst (a^f, e, c)</code>. The
<code>subst</code> command also discerns the <code>x^y</code> in <code>x^-y</code> so that
<code>subst (a, sqrt(x), 1/sqrt(x))</code> yields <code>1/a</code>. <var>a</var> and <var>b</var>
may also be operators of an expression enclosed in double-quotes <code>"</code> or
they may be function names. If one wishes to substitute for the independent
variable in derivative forms then the <code>at</code> function (see below) should be
used.
</p>
<p><code>subst</code> is an alias for <code>substitute</code>.
</p>
<p>The commands <code>subst (<var>eq_1</var>, <var>expr</var>)</code> or
<code>subst ([<var>eq_1</var>, ..., <var>eq_k</var>], <var>expr</var>)</code> are other permissible
forms. The <var>eq_i</var> are equations indicating substitutions to be made.
For each equation, the right side will be substituted for the left in the
expression <var>expr</var>. The equations are substituted in serial from left to
right in <var>expr</var>. See the functions <code>sublis</code> and <code>psubst</code> for
making parallel substitutions.
</p>
<p><code><a href="#exptsubst">exptsubst</a></code> if <code>true</code> permits substitutions
like <code>y</code> for <code>%e^x</code> in <code>%e^(a*x)</code> to take place.
</p>
<p>When <code>opsubst</code> is <code>false</code>,
<code>subst</code> will not attempt to substitute into the operator of an expression.
E.g. <code>(opsubst: false, subst (x^2, r, r+r[0]))</code> will work.
</p>
<p>See also <code><a href="maxima_101.html#at">at</a></code>, <code><a href="maxima_43.html#ev">ev</a></code> and <code><a href="#psubst">psubst</a></code>, as well as <code><a href="maxima_162.html#let">let</a></code>
and <code><a href="maxima_162.html#letsimp">letsimp</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) subst (a, x+y, x + (x+y)^2 + y);
2
(%o1) y + x + a
</pre><pre class="example">(%i2) subst (-%i, %i, a + b*%i);
(%o2) a - %i b
</pre></div>
<p>The substitution is done in serial for a list of equations. Compare this with
a parallel substitution:
</p>
<div class="example">
<pre class="example">(%i1) subst([a=b, b=c], a+b);
(%o1) 2 c
</pre><pre class="example">(%i2) sublis([a=b, b=c], a+b);
(%o2) c + b
</pre></div>
<p>Single-character Operators like <code>+</code> and <code>-</code> have to be quoted in
order to be replaced by subst. It is to note, though, that <code>a+b-c</code>
might be expressed as <code>a+b+(-1*c)</code> internally.
</p>
<div class="example">
<pre class="example">(%i3) subst(["+"="-"],a+b-c);
(%o3) c-b+a
</pre></div>
<p>The difference between <code>subst</code> and <code>at</code> can be seen in the
following example:
</p><div class="example">
<pre class="example">(%i1) g1:y(t)=a*x(t)+b*diff(x(t),t);
d
(%o1) y(t) = b (-- (x(t))) + a x(t)
dt
</pre><pre class="example">(%i2) subst('diff(x(t),t)=1,g1);
(%o2) y(t) = a x(t) + b
</pre><pre class="example">(%i3) at(g1,'diff(x(t),t)=1);
!
d !
(%o3) y(t) = b (-- (x(t))! ) + a x(t)
dt !d
!-- (x(t)) = 1
dt
</pre></div>
<p>For further examples, do <code>example (subst)</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="substinpart"></a><a name="Item_003a-Expressions_002fdeffn_002fsubstinpart"></a><dl>
<dt><a name="index-substinpart"></a>Function: <strong>substinpart</strong> <em>(<var>x</var>, <var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></dt>
<dd>
<p>Similar to <code><a href="#substpart">substpart</a></code>, but <code>substinpart</code> works on the
internal representation of <var>expr</var>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) x . 'diff (f(x), x, 2);
2
d
(%o1) x . (--- (f(x)))
2
dx
</pre><pre class="example">(%i2) substinpart (d^2, %, 2);
2
(%o2) x . d
</pre><pre class="example">(%i3) substinpart (f1, f[1](x + 1), 0);
(%o3) f1(x + 1)
</pre></div>
<p>If the last argument to a <code>part</code> function is a list of indices then
several subexpressions are picked out, each one corresponding to an
index of the list. Thus
</p>
<div class="example">
<pre class="example">(%i1) part (x + y + z, [1, 3]);
(%o1) z + x
</pre></div>
<p><code><a href="#piece">piece</a></code> holds the value of 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 as shown below.
If <code><a href="#partswitch">partswitch</a></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>
<div class="example">
<pre class="example">(%i1) expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1;
3 2 2 3
(%o1) 27 y + 54 x y + 36 x y + y + 8 x + x + 1
</pre><pre class="example">(%i2) part (expr, 2, [1, 3]);
2
(%o2) 54 y
</pre><pre class="example">(%i3) sqrt (piece/54);
(%o3) abs(y)
</pre><pre class="example">(%i4) substpart (factor (piece), expr, [1, 2, 3, 5]);
3
(%o4) (3 y + 2 x) + y + x + 1
</pre><pre class="example">(%i5) expr: 1/x + y/x - 1/z;
1 y 1
(%o5) (- -) + - + -
z x x
</pre><pre class="example">(%i6) substpart (xthru (piece), expr, [2, 3]);
y + 1 1
(%o6) ----- - -
x z
</pre></div>
<p>Also, setting the option <code><a href="#inflag">inflag</a></code> to <code>true</code> and calling <code><a href="#part">part</a></code>
or <code><a href="#substpart">substpart</a></code> is the same as calling <code><a href="#inpart">inpart</a></code> or <code>substinpart</code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="substpart"></a><a name="Item_003a-Expressions_002fdeffn_002fsubstpart"></a><dl>
<dt><a name="index-substpart"></a>Function: <strong>substpart</strong> <em>(<var>x</var>, <var>expr</var>, <var>n_1</var>, …, <var>n_k</var>)</em></dt>
<dd>
<p>Substitutes <var>x</var> for the subexpression picked out by the rest of the
arguments as in <code><a href="#part">part</a></code>. It returns the new value of <var>expr</var>. <var>x</var>
may be some operator to be substituted for an operator of <var>expr</var>. In some
cases <var>x</var> needs to be enclosed in double-quotes <code>"</code> (e.g.
<code>substpart ("+", a*b, 0)</code> yields <code>b + a</code>).
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">(%i1) 1/(x^2 + 2);
1
(%o1) ------
2
x + 2
</pre><pre class="example">(%i2) substpart (3/2, %, 2, 1, 2);
1
(%o2) --------
3/2
x + 2
</pre><pre class="example">(%i3) a*x + f(b, y);
(%o3) a x + f(b, y)
</pre><pre class="example">(%i4) substpart ("+", %, 1, 0);
(%o4) x + f(b, y) + a
</pre></div>
<p>Also, setting the option <code><a href="#inflag">inflag</a></code> to <code>true</code> and calling <code><a href="#part">part</a></code>
or <code>substpart</code> is the same as calling <code>inpart</code> or
<code><a href="#substinpart">substinpart</a></code>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="symbolp"></a><a name="Item_003a-Expressions_002fdeffn_002fsymbolp"></a><dl>
<dt><a name="index-symbolp"></a>Function: <strong>symbolp</strong> <em>(<var>expr</var>)</em></dt>
<dd>
<p>Returns <code>true</code> if <var>expr</var> is a symbol, else <code>false</code>.
</p>
<p>See also <a href="maxima_31.html#Identifiers">Identifiers</a>.
</p>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Predicate-functions">Predicate functions</a>
·</div></dd></dl>
<a name="unorder"></a><a name="Item_003a-Expressions_002fdeffn_002funorder"></a><dl>
<dt><a name="index-unorder"></a>Function: <strong>unorder</strong> <em>()</em></dt>
<dd>
<p>Disables the aliasing created by the last use of the ordering commands
<code>ordergreat</code> and <code>orderless</code>. <code>ordergreat</code> and <code>orderless</code>
may not be used more than one time each without calling <code>unorder</code>.
<code>unorder</code> does not substitute back in expressions the original symbols for
the aliases introduced by <code>ordergreat</code> and <code>orderless</code>. Therefore,
after execution of <code>unorder</code> the aliases appear in previous expressions.
</p>
<p>See also <code>ordergreat</code> and <code>orderless</code>.
</p>
<p>Examples:
</p>
<p><code>ordergreat(a)</code> introduces an alias for the symbol <code>a</code>. Therefore,
the difference of <code>%o2</code> and <code>%o4</code> does not vanish. <code>unorder</code>
does not substitute back the symbol <code>a</code> and the alias appears in the
output <code>%o7</code>.
</p>
<div class="example">
<pre class="example">(%i1) unorder();
(%o1) []
</pre><pre class="example">(%i2) b*x + a^2;
2
(%o2) b x + a
</pre><pre class="example">(%i3) ordergreat (a);
(%o3) done
</pre><pre class="example">(%i4) b*x + a^2;
%th(1) - %th(3);
2
(%o4) a + b x
</pre><pre class="example">(%i5) unorder();
2 2
(%o5) a - a
</pre><pre class="example">(%i6) %th(2);
(%o6) [a]
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Expressions">Expressions</a>
·</div></dd></dl>
<a name="verbify"></a><a name="Item_003a-Expressions_002fdeffn_002fverbify"></a><dl>
<dt><a name="index-verbify"></a>Function: <strong>verbify</strong> <em>(<var>f</var>)</em></dt>
<dd>
<p>Returns the verb form of the function name <var>f</var>.
See also <code>verb</code>, <code>noun</code>, and <code>nounify</code>.
</p>
<p>Examples:
</p>
<div class="example">
<pre class="example">(%i1) verbify ('foo);
(%o1) foo
</pre><pre class="example">(%i2) :lisp $%
$FOO
</pre><pre class="example">(%i2) nounify (foo);
(%o2) foo
</pre><pre class="example">(%i3) :lisp $%
%FOO
</pre></div>
<div class=categorybox>
Categories:<a href="maxima_424.html#Category_003a-Nouns-and-verbs">Nouns and verbs</a>
·</div></dd></dl>
<hr>
<div class="header">
<p>
Previous: <a href="maxima_32.html#Inequality" accesskey="p" rel="previous">Inequality</a>, Up: <a href="maxima_28.html#Expressions" accesskey="u" rel="up">Expressions</a> [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_423.html#Function-and-Variable-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|