File: maxima_79.html

package info (click to toggle)
maxima 5.47.0-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 193,104 kB
  • sloc: lisp: 434,678; fortran: 14,665; tcl: 10,990; sh: 4,577; makefile: 2,763; ansic: 447; java: 328; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (1425 lines) | stat: -rw-r--r-- 60,273 bytes parent folder | download | duplicates (2)
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
<!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 Manual: Functions and Variables for Equations</title>

<meta name="description" content="Maxima Manual: Functions and Variables for Equations">
<meta name="keywords" content="Maxima Manual: Functions and Variables for Equations">
<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_264.html#g_t_0423_043a_0430_0437_0430_0442_0435_043b_044c-_0444_0443_043d_043a_0446_0438_0439-_0438-_043f_0435_0440_0435_043c_0435_043d_043d_044b_0445" rel="index" title="Указатель функций и переменных">
<link href="maxima_toc.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="maxima_78.html#Equations" rel="up" title="Equations">
<link href="maxima_80.html#g_t_0414_0438_0444_0444_0435_0440_0435_043d_0446_0438_0430_043b_044c_043d_044b_0435-_0443_0440_0430_0432_043d_0435_043d_0438_044f" rel="next" title="Дифференциальные уравнения">
<link href="maxima_78.html#Equations" rel="previous" title="Equations">
<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="ru" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Functions-and-Variables-for-Equations"></a>
<div class="header">
<p>
Previous: <a href="maxima_78.html#Equations" accesskey="p" rel="previous">Equations</a>, Up: <a href="maxima_78.html#Equations" accesskey="u" rel="up">Equations</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_264.html#g_t_0423_043a_0430_0437_0430_0442_0435_043b_044c-_0444_0443_043d_043a_0446_0438_0439-_0438-_043f_0435_0440_0435_043c_0435_043d_043d_044b_0445" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-and-Variables-for-Equations-1"></a>
<h3 class="section">19.1 Functions and Variables for Equations</h3>

<a name="g_t_0025rnum"></a><a name="Item_003a-Equations_002fdefvr_002f_0025rnum"></a><dl>
<dt><a name="index-_0025rnum"></a>System variable: <strong>%rnum</strong></dt>
<dd><p>Default value: <code>0</code>
</p>
<p><code>%rnum</code> is the counter for the <code>%r</code> variables introduced in solutions by
<code><a href="#solve">solve</a></code> and <code><a href="#algsys">algsys</a></code>..  The next <code>%r</code> variable is numbered
<code>%rnum+1</code>.
</p>
<p>See also <code><a href="#g_t_0025rnum_005flist">%rnum_list</a></code>.
</p>



</dd></dl>

<a name="g_t_0025rnum_005flist"></a><a name="Item_003a-Equations_002fdefvr_002f_0025rnum_005flist"></a><dl>
<dt><a name="index-_0025rnum_005flist"></a>System variable: <strong>%rnum_list</strong></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.
</p>
<p>See also <code><a href="#g_t_0025rnum">%rnum</a></code>.
</p>
<p>It&rsquo;s recommended to use this list rather than doing <code>concat ('%r, j)</code>.
</p>
<div class="example">
<pre class="example">(%i1) solve ([x + y = 3], [x,y]);
(%o1)              [[x = 3 - %r1, y = %r1]]
</pre><pre class="example">(%i2) %rnum_list;
(%o2)                       [%r1]
</pre><pre class="example">(%i3) sol : solve ([x + 2*y + 3*z = 4], [x,y,z]);
(%o3)   [[x = - 2 %r3 - 3 %r2 + 4, y = %r3, z = %r2]]
</pre><pre class="example">(%i4) %rnum_list;
(%o4)                     [%r2, %r3]
</pre><pre class="example">(%i5) for i : 1 thru length (%rnum_list) do
        sol : subst (t[i], %rnum_list[i], sol)$
</pre><pre class="example">(%i6) sol;
(%o6)     [[x = - 2 t  - 3 t  + 4, y = t , z = t ]]
                     2      1           2       1
</pre></div>




</dd></dl>

<a name="algepsilon"></a><a name="Item_003a-Equations_002fdefvr_002falgepsilon"></a><dl>
<dt><a name="index-algepsilon"></a>Option variable: <strong>algepsilon</strong></dt>
<dd><p>Default value: 10^8
</p>
<p><code>algepsilon</code> is used by <code><a href="#algsys">algsys</a></code>.
</p>



</dd></dl>

<a name="algexact"></a><a name="Item_003a-Equations_002fdefvr_002falgexact"></a><dl>
<dt><a name="index-algexact"></a>Option variable: <strong>algexact</strong></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>&rsquo;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>




</dd></dl>

<a name="algsys"></a><a name="Item_003a-Equations_002fdeffn_002falgsys"></a><dl>
<dt><a name="index-algsys"></a>Function: <strong>algsys</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>algsys</tt> ([<var>expr_1</var>, &hellip;, <var>expr_m</var>], [<var>x_1</var>, &hellip;, <var>x_n</var>]) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>algsys</tt> ([<var>eqn_1</var>, &hellip;, <var>eqn_m</var>], [<var>x_1</var>, &hellip;, <var>x_n</var>])</em></dt>
<dd>
<p>Solves the simultaneous polynomials <var>expr_1</var>, &hellip;, <var>expr_m</var> or
polynomial equations <var>eqn_1</var>, &hellip;, <var>eqn_m</var> for the variables
<var>x_1</var>, &hellip;, <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>, &hellip;, <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>, &hellip;, 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&rsquo;</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:
&quot;<code>algsys</code> cannot solve - system too complicated.&quot;
</p>
<p>Interactions with <code><a href="maxima_30.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_27.html#pickapart">pickapart</a></code> or <code><a href="maxima_41.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>
<div class="example">
<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>




</dd></dl>

<a name="allroots"></a><a name="Item_003a-Equations_002fdeffn_002fallroots"></a><dl>
<dt><a name="index-allroots"></a>Function: <strong>allroots</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>allroots</tt> (<var>expr</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>allroots</tt> (<var>eqn</var>)</em></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>&rsquo;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>
<div class="example">
<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>





</dd></dl>

<a name="bfallroots"></a><a name="Item_003a-Equations_002fdeffn_002fbfallroots"></a><dl>
<dt><a name="index-bfallroots"></a>Function: <strong>bfallroots</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>bfallroots</tt> (<var>expr</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>bfallroots</tt> (<var>eqn</var>)</em></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>




</dd></dl>

<a name="backsubst"></a><a name="Item_003a-Equations_002fdefvr_002fbacksubst"></a><dl>
<dt><a name="index-backsubst"></a>Option variable: <strong>backsubst</strong></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>
<div class="example">
<pre class="example">(%i1) eq1 : x + y + z = 6$
(%i2) eq2 : x - y + z = 2$
(%i3) eq3 : x + y - z = 0$
(%i4) backsubst : false$
</pre><pre class="example">(%i5) linsolve ([eq1, eq2, eq3], [x,y,z]);
(%o5)             [x = z - y, y = 2, z = 3]
</pre><pre class="example">(%i6) backsubst : true$
</pre><pre class="example">(%i7) linsolve ([eq1, eq2, eq3], [x,y,z]);
(%o7)               [x = 1, y = 2, z = 3]
</pre></div>




</dd></dl>

<a name="breakup"></a><a name="Item_003a-Equations_002fdefvr_002fbreakup"></a><dl>
<dt><a name="index-breakup"></a>Option variable: <strong>breakup</strong></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>
<div class="example">
<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
</pre><pre class="example">           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
</pre><pre class="example">            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>




</dd></dl>

<a name="dimension"></a><a name="Item_003a-Equations_002fdeffn_002fdimension"></a><dl>
<dt><a name="index-dimension"></a>Function: <strong>dimension</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>dimension</tt> (<var>eqn</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>dimension</tt> (<var>eqn_1</var>, &hellip;, <var>eqn_n</var>)</em></dt>
<dd>
<p><code>dimen</code> is a package for dimensional analysis.
<code>load (&quot;dimen&quot;)</code> loads this package.
<code>demo (&quot;dimen&quot;)</code> displays a short demonstration.
</p>



</dd></dl>

<a name="dispflag"></a><a name="Item_003a-Equations_002fdefvr_002fdispflag"></a><dl>
<dt><a name="index-dispflag"></a>Option variable: <strong>dispflag</strong></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, <code>$</code>, sets <code>dispflag</code> to
<code>false</code>.
</p>




</dd></dl>


<a name="funcsolve"></a><a name="Item_003a-Equations_002fdeffn_002ffuncsolve"></a><dl>
<dt><a name="index-funcsolve"></a>Function: <strong>funcsolve</strong> <em>(<var>eqn</var>, <var>g</var>(<var>t</var>))</em></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>
<div class="example">
<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></div>

<p>Warning: this is a very rudimentary implementation &ndash; many safety checks
and obvious generalizations are missing.
</p>



</dd></dl>

<a name="globalsolve"></a><a name="Item_003a-Equations_002fdefvr_002fglobalsolve"></a><dl>
<dt><a name="index-globalsolve"></a>Option variable: <strong>globalsolve</strong></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>
<div class="example">
<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>




</dd></dl>



<a name="ieqn"></a><a name="Item_003a-Equations_002fdeffn_002fieqn"></a><dl>
<dt><a name="index-ieqn"></a>Function: <strong>ieqn</strong> <em>(<var>ie</var>, <var>unk</var>, <var>tech</var>, <var>n</var>, <var>guess</var>)</em></dt>
<dd>
<p><code>inteqn</code> is a package for solving integral equations.
<code>load (&quot;inteqn&quot;)</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 in the lists
below; (<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>Two types of equations are considered. A second-kind equation of the
following form,
</p><div class="example">
<pre class="example">                           b(x)
                          /
                          [
        p(x) = q(x, p(x), I     w(x, u, p(x), p(u)) du)
                          ]
                          /
                           a(x)
</pre></div>

<p>and a first-kind equation with the form
</p><div class="example">
<pre class="example">                         b(x)
                        /
                        [
                 f(x) = I     w(x, u, p(u)) du
                        ]
                        /
                         a(x)
</pre></div>

<p>The different solution techniques used require particular forms of the
expressions <var>q</var> and <var>w</var>. The techniques available are the following:
</p>
<p><b>Second-kind equations</b>
</p><ul>
<li> <code>flfrnk2nd</code>: For fixed-limit, finite-rank integrands.
</li><li> <code>vlfrnk</code>: For variable-limit, finite-rank integrands.
</li><li> <code>transform</code>: Laplace transform for convolution types.
</li><li> <code>fredseries</code>: Fredholm-Carleman series for linear equations.
</li><li> <code>tailor</code>: Taylor series for quasi-linear variable-limit equations.
</li><li> <code>neumann</code>: Neumann series for quasi-second kind equations.
</li><li> <code>collocate</code>: Collocation using a power series form for p(x)
evaluated at equally spaced points.
</li></ul>

<p><b>First-kind equations</b>
</p><ul>
<li> <code>flfrnk1st</code>: For fixed-limit, finite-rank integrands.
</li><li> <code>vlfrnk</code>: For variable-limit, finite-rank integrands.
</li><li> <code>abel</code>: For singular integrands
</li><li> <code>transform</code>: See above
</li><li> <code>collocate</code>: See above
</li><li> <code>firstkindseries</code>: Iteration technique similar to neumann series.
</li></ul>

<p>The default values for the 2nd thru 5th parameters in the calling form
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. <var>tech</var>: <code>first</code>. <var>n</var>: 1.
<var>guess</var>: <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>
<p>Examples:
</p><div class="example">
<pre class="example">(%i1) load(&quot;inteqn&quot;)$

(%i2) e: p(x) - 1 -x + cos(x) + 'integrate(cos(x-u)*p(u),u,0,x)$

(%i3) ieqn(e, p(x), 'transform);
default 4th arg, number of iterations or coll. parms.:  1 
default 5th arg, initial guess:  none 

(%t3)                           [x, transform]
(%o3)                               [%t3]
(%i4) e: 2*'integrate(p(x*sin(u)), u, 0, %pi/2) - a*x - b$

(%i5) ieqn(e, p(x), 'firstkindseries);
default 4th arg, number of iterations or coll. parms.:  1 
default 5th arg, initial guess:  none 

(%t5)          [2 a x + %pi b, firstkindseries, 1, approximate]
(%o5)                               [%t5]
</pre></div>




</dd></dl>

<a name="ieqnprint"></a><a name="Item_003a-Equations_002fdefvr_002fieqnprint"></a><dl>
<dt><a name="index-ieqnprint"></a>Option variable: <strong>ieqnprint</strong></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>



</dd></dl>

<a name="lhs"></a><a name="Item_003a-Equations_002fdeffn_002flhs"></a><dl>
<dt><a name="index-lhs"></a>Function: <strong>lhs</strong> <em>(<var>expr</var>)</em></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>&lt; &lt;= = # equal notequal &gt;= &gt;</code>,
one of the assignment operators <code>:= ::= : ::</code>, or a user-defined binary
infix operator, as declared by <code><a href="maxima_27.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>
<div class="example">
<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 &lt; bb), lhs (aa &lt;= bb), lhs (aa &gt;= bb),
       lhs (aa &gt; 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 (&quot;][&quot;);
(%o11)                         ][
(%i12) lhs (aa ][ bb);
(%o12)                         aa
</pre></div>




</dd></dl>


<a name="linsolve"></a><a name="Item_003a-Equations_002fdeffn_002flinsolve"></a><dl>
<dt><a name="index-linsolve"></a>Function: <strong>linsolve</strong> <em>([<var>expr_1</var>, &hellip;, <var>expr_m</var>], [<var>x_1</var>, &hellip;, <var>x_n</var>])</em></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.
If the length of the list of variables doesn&rsquo;t match the number of
linearly-independent equations to solve the result will be an empty list.
</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>
<p>See also <code><a href="#algsys">algsys</a></code>, <code><a href="maxima_46.html#eliminate">eliminate</a></code>. and <code><a href="#solve">solve</a></code>.
</p>
<p>Examples:
</p><div class="example">
<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>




</dd></dl>


<a name="linsolvewarn"></a><a name="Item_003a-Equations_002fdefvr_002flinsolvewarn"></a><dl>
<dt><a name="index-linsolvewarn"></a>Option variable: <strong>linsolvewarn</strong></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
&quot;Dependent equations eliminated&quot;.
</p>



</dd></dl>

<a name="linsolve_005fparams"></a><a name="Item_003a-Equations_002fdefvr_002flinsolve_005fparams"></a><dl>
<dt><a name="index-linsolve_005fparams"></a>Option variable: <strong>linsolve_params</strong></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>



</dd></dl>

<a name="multiplicities"></a><a name="Item_003a-Equations_002fdefvr_002fmultiplicities"></a><dl>
<dt><a name="index-multiplicities"></a>System variable: <strong>multiplicities</strong></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>




</dd></dl>

<a name="nroots"></a><a name="Item_003a-Equations_002fdeffn_002fnroots"></a><dl>
<dt><a name="index-nroots"></a>Function: <strong>nroots</strong> <em>(<var>p</var>, <var>low</var>, <var>high</var>)</em></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>
<div class="example">
<pre class="example">(%i1) p: x^10 - 2*x^4 + 1/2$
(%i2) nroots (p, -6, 9.1);
(%o2)                           4
</pre></div>





</dd></dl>


<a name="nthroot"></a><a name="Item_003a-Equations_002fdeffn_002fnthroot"></a><dl>
<dt><a name="index-nthroot"></a>Function: <strong>nthroot</strong> <em>(<var>p</var>, <var>n</var>)</em></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_46.html#factor">factor</a></code> or even
<code><a href="maxima_46.html#sqfr">sqfr</a></code>.
</p>



</dd></dl>

<a name="polyfactor"></a><a name="Item_003a-Equations_002fdefvr_002fpolyfactor"></a><dl>
<dt><a name="index-polyfactor"></a>Option variable: <strong>polyfactor</strong></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>




</dd></dl>

<a name="programmode"></a><a name="Item_003a-Equations_002fdefvr_002fprogrammode"></a><dl>
<dt><a name="index-programmode"></a>Option variable: <strong>programmode</strong></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>,<!-- /@w -->
<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>




</dd></dl>

<a name="realonly"></a><a name="Item_003a-Equations_002fdefvr_002frealonly"></a><dl>
<dt><a name="index-realonly"></a>Option variable: <strong>realonly</strong></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>



</dd></dl>

<a name="realroots"></a><a name="Item_003a-Equations_002fdeffn_002frealroots"></a><dl>
<dt><a name="index-realroots"></a>Function: <strong>realroots</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>realroots</tt> (<var>expr</var>, <var>bound</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>realroots</tt> (<var>eqn</var>, <var>bound</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>realroots</tt> (<var>expr</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>realroots</tt> (<var>eqn</var>)</em></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>`float'</code> or <code>`numer'</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>, &hellip;,
assigns the results to them, and returns the list of labels.
</p>
<p>See also <code><a href="#allroots">allroots</a></code>, <code><a href="#bfallroots">bfallroots</a></code>, <code>`guess_exact_value'</code>,
and <code><a href="#lhs">lhs</a></code>.
</p>
<p>Examples:
</p>
<div class="example">
<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></div>

<div class="example">
<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>





</dd></dl>

<a name="rhs"></a><a name="Item_003a-Equations_002fdeffn_002frhs"></a><dl>
<dt><a name="index-rhs"></a>Function: <strong>rhs</strong> <em>(<var>expr</var>)</em></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>&lt; &lt;= = # equal notequal &gt;= &gt;</code>,
one of the assignment operators <code>:= ::= : ::</code>, or a user-defined binary
infix operator, as declared by <code><a href="maxima_27.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>
<div class="example">
<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 &lt; bb), rhs (aa &lt;= bb), rhs (aa &gt;= bb),
       rhs (aa &gt; bb)];
(%o4)                   [bb, bb, bb, bb]
</pre><pre class="example">(%i5) [rhs (aa = bb), rhs (aa # bb), rhs (equal (aa, bb)),
       rhs (notequal (aa, bb))];
</pre><pre class="example">(%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 (&quot;][&quot;);
(%o11)                         ][
(%i12) rhs (aa ][ bb);
(%o12)                         bb
</pre></div>




</dd></dl>

<a name="rootsconmode"></a><a name="Item_003a-Equations_002fdefvr_002frootsconmode"></a><dl>
<dt><a name="index-rootsconmode"></a>Option variable: <strong>rootsconmode</strong></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>




</dd></dl>


<a name="rootscontract"></a><a name="Item_003a-Equations_002fdeffn_002frootscontract"></a><dl>
<dt><a name="index-rootscontract"></a>Function: <strong>rootscontract</strong> <em>(<var>expr</var>)</em></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_30.html#radexpand">radexpand</a></code> is <code>true</code> and <code><a href="maxima_30.html#domain">domain</a></code> is <code>real</code>,
<code>rootscontract</code> converts <code><a href="maxima_18.html#abs">abs</a></code> into <code><a href="maxima_18.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>
<div class="example">
<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></div>

<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_46.html#ratsimp">ratsimp</a></code> in a manner similar to
<code>`logcontract'</code>.
</p>
<p>Examples:
</p>
<div class="example">
<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>




</dd></dl>

<a name="rootsepsilon"></a><a name="Item_003a-Equations_002fdefvr_002frootsepsilon"></a><dl>
<dt><a name="index-rootsepsilon"></a>Option variable: <strong>rootsepsilon</strong></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>




</dd></dl>


<a name="solve"></a><a name="Item_003a-Equations_002fdeffn_002fsolve"></a><dl>
<dt><a name="index-solve"></a>Function: <strong>solve</strong> <em><br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>solve</tt> (<var>expr</var>, <var>x</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>solve</tt> (<var>expr</var>) <br>&nbsp;&nbsp;&nbsp;&nbsp;<tt>solve</tt> ([<var>eqn_1</var>, &hellip;, <var>eqn_n</var>], [<var>x_1</var>, &hellip;, <var>x_n</var>])</em></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>&rsquo;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_7.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><a href="#linsolve">linsolve</a></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>
<div class="example">
<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]);
</pre><pre class="example">                                      6
                      (sqrt(3) %i + 1)
(%o8)                 ----------------- - 1
                             64
</pre><pre class="example">(%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></div>

<p>The symbols <code>%r</code> are used to denote arbitrary constants in a solution.
</p>
<div class="example">
<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></div>

<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>



</dd></dl>

<a name="solvedecomposes"></a><a name="Item_003a-Equations_002fdefvr_002fsolvedecomposes"></a><dl>
<dt><a name="index-solvedecomposes"></a>Option variable: <strong>solvedecomposes</strong></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_46.html#polydecomp">polydecomp</a></code> if asked to solve polynomials.
</p>



</dd></dl>

<a name="solveexplicit"></a><a name="Item_003a-Equations_002fdefvr_002fsolveexplicit"></a><dl>
<dt><a name="index-solveexplicit"></a>Option variable: <strong>solveexplicit</strong></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>



</dd></dl>

<a name="solvefactors"></a><a name="Item_003a-Equations_002fdefvr_002fsolvefactors"></a><dl>
<dt><a name="index-solvefactors"></a>Option variable: <strong>solvefactors</strong></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>



</dd></dl>

<a name="solvenullwarn"></a><a name="Item_003a-Equations_002fdefvr_002fsolvenullwarn"></a><dl>
<dt><a name="index-solvenullwarn"></a>Option variable: <strong>solvenullwarn</strong></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>



</dd></dl>

<a name="solveradcan"></a><a name="Item_003a-Equations_002fdefvr_002fsolveradcan"></a><dl>
<dt><a name="index-solveradcan"></a>Option variable: <strong>solveradcan</strong></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_30.html#radcan">radcan</a></code><!-- /@w -->
which makes <code>solve</code> slower but will allow certain problems containing
exponentials and logarithms to be solved.
</p>



</dd></dl>

<a name="solvetrigwarn"></a><a name="Item_003a-Equations_002fdefvr_002fsolvetrigwarn"></a><dl>
<dt><a name="index-solvetrigwarn"></a>Option variable: <strong>solvetrigwarn</strong></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>



</dd></dl>


<hr>
<div class="header">
<p>
Previous: <a href="maxima_78.html#Equations" accesskey="p" rel="previous">Equations</a>, Up: <a href="maxima_78.html#Equations" accesskey="u" rel="up">Equations</a> &nbsp; [<a href="maxima_toc.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="maxima_264.html#g_t_0423_043a_0430_0437_0430_0442_0435_043b_044c-_0444_0443_043d_043a_0446_0438_0439-_0438-_043f_0435_0440_0435_043c_0435_043d_043d_044b_0445" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>