/usr/share/doc/maxima-doc/html/maxima_20.html is in maxima-doc 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on January, 10 2014 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima 5.32.1 Manual: 20. Equations</title>
<meta name="description" content="Maxima 5.32.1 Manual: 20. Equations">
<meta name="keywords" content="Maxima 5.32.1 Manual: 20. Equations">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
color: black;
background: white;
margin-left: 8%;
margin-right: 13%;
}
h1
{
margin-left: +8%;
font-size: 150%;
font-family: sans-serif
}
h2
{
font-size: 125%;
font-family: sans-serif
}
h3
{
font-size: 100%;
font-family: sans-serif
}
h2,h3,h4,h5,h6 { margin-left: +4%; }
div.textbox
{
border: solid;
border-width: thin;
/* width: 100%; */
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em
}
div.titlebox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(200,255,255);
font-family: sans-serif
}
div.synopsisbox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(255,220,255);
/*background: rgb(200,255,255); */
/* font-family: fixed */
}
pre.example
{
border: 1px solid gray;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 1em;
/* background: rgb(247,242,180); */ /* kind of sandy */
/* background: rgb(200,255,255); */ /* sky blue */
background-color: #F1F5F9; /* light blue-gray */
/* font-family: "Lucida Console", monospace */
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
div.categorybox
{
border: 1px solid gray;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,220);
}
-->
</style>
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Equations"></a>
<a name="SEC102"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_19.html#SEC101" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC103" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_19.html#SEC96" 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_21.html#SEC104" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 20. Equations </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC103">20.1 Functions and Variables for Equations</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<p><a name="Item_003a-Functions-and-Variables-for-Equations"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-Equations"></a>
<a name="SEC103"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC102" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_21.html#SEC104" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC102" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC102" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_21.html#SEC104" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 20.1 Functions and Variables for Equations </h2>
<p><a name="g_t_0025rnum_005flist"></a>
<a name="Item_003a-_0025rnum_005flist"></a>
</p><dl>
<dt><u>System variable:</u> <b>%rnum_list</b>
<a name="IDX881"></a>
</dt>
<dd><p>Default value: <code>[]</code>
</p>
<p><code>%rnum_list</code> is the list of variables introduced in solutions by
<code><a href="#solve">solve</a></code> and <code><a href="#algsys">algsys</a></code>. <code>%r</code> variables are added to
<code>%rnum_list</code> in the order they are created. This is convenient for doing
substitutions into the solution later on.
It's recommended to use this list rather than doing <code>concat ('%r, j)</code>.
</p>
<pre class="example">(%i1) solve ([x + y = 3], [x,y]);
(%o1) [[x = 3 - %r1, y = %r1]]
(%i2) %rnum_list;
(%o2) [%r1]
(%i3) sol : solve ([x + 2*y + 3*z = 4], [x,y,z]);
(%o3) [[x = - 2 %r3 - 3 %r2 + 4, y = %r3, z = %r2]]
(%i4) %rnum_list;
(%o4) [%r2, %r3]
(%i5) for i : 1 thru length (%rnum_list) do
sol : subst (t[i], %rnum_list[i], sol)$
(%i6) sol;
(%o6) [[x = - 2 t - 3 t + 4, y = t , z = t ]]
2 1 2 1
</pre>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="algepsilon"></a>
<a name="Item_003a-algepsilon"></a>
</p><dl>
<dt><u>Option variable:</u> <b>algepsilon</b>
<a name="IDX882"></a>
</dt>
<dd><p>Default value: 10^8
</p>
<p><code>algepsilon</code> is used by <code><a href="#algsys">algsys</a></code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="algexact"></a>
<a name="Item_003a-algexact"></a>
</p><dl>
<dt><u>Option variable:</u> <b>algexact</b>
<a name="IDX883"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>algexact</code> affects the behavior of <code><a href="#algsys">algsys</a></code> as follows:
</p>
<p>If <code>algexact</code> is <code>true</code>, <code>algsys</code> always calls <code><a href="#solve">solve</a></code> and
then uses <code><a href="#realroots">realroots</a></code> on <code>solve</code>'s failures.
</p>
<p>If <code>algexact</code> is <code>false</code>, <code>solve</code> is called only if the
eliminant was not univariate, or if it was a quadratic or biquadratic.
</p>
<p>Thus <code>algexact: true</code> does not guarantee only exact solutions, just that
<code>algsys</code> will first try as hard as it can to give exact solutions, and
only yield approximations when all else fails.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="algsys"></a>
<a name="Item_003a-algsys"></a>
</p><dl>
<dt><u>Function:</u> <b>algsys</b><i> ([<var>expr_1</var>, …, <var>expr_m</var>], [<var>x_1</var>, …, <var>x_n</var>])</i>
<a name="IDX884"></a>
</dt>
<dt><u>Function:</u> <b>algsys</b><i> ([<var>eqn_1</var>, …, <var>eqn_m</var>], [<var>x_1</var>, …, <var>x_n</var>])</i>
<a name="IDX885"></a>
</dt>
<dd><p>Solves the simultaneous polynomials <var>expr_1</var>, …, <var>expr_m</var> or
polynomial equations <var>eqn_1</var>, …, <var>eqn_m</var> for the variables
<var>x_1</var>, …, <var>x_n</var>. An expression <var>expr</var> is equivalent to an
equation <code><var>expr</var> = 0</code>. There may be more equations than variables or
vice versa.
</p>
<p><code>algsys</code> returns a list of solutions, with each solution given as a list
of equations stating values of the variables <var>x_1</var>, …, <var>x_n</var>
which satisfy the system of equations. If <code>algsys</code> cannot find a solution,
an empty list <code>[]</code> is returned.
</p>
<p>The symbols <code>%r1</code>, <code>%r2</code>, …, are introduced as needed to
represent arbitrary parameters in the solution; these variables are also
appended to the list <code><a href="#g_t_0025rnum_005flist">%rnum_list</a></code>.
</p>
<p>The method is as follows:
</p>
<ol>
<li>
First the equations are factored and split into subsystems.
</li><li>
For each subsystem <var>S_i</var>, an equation <var>E</var> and a variable <var>x</var> are
selected. The variable is chosen to have lowest nonzero degree. Then the
resultant of <var>E</var> and <var>E_j</var> with respect to <var>x</var> is computed for each
of the remaining equations <var>E_j</var> in the subsystem <var>S_i</var>. This yields a
new subsystem <var>S_i'</var> in one fewer variables, as <var>x</var> has been eliminated.
The process now returns to (1).
</li><li>
Eventually, a subsystem consisting of a single equation is obtained. If the
equation is multivariate and no approximations in the form of floating point
numbers have been introduced, then <code><a href="#solve">solve</a></code> is called to find an exact
solution.
<p>In some cases, <code>solve</code> is not be able to find a solution, or if it does
the solution may be a very large expression.
</p>
<p>If the equation is univariate and is either linear, quadratic, or biquadratic,
then again <code>solve</code> is called if no approximations have been introduced.
If approximations have been introduced or the equation is not univariate and
neither linear, quadratic, or biquadratic, then if the switch
<code><a href="#realonly">realonly</a></code> is <code>true</code>, the function <code><a href="#realroots">realroots</a></code> is called to find
the real-valued solutions. If <code>realonly</code> is <code>false</code>, then
<code><a href="#allroots">allroots</a></code> is called which looks for real and complex-valued solutions.
</p>
<p>If <code>algsys</code> produces a solution which has fewer significant digits than
required, the user can change the value of <code><a href="#algepsilon">algepsilon</a></code> to a higher value.
</p>
<p>If <code>algexact</code> is set to <code>true</code>, <code>solve</code> will always be called.
</p>
</li><li>
Finally, the solutions obtained in step (3) are substituted into
previous levels and the solution process returns to (1).
</li></ol>
<p>When <code>algsys</code> encounters a multivariate equation which contains floating
point approximations (usually due to its failing to find exact solutions at an
earlier stage), then it does not attempt to apply exact methods to such
equations and instead prints the message:
"<code>algsys</code> cannot solve - system too complicated."
</p>
<p>Interactions with <code><a href="maxima_9.html#radcan">radcan</a></code> can produce large or complicated expressions.
In that case, it may be possible to isolate parts of the result with
<code><a href="maxima_6.html#pickapart">pickapart</a></code> or <code><a href="maxima_6.html#reveal">reveal</a></code>.
</p>
<p>Occasionally, <code>radcan</code> may introduce an imaginary unit <code>%i</code> into a
solution which is actually real-valued.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) e1: 2*x*(1 - a1) - 2*(x - 1)*a2;
(%o1) 2 (1 - a1) x - 2 a2 (x - 1)
(%i2) e2: a2 - a1;
(%o2) a2 - a1
(%i3) e3: a1*(-y - x^2 + 1);
2
(%o3) a1 (- y - x + 1)
(%i4) e4: a2*(y - (x - 1)^2);
2
(%o4) a2 (y - (x - 1) )
(%i5) algsys ([e1, e2, e3, e4], [x, y, a1, a2]);
(%o5) [[x = 0, y = %r1, a1 = 0, a2 = 0],
[x = 1, y = 0, a1 = 1, a2 = 1]]
(%i6) e1: x^2 - y^2;
2 2
(%o6) x - y
(%i7) e2: -1 - y + 2*y^2 - x + x^2;
2 2
(%o7) 2 y - y + x - x - 1
(%i8) algsys ([e1, e2], [x, y]);
1 1
(%o8) [[x = - -------, y = -------],
sqrt(3) sqrt(3)
1 1 1 1
[x = -------, y = - -------], [x = - -, y = - -], [x = 1, y = 1]]
sqrt(3) sqrt(3) 3 3
</pre>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="allroots"></a>
<a name="Item_003a-allroots"></a>
</p><dl>
<dt><u>Function:</u> <b>allroots</b><i> (<var>expr</var>)</i>
<a name="IDX886"></a>
</dt>
<dt><u>Function:</u> <b>allroots</b><i> (<var>eqn</var>)</i>
<a name="IDX887"></a>
</dt>
<dd><p>Computes numerical approximations of the real and complex roots of the
polynomial <var>expr</var> or polynomial equation <var>eqn</var> of one variable.
</p>
<p>The flag <code><a href="#polyfactor">polyfactor</a></code> when <code>true</code> causes <code>allroots</code> to factor
the polynomial over the real numbers if the polynomial is real, or over the
complex numbers, if the polynomial is complex.
</p>
<p><code>allroots</code> may give inaccurate results in case of multiple roots.
If the polynomial is real, <code>allroots (%i*<var>p</var>)</code> may yield
more accurate approximations than <code>allroots (<var>p</var>)</code>, as <code>allroots</code>
invokes a different algorithm in that case.
</p>
<p><code>allroots</code> rejects non-polynomials. It requires that the numerator
after <code>rat</code>'ing should be a polynomial, and it requires that the
denominator be at most a complex number. As a result of this <code>allroots</code>
will always return an equivalent (but factored) expression, if
<code>polyfactor</code> is <code>true</code>.
</p>
<p>For complex polynomials an algorithm by Jenkins and Traub is used
(Algorithm 419, <i>Comm. ACM</i>, vol. 15, (1972), p. 97). For real polynomials
the algorithm used is due to Jenkins (Algorithm 493, <i>ACM TOMS</i>, vol. 1,
(1975), p.178).
</p>
<p>Examples:
</p>
<pre class="example">(%i1) eqn: (1 + 2*x)^3 = 13.5*(1 + x^5);
3 5
(%o1) (2 x + 1) = 13.5 (x + 1)
(%i2) soln: allroots (eqn);
(%o2) [x = .8296749902129361, x = - 1.015755543828121,
x = .9659625152196369 %i - .4069597231924075,
x = - .9659625152196369 %i - .4069597231924075, x = 1.0]
(%i3) for e in soln
do (e2: subst (e, eqn), disp (expand (lhs(e2) - rhs(e2))));
- 3.5527136788005E-15
- 5.32907051820075E-15
4.44089209850063E-15 %i - 4.88498130835069E-15
- 4.44089209850063E-15 %i - 4.88498130835069E-15
3.5527136788005E-15
(%o3) done
(%i4) polyfactor: true$
(%i5) allroots (eqn);
(%o5) - 13.5 (x - 1.0) (x - .8296749902129361)
2
(x + 1.015755543828121) (x + .8139194463848151 x
+ 1.098699797110288)
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="bfallroots"></a>
<a name="Item_003a-bfallroots"></a>
</p><dl>
<dt><u>Function:</u> <b>bfallroots</b><i> (<var>expr</var>)</i>
<a name="IDX888"></a>
</dt>
<dt><u>Function:</u> <b>bfallroots</b><i> (<var>eqn</var>)</i>
<a name="IDX889"></a>
</dt>
<dd><p>Computes numerical approximations of the real and complex roots of the
polynomial <var>expr</var> or polynomial equation <var>eqn</var> of one variable.
</p>
<p>In all respects, <code>bfallroots</code> is identical to <code>allroots</code> except
that <code>bfallroots</code> computes the roots using bigfloats. See
<code><a href="#allroots">allroots</a></code> for more information.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="backsubst"></a>
<a name="Item_003a-backsubst"></a>
</p><dl>
<dt><u>Option variable:</u> <b>backsubst</b>
<a name="IDX890"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>backsubst</code> is <code>false</code>, prevents back substitution in
<code><a href="#linsolve">linsolve</a></code> after the equations have been triangularized. This may
be helpful in very big problems where back substitution would cause
the generation of extremely large expressions.
</p>
<pre class="example">(%i1) eq1 : x + y + z = 6$
(%i2) eq2 : x - y + z = 2$
(%i3) eq3 : x + y - z = 0$
(%i4) backsubst : false$
(%i5) linsolve ([eq1, eq2, eq3], [x,y,z]);
(%o5) [x = z - y, y = 2, z = 3]
(%i6) backsubst : true$
(%i7) linsolve ([eq1, eq2, eq3], [x,y,z]);
(%o7) [x = 1, y = 2, z = 3]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="breakup"></a>
<a name="Item_003a-breakup"></a>
</p><dl>
<dt><u>Option variable:</u> <b>breakup</b>
<a name="IDX891"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>breakup</code> is <code>true</code>, <code><a href="#solve">solve</a></code> expresses solutions of cubic
and quartic equations in terms of common subexpressions, which are assigned to
intermediate expression labels (<code>%t1</code>, <code>%t2</code>, etc.).
Otherwise, common subexpressions are not identified.
</p>
<p><code>breakup: true</code> has an effect only when <code><a href="#programmode">programmode</a></code> is <code>false</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) programmode: false$
(%i2) breakup: true$
(%i3) solve (x^3 + x^2 - 1);
sqrt(23) 25 1/3
(%t3) (--------- + --)
6 sqrt(3) 54
Solution:
sqrt(3) %i 1
---------- - -
sqrt(3) %i 1 2 2 1
(%t4) x = (- ---------- - -) %t3 + -------------- - -
2 2 9 %t3 3
sqrt(3) %i 1
- ---------- - -
sqrt(3) %i 1 2 2 1
(%t5) x = (---------- - -) %t3 + ---------------- - -
2 2 9 %t3 3
1 1
(%t6) x = %t3 + ----- - -
9 %t3 3
(%o6) [%t4, %t5, %t6]
(%i6) breakup: false$
(%i7) solve (x^3 + x^2 - 1);
Solution:
sqrt(3) %i 1
---------- - -
2 2 sqrt(23) 25 1/3
(%t7) x = --------------------- + (--------- + --)
sqrt(23) 25 1/3 6 sqrt(3) 54
9 (--------- + --)
6 sqrt(3) 54
sqrt(3) %i 1 1
(- ---------- - -) - -
2 2 3
sqrt(23) 25 1/3 sqrt(3) %i 1
(%t8) x = (--------- + --) (---------- - -)
6 sqrt(3) 54 2 2
sqrt(3) %i 1
- ---------- - -
2 2 1
+ --------------------- - -
sqrt(23) 25 1/3 3
9 (--------- + --)
6 sqrt(3) 54
sqrt(23) 25 1/3 1 1
(%t9) x = (--------- + --) + --------------------- - -
6 sqrt(3) 54 sqrt(23) 25 1/3 3
9 (--------- + --)
6 sqrt(3) 54
(%o9) [%t7, %t8, %t9]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="dimension"></a>
<a name="Item_003a-dimension"></a>
</p><dl>
<dt><u>Function:</u> <b>dimension</b><i> (<var>eqn</var>)</i>
<a name="IDX892"></a>
</dt>
<dt><u>Function:</u> <b>dimension</b><i> (<var>eqn_1</var>, …, <var>eqn_n</var>)</i>
<a name="IDX893"></a>
</dt>
<dd><p><code>dimen</code> is a package for dimensional analysis.
<code>load ("dimen")</code> loads this package.
<code>demo ("dimen")</code> displays a short demonstration.
</p>
<div class=categorybox>
·
<p>@ref{Category: Share packages}
</div>
</p></dd></dl>
<p><a name="dispflag"></a>
<a name="Item_003a-dispflag"></a>
</p><dl>
<dt><u>Option variable:</u> <b>dispflag</b>
<a name="IDX894"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>If set to <code>false</code> within a <code>block</code> will inhibit the display of output
generated by the solve functions called from within the <code>block</code>.
Termination of the <code>block</code> with a dollar sign, $, sets <code>dispflag</code> to
<code>false</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations} ·
@ref{Category: Display flags and variables}
</div>
</p></dd></dl>
<p><a name="funcsolve"></a>
<a name="Item_003a-funcsolve"></a>
</p><dl>
<dt><u>Function:</u> <b>funcsolve</b><i> (<var>eqn</var>, <var>g</var>(<var>t</var>))</i>
<a name="IDX895"></a>
</dt>
<dd><p>Returns <code>[<var>g</var>(<var>t</var>) = ...]</code> or <code>[]</code>, depending on whether
or not there exists a rational function <code><var>g</var>(<var>t</var>)</code> satisfying
<var>eqn</var>, which must be a first order, linear polynomial in (for this case)
<code><var>g</var>(<var>t</var>)</code> and <code><var>g</var>(<var>t</var>+1)</code>
</p>
<pre class="example">(%i1) eqn: (n + 1)*f(n) - (n + 3)*f(n + 1)/(n + 1) =
(n - 1)/(n + 2);
(n + 3) f(n + 1) n - 1
(%o1) (n + 1) f(n) - ---------------- = -----
n + 1 n + 2
(%i2) funcsolve (eqn, f(n));
Dependent equations eliminated: (4 3)
n
(%o2) f(n) = ---------------
(n + 1) (n + 2)
</pre>
<p>Warning: this is a very rudimentary implementation - many safety checks
and obvious generalizations are missing.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="globalsolve"></a>
<a name="Item_003a-globalsolve"></a>
</p><dl>
<dt><u>Option variable:</u> <b>globalsolve</b>
<a name="IDX896"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>globalsolve</code> is <code>true</code>, solved-for variables are assigned the
solution values found by <code>linsolve</code>, and by <code><a href="#solve">solve</a></code> when solving two
or more linear equations.
</p>
<p>When <code>globalsolve</code> is <code>false</code>, solutions found by <code><a href="#linsolve">linsolve</a></code> and
by <code>solve</code> when solving two or more linear equations are expressed as
equations, and the solved-for variables are not assigned.
</p>
<p>When solving anything other than two or more linear equations, <code>solve</code>
ignores <code>globalsolve</code>. Other functions which solve equations (e.g.,
<code><a href="#algsys">algsys</a></code>) always ignore <code>globalsolve</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) globalsolve: true$
(%i2) solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
Solution
17
(%t2) x : --
7
1
(%t3) y : - -
7
(%o3) [[%t2, %t3]]
(%i3) x;
17
(%o3) --
7
(%i4) y;
1
(%o4) - -
7
(%i5) globalsolve: false$
(%i6) kill (x, y)$
(%i7) solve ([x + 3*y = 2, 2*x - y = 5], [x, y]);
Solution
17
(%t7) x = --
7
1
(%t8) y = - -
7
(%o8) [[%t7, %t8]]
(%i8) x;
(%o8) x
(%i9) y;
(%o9) y
</pre>
<div class=categorybox>
·
<p>@ref{Category: Linear equations}
</div>
</p></dd></dl>
<p><a name="ieqn"></a>
<a name="Item_003a-ieqn"></a>
</p><dl>
<dt><u>Function:</u> <b>ieqn</b><i> (<var>ie</var>, <var>unk</var>, <var>tech</var>, <var>n</var>, <var>guess</var>)</i>
<a name="IDX897"></a>
</dt>
<dd><p><code>inteqn</code> is a package for solving integral equations.
<code>load ("inteqn")</code> loads this package.
</p>
<p><var>ie</var> is the integral equation; <var>unk</var> is the unknown function; <var>tech</var>
is the technique to be tried from those given above (<var>tech</var> = <code>first</code>
means: try the first technique which finds a solution; <var>tech</var> = <code>all</code>
means: try all applicable techniques); <var>n</var> is the maximum number of terms
to take for <code>taylor</code>, <code>neumann</code>, <code>firstkindseries</code>, or
<code>fredseries</code> (it is also the maximum depth of recursion for the
differentiation method); <var>guess</var> is the initial guess for <code>neumann</code> or
<code>firstkindseries</code>.
</p>
<p>Default values for the 2nd thru 5th parameters are:
</p>
<p><var>unk</var>: <code><var>p</var>(<var>x</var>)</code>, where <var>p</var> is the first function
encountered in an integrand which is unknown to Maxima and <var>x</var> is the
variable which occurs as an argument to the first occurrence of <var>p</var> found
outside of an integral in the case of <code>secondkind</code> equations, or is the
only other variable besides the variable of integration in <code>firstkind</code>
equations. If the attempt to search for <var>x</var> fails, the user will be asked
to supply the independent variable.
</p>
<p>tech: <code>first</code>
</p>
<p>n: 1
</p>
<p>guess: <code>none</code> which will cause <code>neumann</code> and <code>firstkindseries</code>
to use <code><var>f</var>(<var>x</var>)</code> as an initial guess.
</p>
<div class=categorybox>
·
<p>@ref{Category: Integral equations}
</div>
</p></dd></dl>
<p><a name="ieqnprint"></a>
<a name="Item_003a-ieqnprint"></a>
</p><dl>
<dt><u>Option variable:</u> <b>ieqnprint</b>
<a name="IDX898"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p><code>ieqnprint</code> governs the behavior of the result returned by the
<code><a href="#ieqn">ieqn</a></code> command. When <code>ieqnprint</code> is <code>false</code>, the lists returned
by the <code>ieqn</code> function are of the form
</p>
<p> [<var>solution</var>, <var>technique used</var>, <var>nterms</var>, <var>flag</var>]
</p>
<p>where <var>flag</var> is absent if the solution is exact.
</p>
<p>Otherwise, it is the word <code>approximate</code> or <code>incomplete</code> corresponding
to an inexact or non-closed form solution, respectively. If a series method was
used, <var>nterms</var> gives the number of terms taken (which could be less than
the n given to <code>ieqn</code> if an error prevented generation of further terms).
</p>
<div class=categorybox>
·
<p>@ref{Category: Integral equations}
</div>
</p></dd></dl>
<p><a name="lhs"></a>
<a name="Item_003a-lhs"></a>
</p><dl>
<dt><u>Function:</u> <b>lhs</b><i> (<var>expr</var>)</i>
<a name="IDX899"></a>
</dt>
<dd><p>Returns the left-hand side (that is, the first argument) of the expression
<var>expr</var>, when the operator of <var>expr</var> is one of the relational operators
<code>< <= = # equal notequal >= ></code>,
one of the assignment operators <code>:= ::= : ::</code>, or a user-defined binary
infix operator, as declared by <code><a href="maxima_7.html#infix">infix</a></code>.
</p>
<p>When <var>expr</var> is an atom or its operator is something other than the ones
listed above, <code>lhs</code> returns <var>expr</var>.
</p>
<p>See also <code><a href="#rhs">rhs</a></code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) e: aa + bb = cc;
(%o1) bb + aa = cc
(%i2) lhs (e);
(%o2) bb + aa
(%i3) rhs (e);
(%o3) cc
(%i4) [lhs (aa < bb), lhs (aa <= bb), lhs (aa >= bb),
lhs (aa > bb)];
(%o4) [aa, aa, aa, aa]
(%i5) [lhs (aa = bb), lhs (aa # bb), lhs (equal (aa, bb)),
lhs (notequal (aa, bb))];
(%o5) [aa, aa, aa, aa]
(%i6) e1: '(foo(x) := 2*x);
(%o6) foo(x) := 2 x
(%i7) e2: '(bar(y) ::= 3*y);
(%o7) bar(y) ::= 3 y
(%i8) e3: '(x : y);
(%o8) x : y
(%i9) e4: '(x :: y);
(%o9) x :: y
(%i10) [lhs (e1), lhs (e2), lhs (e3), lhs (e4)];
(%o10) [foo(x), bar(y), x, x]
(%i11) infix ("][");
(%o11) ][
(%i12) lhs (aa ][ bb);
(%o12) aa
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="linsolve"></a>
<a name="Item_003a-linsolve"></a>
</p><dl>
<dt><u>Function:</u> <b>linsolve</b><i> ([<var>expr_1</var>, …, <var>expr_m</var>], [<var>x_1</var>, …, <var>x_n</var>])</i>
<a name="IDX900"></a>
</dt>
<dd><p>Solves the list of simultaneous linear equations for the list of variables.
The expressions must each be polynomials in the variables and may be equations.
</p>
<p>When <code><a href="#globalsolve">globalsolve</a></code> is <code>true</code>, each solved-for variable is bound to
its value in the solution of the equations.
</p>
<p>When <code><a href="#backsubst">backsubst</a></code> is <code>false</code>, <code>linsolve</code> does not carry out back
substitution after the equations have been triangularized. This may be
necessary in very big problems where back substitution would cause the
generation of extremely large expressions.
</p>
<p>When <code><a href="#linsolve_005fparams">linsolve_params</a></code> is <code>true</code>, <code>linsolve</code> also generates the
<code>%r</code> symbols used to represent arbitrary parameters described in the manual
under <code><a href="#algsys">algsys</a></code>. Otherwise, <code>linsolve</code> solves an under-determined
system of equations with some variables expressed in terms of others.
</p>
<p>When <code><a href="#programmode">programmode</a></code> is <code>false</code>, <code>linsolve</code> displays the solution
with intermediate expression (<code>%t</code>) labels, and returns the list of labels.
</p>
<pre class="example">(%i1) e1: x + z = y;
(%o1) z + x = y
(%i2) e2: 2*a*x - y = 2*a^2;
2
(%o2) 2 a x - y = 2 a
(%i3) e3: y - 2*z = 2;
(%o3) y - 2 z = 2
(%i4) [globalsolve: false, programmode: true];
(%o4) [false, true]
(%i5) linsolve ([e1, e2, e3], [x, y, z]);
(%o5) [x = a + 1, y = 2 a, z = a - 1]
(%i6) [globalsolve: false, programmode: false];
(%o6) [false, false]
(%i7) linsolve ([e1, e2, e3], [x, y, z]);
Solution
(%t7) z = a - 1
(%t8) y = 2 a
(%t9) x = a + 1
(%o9) [%t7, %t8, %t9]
(%i9) ''%;
(%o9) [z = a - 1, y = 2 a, x = a + 1]
(%i10) [globalsolve: true, programmode: false];
(%o10) [true, false]
(%i11) linsolve ([e1, e2, e3], [x, y, z]);
Solution
(%t11) z : a - 1
(%t12) y : 2 a
(%t13) x : a + 1
(%o13) [%t11, %t12, %t13]
(%i13) ''%;
(%o13) [z : a - 1, y : 2 a, x : a + 1]
(%i14) [x, y, z];
(%o14) [a + 1, 2 a, a - 1]
(%i15) [globalsolve: true, programmode: true];
(%o15) [true, true]
(%i16) linsolve ([e1, e2, e3], '[x, y, z]);
(%o16) [x : a + 1, y : 2 a, z : a - 1]
(%i17) [x, y, z];
(%o17) [a + 1, 2 a, a - 1]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Linear equations}
</div>
</p></dd></dl>
<p><a name="linsolvewarn"></a>
<a name="Item_003a-linsolvewarn"></a>
</p><dl>
<dt><u>Option variable:</u> <b>linsolvewarn</b>
<a name="IDX901"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>linsolvewarn</code> is <code>true</code>, <code><a href="#linsolve">linsolve</a></code> prints a message
"Dependent equations eliminated".
</p>
<div class=categorybox>
·
<p>@ref{Category: Linear equations}
</div>
</p></dd></dl>
<p><a name="linsolve_005fparams"></a>
<a name="Item_003a-linsolve_005fparams"></a>
</p><dl>
<dt><u>Option variable:</u> <b>linsolve_params</b>
<a name="IDX902"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>linsolve_params</code> is <code>true</code>, <code><a href="#linsolve">linsolve</a></code> also generates
the <code>%r</code> symbols used to represent arbitrary parameters described in
the manual under <code><a href="#algsys">algsys</a></code>. Otherwise, <code>linsolve</code> solves an
under-determined system of equations with some variables expressed in terms of
others.
</p>
<div class=categorybox>
·
<p>@ref{Category: Linear equations}
</div>
</p></dd></dl>
<p><a name="multiplicities"></a>
<a name="Item_003a-multiplicities"></a>
</p><dl>
<dt><u>System variable:</u> <b>multiplicities</b>
<a name="IDX903"></a>
</dt>
<dd><p>Default value: <code>not_set_yet</code>
</p>
<p><code>multiplicities</code> is set to a list of the multiplicities of the individual
solutions returned by <code><a href="#solve">solve</a></code> or <code><a href="#realroots">realroots</a></code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations} ·
@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="nroots"></a>
<a name="Item_003a-nroots"></a>
</p><dl>
<dt><u>Function:</u> <b>nroots</b><i> (<var>p</var>, <var>low</var>, <var>high</var>)</i>
<a name="IDX904"></a>
</dt>
<dd><p>Returns the number of real roots of the real univariate polynomial <var>p</var> in
the half-open interval <code>(<var>low</var>, <var>high</var>]</code>. The endpoints of the
interval may be <code>minf</code> or <code>inf</code>.
</p>
<p><code>nroots</code> uses the method of Sturm sequences.
</p>
<pre class="example">(%i1) p: x^10 - 2*x^4 + 1/2$
(%i2) nroots (p, -6, 9.1);
(%o2) 4
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="nthroot"></a>
<a name="Item_003a-nthroot"></a>
</p><dl>
<dt><u>Function:</u> <b>nthroot</b><i> (<var>p</var>, <var>n</var>)</i>
<a name="IDX905"></a>
</dt>
<dd><p>where <var>p</var> is a polynomial with integer coefficients and <var>n</var> is a
positive integer returns <code>q</code>, a polynomial over the integers, such that
<code>q^n = p</code> or prints an error message indicating that <var>p</var> is not a
perfect nth power. This routine is much faster than <code><a href="maxima_14.html#factor">factor</a></code> or even
<code><a href="maxima_14.html#sqfr">sqfr</a></code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="polyfactor"></a>
<a name="Item_003a-polyfactor"></a>
</p><dl>
<dt><u>Option variable:</u> <b>polyfactor</b>
<a name="IDX906"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>The option variable <code>polyfactor</code> when <code>true</code> causes
<code><a href="#allroots">allroots</a></code> and <code><a href="#bfallroots">bfallroots</a></code> to factor the polynomial over the real
numbers if the polynomial is real, or over the complex numbers, if the
polynomial is complex.
</p>
<p>See <code>allroots</code> for an example.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="programmode"></a>
<a name="Item_003a-programmode"></a>
</p><dl>
<dt><u>Option variable:</u> <b>programmode</b>
<a name="IDX907"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>programmode</code> is <code>true</code>, <code><a href="#solve">solve</a></code>,
<code><a href="#realroots">realroots</a></code>, <code><a href="#allroots">allroots</a></code>, and <code><a href="#linsolve">linsolve</a></code> return solutions
as elements in a list.
(Except when <code><a href="#backsubst">backsubst</a></code> is set to <code>false</code>, in which case
<code>programmode: false</code> is assumed.)
</p>
<p>When <code>programmode</code> is <code>false</code>, <code>solve</code>, etc. create intermediate
expression labels <code>%t1</code>, <code>t2</code>, etc., and assign the solutions to them.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations} ·
@ref{Category: Polynomials}
</div>
</p></dd></dl>
<p><a name="realonly"></a>
<a name="Item_003a-realonly"></a>
</p><dl>
<dt><u>Option variable:</u> <b>realonly</b>
<a name="IDX908"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>realonly</code> is <code>true</code>, <code><a href="#algsys">algsys</a></code> returns only those solutions
which are free of <code>%i</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="realroots"></a>
<a name="Item_003a-realroots"></a>
</p><dl>
<dt><u>Function:</u> <b>realroots</b><i> (<var>expr</var>, <var>bound</var>)</i>
<a name="IDX909"></a>
</dt>
<dt><u>Function:</u> <b>realroots</b><i> (<var>eqn</var>, <var>bound</var>)</i>
<a name="IDX910"></a>
</dt>
<dt><u>Function:</u> <b>realroots</b><i> (<var>expr</var>)</i>
<a name="IDX911"></a>
</dt>
<dt><u>Function:</u> <b>realroots</b><i> (<var>eqn</var>)</i>
<a name="IDX912"></a>
</dt>
<dd><p>Computes rational approximations of the real roots of the polynomial <var>expr</var>
or polynomial equation <var>eqn</var> of one variable, to within a tolerance of
<var>bound</var>. Coefficients of <var>expr</var> or <var>eqn</var> must be literal numbers;
symbol constants such as <code>%pi</code> are rejected.
</p>
<p><code>realroots</code> assigns the multiplicities of the roots it finds
to the global variable <code><a href="#multiplicities">multiplicities</a></code>.
</p>
<p><code>realroots</code> constructs a Sturm sequence to bracket each root, and then
applies bisection to refine the approximations. All coefficients are converted
to rational equivalents before searching for roots, and computations are carried
out by exact rational arithmetic. Even if some coefficients are floating-point
numbers, the results are rational (unless coerced to floats by the
<code><a href="maxima_5.html#float">float</a></code> or <code><a href="maxima_5.html#numer">numer</a></code> flags).
</p>
<p>When <var>bound</var> is less than 1, all integer roots are found exactly.
When <var>bound</var> is unspecified, it is assumed equal to the global variable
<code><a href="#rootsepsilon">rootsepsilon</a></code>.
</p>
<p>When the global variable <code><a href="#programmode">programmode</a></code> is <code>true</code>, <code>realroots</code>
returns a list of the form <code>[x = <var>x_1</var>, x = <var>x_2</var>, ...]</code>.
When <code>programmode</code> is <code>false</code>, <code>realroots</code> creates intermediate
expression labels <code>%t1</code>, <code>%t2</code>, …,
assigns the results to them, and returns the list of labels.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) realroots (-1 - x + x^5, 5e-6);
612003
(%o1) [x = ------]
524288
(%i2) ev (%[1], float);
(%o2) x = 1.167303085327148
(%i3) ev (-1 - x + x^5, %);
(%o3) - 7.396496210176905E-6
</pre>
<pre class="example">(%i1) realroots (expand ((1 - x)^5 * (2 - x)^3 * (3 - x)), 1e-20);
(%o1) [x = 1, x = 2, x = 3]
(%i2) multiplicities;
(%o2) [5, 3, 1]
</pre>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="rhs"></a>
<a name="Item_003a-rhs"></a>
</p><dl>
<dt><u>Function:</u> <b>rhs</b><i> (<var>expr</var>)</i>
<a name="IDX913"></a>
</dt>
<dd><p>Returns the right-hand side (that is, the second argument) of the expression
<var>expr</var>, when the operator of <var>expr</var> is one of the relational operators
<code>< <= = # equal notequal >= ></code>,
one of the assignment operators <code>:= ::= : ::</code>, or a user-defined binary
infix operator, as declared by <code><a href="maxima_7.html#infix">infix</a></code>.
</p>
<p>When <var>expr</var> is an atom or its operator is something other than the ones
listed above, <code>rhs</code> returns 0.
</p>
<p>See also <code><a href="#lhs">lhs</a></code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) e: aa + bb = cc;
(%o1) bb + aa = cc
(%i2) lhs (e);
(%o2) bb + aa
(%i3) rhs (e);
(%o3) cc
(%i4) [rhs (aa < bb), rhs (aa <= bb), rhs (aa >= bb),
rhs (aa > bb)];
(%o4) [bb, bb, bb, bb]
(%i5) [rhs (aa = bb), rhs (aa # bb), rhs (equal (aa, bb)),
rhs (notequal (aa, bb))];
(%o5) [bb, bb, bb, bb]
(%i6) e1: '(foo(x) := 2*x);
(%o6) foo(x) := 2 x
(%i7) e2: '(bar(y) ::= 3*y);
(%o7) bar(y) ::= 3 y
(%i8) e3: '(x : y);
(%o8) x : y
(%i9) e4: '(x :: y);
(%o9) x :: y
(%i10) [rhs (e1), rhs (e2), rhs (e3), rhs (e4)];
(%o10) [2 x, 3 y, y, y]
(%i11) infix ("][");
(%o11) ][
(%i12) rhs (aa ][ bb);
(%o12) bb
</pre>
<div class=categorybox>
·
<p>@ref{Category: Expressions}
</div>
</p></dd></dl>
<p><a name="rootsconmode"></a>
<a name="Item_003a-rootsconmode"></a>
</p><dl>
<dt><u>Option variable:</u> <b>rootsconmode</b>
<a name="IDX914"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p><code>rootsconmode</code> governs the behavior of the <code>rootscontract</code> command.
See <code><a href="#rootscontract">rootscontract</a></code> for details.
</p>
<div class=categorybox>
·
<p>@ref{Category: Expressions} ·
@ref{Category: Simplification flags and variables}
</div>
</p></dd></dl>
<p><a name="rootscontract"></a>
<a name="Item_003a-rootscontract"></a>
</p><dl>
<dt><u>Function:</u> <b>rootscontract</b><i> (<var>expr</var>)</i>
<a name="IDX915"></a>
</dt>
<dd><p>Converts products of roots into roots of products. For example,
<code>rootscontract (sqrt(x)*y^(3/2))</code> yields <code>sqrt(x*y^3)</code>.
</p>
<p>When <code><a href="maxima_9.html#radexpand">radexpand</a></code> is <code>true</code> and <code><a href="maxima_9.html#domain">domain</a></code> is <code>real</code>,
<code>rootscontract</code> converts <code><a href="maxima_10.html#abs">abs</a></code> into <code><a href="maxima_10.html#sqrt">sqrt</a></code>, e.g.,
<code>rootscontract (abs(x)*sqrt(y))</code> yields <code>sqrt(x^2*y)</code>.
</p>
<p>There is an option <code><a href="#rootsconmode">rootsconmode</a></code> affecting <code>rootscontract</code> as
follows:
</p>
<pre class="example">Problem Value of Result of applying
rootsconmode rootscontract
x^(1/2)*y^(3/2) false (x*y^3)^(1/2)
x^(1/2)*y^(1/4) false x^(1/2)*y^(1/4)
x^(1/2)*y^(1/4) true (x*y^(1/2))^(1/2)
x^(1/2)*y^(1/3) true x^(1/2)*y^(1/3)
x^(1/2)*y^(1/4) all (x^2*y)^(1/4)
x^(1/2)*y^(1/3) all (x^3*y^2)^(1/6)
</pre>
<p>When <code>rootsconmode</code> is <code>false</code>, <code>rootscontract</code> contracts only
with respect to rational number exponents whose denominators are the same. The
key to the <code>rootsconmode: true</code> examples is simply that 2 divides into 4
but not into 3. <code>rootsconmode: all</code> involves taking the least common
multiple of the denominators of the exponents.
</p>
<p><code>rootscontract</code> uses <code><a href="maxima_14.html#ratsimp">ratsimp</a></code> in a manner similar to
<code><a href="maxima_10.html#logcontract">logcontract</a></code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) rootsconmode: false$
(%i2) rootscontract (x^(1/2)*y^(3/2));
3
(%o2) sqrt(x y )
(%i3) rootscontract (x^(1/2)*y^(1/4));
1/4
(%o3) sqrt(x) y
(%i4) rootsconmode: true$
(%i5) rootscontract (x^(1/2)*y^(1/4));
(%o5) sqrt(x sqrt(y))
(%i6) rootscontract (x^(1/2)*y^(1/3));
1/3
(%o6) sqrt(x) y
(%i7) rootsconmode: all$
(%i8) rootscontract (x^(1/2)*y^(1/4));
2 1/4
(%o8) (x y)
(%i9) rootscontract (x^(1/2)*y^(1/3));
3 2 1/6
(%o9) (x y )
(%i10) rootsconmode: false$
(%i11) rootscontract (sqrt(sqrt(x) + sqrt(1 + x))
*sqrt(sqrt(1 + x) - sqrt(x)));
(%o11) 1
(%i12) rootsconmode: true$
(%i13) rootscontract (sqrt(5+sqrt(5)) - 5^(1/4)*sqrt(1+sqrt(5)));
(%o13) 0
</pre>
<div class=categorybox>
·
<p>@ref{Category: Simplification functions}
</div>
</p></dd></dl>
<p><a name="rootsepsilon"></a>
<a name="Item_003a-rootsepsilon"></a>
</p><dl>
<dt><u>Option variable:</u> <b>rootsepsilon</b>
<a name="IDX916"></a>
</dt>
<dd><p>Default value: 1.0e-7
</p>
<p><code>rootsepsilon</code> is the tolerance which establishes the confidence interval
for the roots found by the <code><a href="#realroots">realroots</a></code> function.
</p>
<div class=categorybox>
·
<p>@ref{Category: Polynomials} ·
@ref{Category: Numerical methods}
</div>
</p></dd></dl>
<p><a name="solve"></a>
<a name="Item_003a-solve"></a>
</p><dl>
<dt><u>Function:</u> <b>solve</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX917"></a>
</dt>
<dt><u>Function:</u> <b>solve</b><i> (<var>expr</var>)</i>
<a name="IDX918"></a>
</dt>
<dt><u>Function:</u> <b>solve</b><i> ([<var>eqn_1</var>, …, <var>eqn_n</var>], [<var>x_1</var>, …, <var>x_n</var>])</i>
<a name="IDX919"></a>
</dt>
<dd><p>Solves the algebraic equation <var>expr</var> for the variable <var>x</var> and returns a
list of solution equations in <var>x</var>. If <var>expr</var> is not an equation, the
equation <code><var>expr</var> = 0</code> is assumed in its place.
<var>x</var> may be a function (e.g. <code>f(x)</code>), or other non-atomic expression
except a sum or product. <var>x</var> may be omitted if <var>expr</var> contains only one
variable. <var>expr</var> may be a rational expression, and may contain
trigonometric functions, exponentials, etc.
</p>
<p>The following method is used:
</p>
<p>Let <var>E</var> be the expression and <var>X</var> be the variable. If <var>E</var> is linear
in <var>X</var> then it is trivially solved for <var>X</var>. Otherwise if <var>E</var> is of
the form <code>A*X^N + B</code> then the result is <code>(-B/A)^1/N)</code> times the
<code>N</code>'th roots of unity.
</p>
<p>If <var>E</var> is not linear in <var>X</var> then the gcd of the exponents of <var>X</var> in
<var>E</var> (say <var>N</var>) is divided into the exponents and the multiplicity of the
roots is multiplied by <var>N</var>. Then <code>solve</code> is called again on the
result. If <var>E</var> factors then <code>solve</code> is called on each of the factors.
Finally <code>solve</code> will use the quadratic, cubic, or quartic formulas where
necessary.
</p>
<p>In the case where <var>E</var> is a polynomial in some function of the variable to be
solved for, say <code>F(X)</code>, then it is first solved for <code>F(X)</code> (call the
result <var>C</var>), then the equation <code>F(X)=C</code> can be solved for <var>X</var>
provided the inverse of the function <var>F</var> is known.
</p>
<p><code><a href="#breakup">breakup</a></code> if <code>false</code> will cause <code>solve</code> to express the solutions
of cubic or quartic equations as single expressions rather than as made
up of several common subexpressions which is the default.
</p>
<p><code><a href="#multiplicities">multiplicities</a></code> - will be set to a list of the multiplicities of the
individual solutions returned by <code>solve</code>, <code><a href="#realroots">realroots</a></code>, or
<code><a href="#allroots">allroots</a></code>. Try <code>apropos (solve)</code> for the switches which affect
<code>solve</code>. <code><a href="maxima_3.html#describe">describe</a></code> may then by used on the individual switch names
if their purpose is not clear.
</p>
<p><code>solve ([<var>eqn_1</var>, ..., <var>eqn_n</var>], [<var>x_1</var>, ..., <var>x_n</var>])</code>
solves a system of simultaneous (linear or non-linear) polynomial equations by
calling <code><a href="#linsolve">linsolve</a></code> or <code><a href="#algsys">algsys</a></code> and returns a list of the solution
lists in the variables. In the case of <code>linsolve</code> this list would contain
a single list of solutions. It takes two lists as arguments. The first list
represents the equations to be solved; the second list is a
list of the unknowns to be determined. If the total number of
variables in the equations is equal to the number of equations, the
second argument-list may be omitted.
</p>
<p>When <code><a href="#programmode">programmode</a></code> is <code>false</code>, <code>solve</code> displays solutions with
intermediate expression (<code>%t</code>) labels, and returns the list of labels.
</p>
<p>When <code><a href="#globalsolve">globalsolve</a></code> is <code>true</code> and the problem is to solve two or more
linear equations, each solved-for variable is bound to its value in the solution
of the equations.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) solve (asin (cos (3*x))*(f(x) - 1), x);
solve: using arc-trig functions to get a solution.
Some solutions will be lost.
%pi
(%o1) [x = ---, f(x) = 1]
6
(%i2) ev (solve (5^f(x) = 125, f(x)), solveradcan);
log(125)
(%o2) [f(x) = --------]
log(5)
(%i3) [4*x^2 - y^2 = 12, x*y - x = 2];
2 2
(%o3) [4 x - y = 12, x y - x = 2]
(%i4) solve (%, [x, y]);
(%o4) [[x = 2, y = 2], [x = .5202594388652008 %i
- .1331240357358706, y = .07678378523787788
- 3.608003221870287 %i], [x = - .5202594388652008 %i
- .1331240357358706, y = 3.608003221870287 %i
+ .07678378523787788], [x = - 1.733751846381093,
y = - .1535675710019696]]
(%i5) solve (1 + a*x + x^3, x);
3
sqrt(3) %i 1 sqrt(4 a + 27) 1 1/3
(%o5) [x = (- ---------- - -) (--------------- - -)
2 2 6 sqrt(3) 2
sqrt(3) %i 1
(---------- - -) a
2 2
- --------------------------, x =
3
sqrt(4 a + 27) 1 1/3
3 (--------------- - -)
6 sqrt(3) 2
3
sqrt(3) %i 1 sqrt(4 a + 27) 1 1/3
(---------- - -) (--------------- - -)
2 2 6 sqrt(3) 2
sqrt(3) %i 1
(- ---------- - -) a
2 2
- --------------------------, x =
3
sqrt(4 a + 27) 1 1/3
3 (--------------- - -)
6 sqrt(3) 2
3
sqrt(4 a + 27) 1 1/3 a
(--------------- - -) - --------------------------]
6 sqrt(3) 2 3
sqrt(4 a + 27) 1 1/3
3 (--------------- - -)
6 sqrt(3) 2
(%i6) solve (x^3 - 1);
sqrt(3) %i - 1 sqrt(3) %i + 1
(%o6) [x = --------------, x = - --------------, x = 1]
2 2
(%i7) solve (x^6 - 1);
sqrt(3) %i + 1 sqrt(3) %i - 1
(%o7) [x = --------------, x = --------------, x = - 1,
2 2
sqrt(3) %i + 1 sqrt(3) %i - 1
x = - --------------, x = - --------------, x = 1]
2 2
(%i8) ev (x^6 - 1, %[1]);
6
(sqrt(3) %i + 1)
(%o8) ----------------- - 1
64
(%i9) expand (%);
(%o9) 0
(%i10) x^2 - 1;
2
(%o10) x - 1
(%i11) solve (%, x);
(%o11) [x = - 1, x = 1]
(%i12) ev (%th(2), %[1]);
(%o12) 0
</pre>
<p>The symbols <code>%r</code> are used to denote arbitrary constants in a solution.
</p>
<pre class="example">(%i1) solve([x+y=1,2*x+2*y=2],[x,y]);
solve: dependent equations eliminated: (2)
(%o1) [[x = 1 - %r1, y = %r1]]
</pre>
<p>See <code><a href="#algsys">algsys</a></code> and <code><a href="#g_t_0025rnum_005flist">%rnum_list</a></code> for more information.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="Item_003a-solvedecomposes"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solvedecomposes</b>
<a name="IDX920"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>solvedecomposes</code> is <code>true</code>, <code>solve</code> calls
<code><a href="maxima_14.html#polydecomp">polydecomp</a></code> if asked to solve polynomials.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="solveexplicit"></a>
<a name="Item_003a-solveexplicit"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solveexplicit</b>
<a name="IDX921"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>solveexplicit</code> is <code>true</code>, inhibits <code><a href="#solve">solve</a></code> from returning
implicit solutions, that is, solutions of the form <code>F(x) = 0</code> where
<code>F</code> is some function.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="solvefactors"></a>
<a name="Item_003a-solvefactors"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solvefactors</b>
<a name="IDX922"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>solvefactors</code> is <code>false</code>, <code><a href="#solve">solve</a></code> does not try to factor
the expression. The <code>false</code> setting may be desired in some cases where
factoring is not necessary.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="solvenullwarn"></a>
<a name="Item_003a-solvenullwarn"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solvenullwarn</b>
<a name="IDX923"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>solvenullwarn</code> is <code>true</code>, <code><a href="#solve">solve</a></code> prints a warning message
if called with either a null equation list or a null variable list. For
example, <code>solve ([], [])</code> would print two warning messages and return
<code>[]</code>.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="solveradcan"></a>
<a name="Item_003a-solveradcan"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solveradcan</b>
<a name="IDX924"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>solveradcan</code> is <code>true</code>, <code><a href="#solve">solve</a></code> calls <code><a href="maxima_9.html#radcan">radcan</a></code>
which makes <code>solve</code> slower but will allow certain problems containing
exponentials and logarithms to be solved.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="solvetrigwarn"></a>
<a name="Item_003a-solvetrigwarn"></a>
</p><dl>
<dt><u>Option variable:</u> <b>solvetrigwarn</b>
<a name="IDX925"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>solvetrigwarn</code> is <code>true</code>, <code><a href="#solve">solve</a></code> may print a message
saying that it is using inverse trigonometric functions to solve the equation,
and thereby losing solutions.
</p>
<div class=categorybox>
·
<p>@ref{Category: Algebraic equations}
</div>
</p></dd></dl>
<p><a name="Item_003a-Differential-Equations"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC102" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_21.html#SEC104" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_82.html#SEC380" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>root</em> on <em>January, 10 2014</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|