File: maxima_12.html

package info (click to toggle)
maxima 5.10.0-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 44,268 kB
  • ctags: 17,987
  • sloc: lisp: 152,894; fortran: 14,667; perl: 14,204; tcl: 10,103; sh: 3,376; makefile: 2,202; ansic: 471; awk: 7
file content (1825 lines) | stat: -rw-r--r-- 72,420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 20 2006 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Maxima Manual: 12. Polynomials</title>

<meta name="description" content="Maxima Manual: 12. Polynomials">
<meta name="keywords" content="Maxima Manual: 12. Polynomials">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
    color: black;
    background: white; 
    margin-left: 8%;
    margin-right: 13%;
}

h1
{
    margin-left: +8%;
    font-size: 150%;
    font-family: sans-serif
}

h2
{
    font-size: 125%;
    font-family: sans-serif
}

h3
{
    font-size: 100%;
    font-family: sans-serif
}

h2,h3,h4,h5,h6 { margin-left: +4%; }

div.textbox
{
    border: solid;
    border-width: thin;
    /* width: 100%; */
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em
}

div.titlebox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
    background: rgb(200,255,255);
    font-family: sans-serif
}

div.synopsisbox
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 2em;
    padding-right: 2em;
     background: rgb(255,220,255);
    /*background: rgb(200,255,255); */
    /* font-family: fixed */
}

pre.example
{
    border: none;
    padding-top: 1em;
    padding-bottom: 1em;
    padding-left: 1em;
    padding-right: 1em;
    background: rgb(247,242,180); /* kind of sandy */
    /* background: rgb(200,255,255); */ /* sky blue */
    font-family: "Lucida Console", monospace
}

div.spacerbox
{
    border: none;
    padding-top: 2em;
    padding-bottom: 2em
}

div.image
{
    margin: 0;
    padding: 1em;
    text-align: center;
}
-->
</style>

<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">

<a name="Polynomials"></a>
<a name="SEC44"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_11.html#SEC43" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC45" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima_11.html#SEC42" title="Beginning of this chapter or previous chapter"> &lt;&lt; </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_13.html#SEC47" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 12. Polynomials </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC45">12.1 Introduction to Polynomials</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC46">12.2 Definitions for Polynomials</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  
</td></tr>
</table>

<hr size="6">
<a name="Introduction-to-Polynomials"></a>
<a name="SEC45"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC44" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC46" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC44" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC44" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_13.html#SEC47" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 12.1 Introduction to Polynomials </h2>

<p>Polynomials are stored in Maxima either in General Form or as
Cannonical Rational Expressions (CRE) form.  The latter is a standard
form, and is used internally by operations such as factor, ratsimp, and
so on.
</p>
<p>Canonical Rational Expressions constitute a kind of representation
which is especially suitable for expanded polynomials and rational
functions (as well as for partially factored polynomials and rational
functions when RATFAC is set to <code>true</code>).  In this CRE form an
ordering of variables (from most to least main) is assumed for each
expression.  Polynomials are represented recursively by a list
consisting of the main variable followed by a series of pairs of
expressions, one for each term of the polynomial.  The first member of
each pair is the exponent of the main variable in that term and the
second member is the coefficient of that term which could be a number or
a polynomial in another variable again represented in this form.  Thus
the principal part of the CRE form of 3*X^2-1 is (X 2 3 0 -1) and that
of 2*X*Y+X-3 is (Y 1 (X 1 2) 0 (X 1 1 0 -3)) assuming Y is the main
variable, and is (X 1 (Y 1 2 0 1) 0 -3) assuming X is the main
variable. &quot;Main&quot;-ness is usually determined by reverse alphabetical
order.  The &quot;variables&quot; of a CRE expression needn't be atomic.  In fact
any subexpression whose main operator is not + - * / or ^ with integer
power will be considered a &quot;variable&quot; of the expression (in CRE form) in
which it occurs.  For example the CRE variables of the expression
X+SIN(X+1)+2*SQRT(X)+1 are X, SQRT(X), and SIN(X+1).  If the user does
not specify an ordering of variables by using the RATVARS function
Maxima will choose an alphabetic one.  In general, CRE's represent
rational expressions, that is, ratios of polynomials, where the
numerator and denominator have no common factors, and the denominator is
positive.  The internal form is essentially a pair of polynomials (the
numerator and denominator) preceded by the variable ordering list.  If
an expression to be displayed is in CRE form or if it contains any
subexpressions in CRE form, the symbol /R/ will follow the line label.
See the RAT function for converting an expression to CRE form.  An
extended CRE form is used for the representation of Taylor series.  The
notion of a rational expression is extended so that the exponents of the
variables can be positive or negative rational numbers rather than just
positive integers and the coefficients can themselves be rational
expressions as described above rather than just polynomials.  These are
represented internally by a recursive polynomial form which is similar
to and is a generalization of CRE form, but carries additional
information such as the degree of truncation.  As with CRE form, the
symbol /T/ follows the line label of such expressions.
</p>
<hr size="6">
<a name="Definitions-for-Polynomials"></a>
<a name="SEC46"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC45" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_13.html#SEC47" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC44" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC44" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_13.html#SEC47" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 12.2 Definitions for Polynomials </h2>

<dl>
<dt><u>Option variable:</u> <b>algebraic</b>
<a name="IDX382"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>algebraic</code> must be set to <code>true</code> in order for the
simplification of algebraic integers to take effect.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>berlefact</b>
<a name="IDX383"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>berlefact</code> is <code>false</code> then the Kronecker factoring
algorithm will be used otherwise the Berlekamp algorithm, which is the
default, will be used.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>bezout</b><i> (<var>p1</var>, <var>p2</var>, <var>x</var>)</i>
<a name="IDX384"></a>
</dt>
<dd><p>an alternative to the <code>resultant</code> command.  It
returns a matrix. <code>determinant</code> of this matrix is the desired resultant.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>bothcoef</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX385"></a>
</dt>
<dd><p>Returns a list whose first member is the
coefficient of <var>x</var> in <var>expr</var> (as found by <code>ratcoef</code> if <var>expr</var> is in CRE form
otherwise by <code>coeff</code>) and whose second member is the remaining part of
<var>expr</var>.  That is, <code>[A, B]</code> where <code><var>expr</var> = A*<var>x</var> + B</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) islinear (expr, x) := block ([c],
        c: bothcoef (rat (expr, x), x),
        is (freeof (x, c) and c[1] # 0))$
(%i2) islinear ((r^2 - (x - r)^2)/x, x);
(%o2)                         true
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>coeff</b><i> (<var>expr</var>, <var>x</var>, <var>n</var>)</i>
<a name="IDX386"></a>
</dt>
<dd><p>Returns the coefficient of <code><var>x</var>^<var>n</var></code> in <var>expr</var>.  <var>n</var> may be
omitted if it is 1.  <var>x</var> may be an atom, or complete subexpression of
<var>expr</var> e.g., <code>sin(x)</code>, <code>a[i+1]</code>, <code>x + y</code>, etc. (In the last case the
expression <code>(x + y)</code> should occur in <var>expr</var>).  Sometimes it may be necessary
to expand or factor <var>expr</var> in order to make <code><var>x</var>^<var>n</var></code> explicit.  This is not
done automatically by <code>coeff</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) coeff (2*a*tan(x) + tan(x) + b = 5*tan(x) + 3, tan(x));
(%o1)                      2 a + 1 = 5
(%i2) coeff (y + x*%e^x + 1, x, 0);
(%o2)                         y + 1
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>combine</b><i> (<var>expr</var>)</i>
<a name="IDX387"></a>
</dt>
<dd><p>Simplifies the sum <var>expr</var> by combining terms with the same
denominator into a single term.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>content</b><i> (<var>p_1</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX388"></a>
</dt>
<dd><p>Returns a list whose first element is
the greatest common divisor of the coefficients of the terms of the
polynomial <var>p_1</var> in the variable <var>x_n</var> (this is the content) and whose
second element is the polynomial <var>p_1</var> divided by the content.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) content (2*x*y + 4*x^2*y^2, y);
                                   2
(%o1)                   [2 x, 2 x y  + y]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>denom</b><i> (<var>expr</var>)</i>
<a name="IDX389"></a>
</dt>
<dd><p>Returns the denominator of the rational expression <var>expr</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>divide</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX390"></a>
</dt>
<dd><p>computes the quotient and remainder
of the polynomial <var>p_1</var> divided by the polynomial <var>p_2</var>, in a main
polynomial variable, <var>x_n</var>.
The other variables are as in the <code>ratvars</code> function.
The result is a list whose first element is the quotient
and whose second element is the remainder.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) divide (x + y, x - y, x);
(%o1)                       [1, 2 y]
(%i2) divide (x + y, x - y);
(%o2)                      [- 1, 2 x]
</pre></td></tr></table>

<p>Note that <code>y</code> is the main variable in the second example.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>eliminate</b><i> ([<var>eqn_1</var>, ..., <var>eqn_n</var>], [<var>x_1</var>, ..., <var>x_k</var>])</i>
<a name="IDX391"></a>
</dt>
<dd><p>Eliminates variables from
equations (or expressions assumed equal to zero) by taking successive
resultants. This returns a list of <code><var>n</var> - <var>k</var></code> expressions with the <var>k</var>
variables <var>x_1</var>, ..., <var>x_k</var> eliminated.  First <var>x_1</var> is eliminated yielding <code><var>n</var> - 1</code>
expressions, then <code>x_2</code> is eliminated, etc.  If <code><var>k</var> = <var>n</var></code> then a single expression in a
list is returned free of the variables <var>x_1</var>, ..., <var>x_k</var>.  In this case <code>solve</code>
is called to solve the last resultant for the last variable.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) expr1: 2*x^2 + y*x + z;
                                      2
(%o1)                    z + x y + 2 x
(%i2) expr2: 3*x + 5*y - z - 1;
(%o2)                  - z + 5 y + 3 x - 1
(%i3) expr3: z^2 + x - y^2 + 5;
                          2    2
(%o3)                    z  - y  + x + 5
(%i4) eliminate ([expr3, expr2, expr1], [y, z]);
             8         7         6          5          4
(%o4) [7425 x  - 1170 x  + 1299 x  + 12076 x  + 22887 x

                                    3         2
                            - 5154 x  - 1291 x  + 7688 x + 15376]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ezgcd</b><i> (<var>p_1</var>, <var>p_2</var>, <var>p_3</var>, ...)</i>
<a name="IDX392"></a>
</dt>
<dd><p>Returns a list whose first element is the g.c.d of
the polynomials <var>p_1</var>, <var>p_2</var>, <var>p_3</var>, ...  and whose remaining elements are the
polynomials divided by the g.c.d.  This always uses the <code>ezgcd</code>
algorithm.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>facexpand</b>
<a name="IDX393"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p><code>facexpand</code> controls whether the irreducible factors
returned by <code>factor</code> are in expanded (the default) or recursive (normal
CRE) form.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>factcomb</b><i> (<var>expr</var>)</i>
<a name="IDX394"></a>
</dt>
<dd><p>Tries to combine the coefficients of factorials in <var>expr</var>
with the factorials themselves by converting, for example, <code>(n + 1)*n!</code>
into <code>(n + 1)!</code>.
</p>
<p><code>sumsplitfact</code> if set to <code>false</code> will cause <code>minfactorial</code> to be
applied after a <code>factcomb</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>factor</b><i> (<var>expr</var>)</i>
<a name="IDX395"></a>
</dt>
<dd><p>Factors the expression <var>expr</var>, containing any number of
variables or functions, into factors irreducible over the integers.
<code>factor (<var>expr</var>, p)</code> factors <var>expr</var> over the field of integers with an element
adjoined whose minimum polynomial is p.
</p>
<p><code>factor</code> uses <code>ifactors</code> function for factoring integers.
</p>
<p><code>factorflag</code> if <code>false</code> suppresses the factoring of integer factors
of rational expressions.
</p>
<p><code>dontfactor</code> may be set to a list of variables with respect to which
factoring is not to occur.  (It is initially empty).  Factoring also
will not take place with respect to any variables which are less
important (using the variable ordering assumed for CRE form) than
those on the <code>dontfactor</code> list.
</p>
<p><code>savefactors</code> if <code>true</code> causes the factors of an expression which
is a product of factors to be saved by certain functions in order to
speed up later factorizations of expressions containing some of the
same factors.
</p>
<p><code>berlefact</code> if <code>false</code> then the Kronecker factoring algorithm will
be used otherwise the Berlekamp algorithm, which is the default, will
be used.
</p>
<p><code>intfaclim</code> if <code>true</code> maxima will give up factorization of
integers if no factor is found after trial divisions and Pollard's rho
method.  If set to <code>false</code> (this is the case when the user calls
<code>factor</code> explicitly), complete factorization of the integer will be
attempted.  The user's setting of <code>intfaclim</code> is used for internal
calls to <code>factor</code>. Thus, <code>intfaclim</code> may be reset to prevent
Maxima from taking an inordinately long time factoring large integers.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) factor (2^63 - 1);
                    2
(%o1)              7  73 127 337 92737 649657
(%i2) factor (-8*y - 4*x + z^2*(2*y + x));
(%o2)               (2 y + x) (z - 2) (z + 2)
(%i3) -1 - 2*x - x^2 + y^2 + 2*x*y^2 + x^2*y^2;
                2  2        2    2    2
(%o3)          x  y  + 2 x y  + y  - x  - 2 x - 1
(%i4) block ([dontfactor: [x]], factor (%/36/(1 + 2*y + y^2)));
                       2
                     (x  + 2 x + 1) (y - 1)
(%o4)                ----------------------
                           36 (y + 1)
(%i5) factor (1 + %e^(3*x));
                      x         2 x     x
(%o5)              (%e  + 1) (%e    - %e  + 1)
(%i6) factor (1 + x^4, a^2 - 2);
                    2              2
(%o6)             (x  - a x + 1) (x  + a x + 1)
(%i7) factor (-y^2*z^2 - x*z^2 + x^2*y^2 + x^3);
                       2
(%o7)              - (y  + x) (z - x) (z + x)
(%i8) (2 + x)/(3 + x)/(b + x)/(c + x)^2;
                             x + 2
(%o8)               ------------------------
                                           2
                    (x + 3) (x + b) (x + c)
(%i9) ratsimp (%);
                4                  3
(%o9) (x + 2)/(x  + (2 c + b + 3) x

     2                       2             2                   2
 + (c  + (2 b + 6) c + 3 b) x  + ((b + 3) c  + 6 b c) x + 3 b c )
(%i10) partfrac (%, x);
           2                   4                3
(%o10) - (c  - 4 c - b + 6)/((c  + (- 2 b - 6) c

     2              2         2                2
 + (b  + 12 b + 9) c  + (- 6 b  - 18 b) c + 9 b ) (x + c))

                 c - 2
 - ---------------------------------
     2                             2
   (c  + (- b - 3) c + 3 b) (x + c)

                         b - 2
 + -------------------------------------------------
             2             2       3      2
   ((b - 3) c  + (6 b - 2 b ) c + b  - 3 b ) (x + b)

                         1
 - ----------------------------------------------
             2
   ((b - 3) c  + (18 - 6 b) c + 9 b - 27) (x + 3)
(%i11) map ('factor, %);
              2
             c  - 4 c - b + 6                 c - 2
(%o11) - ------------------------- - ------------------------
                2        2                                  2
         (c - 3)  (c - b)  (x + c)   (c - 3) (c - b) (x + c)

                       b - 2                        1
            + ------------------------ - ------------------------
                             2                          2
              (b - 3) (c - b)  (x + b)   (b - 3) (c - 3)  (x + 3)
(%i12) ratsimp ((x^5 - 1)/(x - 1));
                       4    3    2
(%o12)                x  + x  + x  + x + 1
(%i13) subst (a, x, %);
                       4    3    2
(%o13)                a  + a  + a  + a + 1
(%i14) factor (%th(2), %);
                       2        3        3    2
(%o14)   (x - a) (x - a ) (x - a ) (x + a  + a  + a + 1)
(%i15) factor (1 + x^12);
                       4        8    4
(%o15)               (x  + 1) (x  - x  + 1)
(%i16) factor (1 + x^99);
                 2            6    3
(%o16) (x + 1) (x  - x + 1) (x  - x  + 1)

   10    9    8    7    6    5    4    3    2
 (x   - x  + x  - x  + x  - x  + x  - x  + x  - x + 1)

   20    19    17    16    14    13    11    10    9    7    6
 (x   + x   - x   - x   + x   + x   - x   - x   - x  + x  + x

    4    3            60    57    51    48    42    39    33
 - x  - x  + x + 1) (x   + x   - x   - x   + x   + x   - x

    30    27    21    18    12    9    3
 - x   - x   + x   + x   - x   - x  + x  + 1)
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>factorflag</b>
<a name="IDX396"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>factorflag</code> is <code>false</code>, suppresses the factoring of
integer factors of rational expressions.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>factorout</b><i> (<var>expr</var>, <var>x_1</var>, <var>x_2</var>, ...)</i>
<a name="IDX397"></a>
</dt>
<dd><p>Rearranges the sum <var>expr</var> into a sum of
terms of the form <code>f (<var>x_1</var>, <var>x_2</var>, ...)*g</code> where <code>g</code> is a product of
expressions not containing any <var>x_i</var> and <code>f</code> is factored.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>factorsum</b><i> (<var>expr</var>)</i>
<a name="IDX398"></a>
</dt>
<dd><p>Tries to group terms in factors of <var>expr</var> which are sums
into groups of terms such that their sum is factorable.  <code>factorsum</code> can
recover the result of <code>expand ((x + y)^2 + (z + w)^2)</code> but it can't recover
<code>expand ((x + 1)^2 + (x + y)^2)</code> because the terms have variables in common.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) expand ((x + 1)*((u + v)^2 + a*(w + z)^2));
           2      2                            2      2
(%o1) a x z  + a z  + 2 a w x z + 2 a w z + a w  x + v  x

                                     2        2    2            2
                        + 2 u v x + u  x + a w  + v  + 2 u v + u
(%i2) factorsum (%);
                                   2          2
(%o2)            (x + 1) (a (z + w)  + (v + u) )
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>fasttimes</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX399"></a>
</dt>
<dd><p>Returns the product of the polynomials <var>p_1</var> and <var>p_2</var> by using a
special algorithm for multiplication of polynomials.  <code>p_1</code> and <code>p_2</code> should be
multivariate, dense, and nearly the same size.  Classical
multiplication is of order <code>n_1 n_2</code> where
<code>n_1</code> is the degree of <code>p_1</code>
and <code>n_2</code> is the degree of <code>p_2</code>.
<code>fasttimes</code> is of order <code>max (n_1, n_2)^1.585</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>fullratsimp</b><i> (<var>expr</var>)</i>
<a name="IDX400"></a>
</dt>
<dd><p><code>fullratsimp</code> repeatedly
applies <code>ratsimp</code> followed by non-rational simplification to an
expression until no further change occurs,
and returns the result.
</p>
<p>When non-rational expressions are involved, one call
to <code>ratsimp</code> followed as is usual by non-rational (&quot;general&quot;)
simplification may not be sufficient to return a simplified result.
Sometimes, more than one such call may be necessary.
<code>fullratsimp</code> makes this process convenient.
</p>
<p><code>fullratsimp (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</code> takes one or more arguments similar 
to <code>ratsimp</code> and <code>rat</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) expr: (x^(a/2) + 1)^2*(x^(a/2) - 1)^2/(x^a - 1);
                       a/2     2   a/2     2
                     (x    - 1)  (x    + 1)
(%o1)                -----------------------
                              a
                             x  - 1
(%i2) ratsimp (expr);
                          2 a      a
                         x    - 2 x  + 1
(%o2)                    ---------------
                              a
                             x  - 1
(%i3) fullratsimp (expr);
                              a
(%o3)                        x  - 1
(%i4) rat (expr);
                       a/2 4       a/2 2
                     (x   )  - 2 (x   )  + 1
(%o4)/R/             -----------------------
                              a
                             x  - 1
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>fullratsubst</b><i> (<var>a</var>, <var>b</var>, <var>c</var>)</i>
<a name="IDX401"></a>
</dt>
<dd><p>is the same as <code>ratsubst</code> except that it calls
itself recursively on its result until that result stops changing.
This function is useful when the replacement expression and the
replaced expression have one or more variables in common.
</p>
<p><code>fullratsubst</code> will also accept its arguments in the format of
<code>lratsubst</code>.  That is, the first argument may be a single substitution
equation or a list of such equations, while the second argument is the
expression being processed.
</p>
<p><code>load (&quot;lrats&quot;)</code> loads <code>fullratsubst</code> and <code>lratsubst</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;lrats&quot;)$
</pre></td></tr></table><ul>
<li>
<code>subst</code> can carry out multiple substitutions.
<code>lratsubst</code> is analogous to <code>subst</code>.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i2) subst ([a = b, c = d], a + c);
(%o2)                         d + b
(%i3) lratsubst ([a^2 = b, c^2 = d], (a + e)*c*(a + c));
(%o3)                (d + a c) e + a d + b c
</pre></td></tr></table><ul>
<li>
If only one substitution is desired, then a single
equation may be given as first argument.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) lratsubst (a^2 = b, a^3);
(%o4)                          a b
</pre></td></tr></table><ul>
<li>
<code>fullratsubst</code> is equivalent to <code>ratsubst</code>
except that it recurses until its result stops changing.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i5) ratsubst (b*a, a^2, a^3);
                               2
(%o5)                         a  b
(%i6) fullratsubst (b*a, a^2, a^3);
                                 2
(%o6)                         a b
</pre></td></tr></table><ul>
<li>
<code>fullratsubst</code> also accepts a list of equations or a single
equation as first argument.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i7) fullratsubst ([a^2 = b, b^2 = c, c^2 = a], a^3*b*c);
(%o7)                           b
(%i8) fullratsubst (a^2 = b*a, a^3);
                                 2
(%o8)                         a b
</pre></td></tr></table><ul>
<li>
<code>fullratsubst</code> may cause an indefinite recursion.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i9) errcatch (fullratsubst (b*a^2, a^2, a^3));

*** - Lisp stack overflow. RESET
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>gcd</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, ...)</i>
<a name="IDX402"></a>
</dt>
<dd><p>Returns the greatest common divisor of <var>p_1</var> and <var>p_2</var>.
The flag <code>gcd</code> determines which algorithm is employed.
Setting <code>gcd</code> to <code>ez</code>, <code>subres</code>, <code>red</code>, or <code>spmod</code> selects the <code>ezgcd</code>,
subresultant <code>prs</code>, reduced, or modular algorithm,
respectively.  If <code>gcd</code> <code>false</code> then <code>gcd (<var>p_1</var>, <var>p_2</var>, <var>x</var>)</code> always returns 1
for all <var>x</var>.  Many functions (e.g.  <code>ratsimp</code>, <code>factor</code>, etc.) cause gcd's
to be taken implicitly.  For homogeneous polynomials it is recommended
that <code>gcd</code> equal to <code>subres</code> be used.  To take the gcd when an algebraic is
present, e.g., <code>gcd (<var>x</var>^2 - 2*sqrt(2)*<var>x</var> + 2, <var>x</var> - sqrt(2))</code>, <code>algebraic</code> must be
<code>true</code> and <code>gcd</code> must not be <code>ez</code>.  <code>subres</code> is a new algorithm, and people
who have been using the <code>red</code> setting should probably change it to
<code>subres</code>.
</p>
<p>The <code>gcd</code> flag, default: <code>subres</code>, if <code>false</code> will also prevent the greatest
common divisor from being taken when expressions are converted to canonical rational expression (CRE)
form.  This will sometimes speed the calculation if gcds are not
required.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>gcdex</b><i> (<var>f</var>, <var>g</var>)</i>
<a name="IDX403"></a>
</dt>
<dt><u>Function:</u> <b>gcdex</b><i> (<var>f</var>, <var>g</var>, <var>x</var>)</i>
<a name="IDX404"></a>
</dt>
<dd><p>Returns a list <code>[<var>a</var>, <var>b</var>, <var>u</var>]</code>
where <var>u</var> is the greatest common divisor (gcd) of <var>f</var> and <var>g</var>,
and <var>u</var> is equal to <code><var>a</var> <var>f</var> + <var>b</var> <var>g</var></code>.
The arguments <var>f</var> and <var>g</var> should be univariate polynomials,
or else polynomials in <var>x</var> a supplied <b>main</b> variable   
since we need to be in a principal ideal domain for this to work.
The gcd means the gcd regarding <var>f</var> and <var>g</var> as univariate polynomials with coefficients
being rational functions in the other variables.
</p>
<p><code>gcdex</code> implements the Euclidean algorithm,
where we have a sequence
of <code>L[i]: [a[i], b[i], r[i]]</code> which are all perpendicular
to <code>[f, g, -1]</code> and the next one is built as
if <code>q = quotient(r[i]/r[i+1])</code> then <code>L[i+2]: L[i] - q L[i+1]</code>, and it
terminates at <code>L[i+1]</code> when the remainder <code>r[i+2]</code> is zero.
</p>

<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) gcdex (x^2 + 1, x^3 + 4);
                       2
                      x  + 4 x - 1  x + 4
(%o1)/R/           [- ------------, -----, 1]
                           17        17
(%i2) % . [x^2 + 1, x^3 + 4, -1];
(%o2)/R/                        0
</pre></td></tr></table>
<p>Note that the gcd in the following is <code>1</code>
since we work in <code>k(y)[x]</code>, not the  <code>y+1</code> we would expect in <code>k[y, x]</code>.
</p>

<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) gcdex (x*(y + 1), y^2 - 1, x);
                               1
(%o1)/R/                 [0, ------, 1]
                              2
                             y  - 1
</pre></td></tr></table>
</dd></dl>


<dl>
<dt><u>Function:</u> <b>gcfactor</b><i> (<var>n</var>)</i>
<a name="IDX405"></a>
</dt>
<dd><p>Factors the Gaussian integer <var>n</var> over the Gaussian integers, i.e.,
numbers of the form <code><var>a</var> + <var>b</var> <code>%i</code></code> where <var>a</var> and <var>b</var> are rational integers
(i.e.,  ordinary integers).  Factors are normalized by making <var>a</var> and <var>b</var>
non-negative.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>gfactor</b><i> (<var>expr</var>)</i>
<a name="IDX406"></a>
</dt>
<dd><p>Factors the polynomial <var>expr</var> over the Gaussian integers
(that is, the integers with the imaginary unit <code>%i</code> adjoined).
This is like <code>factor (<var>expr</var>, <var>a</var>^2+1)</code> where <var>a</var> is <code>%i</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) gfactor (x^4 - 1);
(%o1)           (x - 1) (x + 1) (x - %i) (x + %i)
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>gfactorsum</b><i> (<var>expr</var>)</i>
<a name="IDX407"></a>
</dt>
<dd><p>is similar to <code>factorsum</code> but applies <code>gfactor</code> instead
of <code>factor</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>hipow</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX408"></a>
</dt>
<dd><p>Returns the highest explicit exponent of <var>x</var> in <var>expr</var>.
<var>x</var> may be a variable or a general expression.
If <var>x</var> does not appear in <var>expr</var>,
<code>hipow</code> returns <code>0</code>.
</p>
<p><code>hipow</code> does not consider expressions equivalent to <code>expr</code>.
In particular, <code>hipow</code> does not expand <code>expr</code>,
so <code>hipow (<var>expr</var>, <var>x</var>)</code> and <code>hipow (expand (<var>expr</var>, <var>x</var>))</code>
may yield different results.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) hipow (y^3 * x^2 + x * y^4, x);
(%o1)                           2
(%i2) hipow ((x + y)^5, x);
(%o2)                           1
(%i3) hipow (expand ((x + y)^5), x);
(%o3)                           5
(%i4) hipow ((x + y)^5, x + y);
(%o4)                           5
(%i5) hipow (expand ((x + y)^5), x + y);
(%o5)                           0
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>intfaclim</b>
<a name="IDX409"></a>
</dt>
<dd><p>Default value: true
</p>
<p>If <code>true</code>, maxima will give up factorization of
integers if no factor is found after trial divisions and Pollard's rho
method and factorization will not be complete.
</p>
<p>When <code>intfaclim</code> is <code>false</code> (this is the case when the user
calls <code>factor</code> explicitly), complete factorization will be
attempted.  <code>intfaclim</code> is set to <code>false</code> when factors are
computed in <code>divisors</code>, <code>divsum</code> and <code>totient</code>.
</p>
<p>Internal calls to <code>factor</code> respect the user-specified value of
<code>intfaclim</code>.  Setting <code>intfaclim</code> to <code>true</code> may reduce
the time spent factoring large integers.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>keepfloat</b>
<a name="IDX410"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>keepfloat</code> is <code>true</code>, prevents floating
point numbers from being rationalized when expressions which contain
them are converted to canonical rational expression (CRE) form.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>lratsubst</b><i> (<var>L</var>, <var>expr</var>)</i>
<a name="IDX411"></a>
</dt>
<dd><p>is analogous to <code>subst (<var>L</var>, <var>expr</var>)</code>
except that it uses <code>ratsubst</code> instead of <code>subst</code>.
</p>
<p>The first argument of
<code>lratsubst</code> is an equation or a list of equations identical in
format to that accepted by <code>subst</code>.  The
substitutions are made in the order given by the list of equations,
that is, from left to right.
</p>
<p><code>load (&quot;lrats&quot;)</code> loads <code>fullratsubst</code> and <code>lratsubst</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;lrats&quot;)$
</pre></td></tr></table><ul>
<li>
<code>subst</code> can carry out multiple substitutions.
<code>lratsubst</code> is analogous to <code>subst</code>.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i2) subst ([a = b, c = d], a + c);
(%o2)                         d + b
(%i3) lratsubst ([a^2 = b, c^2 = d], (a + e)*c*(a + c));
(%o3)                (d + a c) e + a d + b c
</pre></td></tr></table><ul>
<li>
If only one substitution is desired, then a single
equation may be given as first argument.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) lratsubst (a^2 = b, a^3);
(%o4)                          a b
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>modulus</b>
<a name="IDX412"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>modulus</code> is a positive number <var>p</var>,
operations on rational numbers (as returned by <code>rat</code> and related functions)
are carried out modulo <var>p</var>,
using the so-called &quot;balanced&quot; modulus system
in which <code><var>n</var> modulo <var>p</var></code> is defined as 
an integer <var>k</var> in <code>[-(<var>p</var>-1)/2, ..., 0, ..., (<var>p</var>-1)/2]</code>
when <var>p</var> is odd, or <code>[-(<var>p</var>/2 - 1), ..., 0, ...., <var>p</var>/2]</code> when <var>p</var> is even,
such that <code><var>a</var> <var>p</var> + <var>k</var></code> equals <var>n</var> for some integer <var>a</var>.
</p>
<p>If <var>expr</var> is already in canonical rational expression (CRE) form when <code>modulus</code> is reset,
then you may need to re-rat <var>expr</var>, e.g., <code>expr: rat (ratdisrep (expr))</code>,
in order to get correct results.
</p>
<p>Typically <code>modulus</code> is set to a prime number.
If <code>modulus</code> is set to a positive non-prime integer,
this setting is accepted, but a warning message is displayed.
Maxima will allow zero or a negative integer to be assigned to <code>modulus</code>,
although it is not clear if that has any useful consequences.
</p>
</dd></dl>


<dl>
<dt><u>Function:</u> <b>num</b><i> (<var>expr</var>)</i>
<a name="IDX413"></a>
</dt>
<dd><p>Returns the numerator of <var>expr</var> if it is a ratio.
If <var>expr</var> is not a ratio, <var>expr</var> is returned.
</p>
<p><code>num</code> evaluates its argument.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>polydecomp</b><i> (<var>p</var>, <var>x</var>)</i>
<a name="IDX414"></a>
</dt>
<dd><p>Decomposes the polynomial <var>p</var> in the variable <var>x</var>
into the functional composition of polynomials in <var>x</var>.
<code>polydecomp</code> returns a list <code>[<var>p_1</var>, ..., <var>p_n</var>]</code> such that
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">lambda ([x], p_1) (lambda ([x], p_2) (... (lambda ([x], p_n) (x)) ...))
</pre></td></tr></table>
<p>is equal to <var>p</var>.
The degree of <var>p_i</var> is greater than 1 for <var>i</var> less than <var>n</var>.
</p>
<p>Such a decomposition is not unique.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) polydecomp (x^210, x);
                          7   5   3   2
(%o1)                   [x , x , x , x ]
(%i2) p : expand (subst (x^3 - x - 1, x, x^2 - a));
                6      4      3    2
(%o2)          x  - 2 x  - 2 x  + x  + 2 x - a + 1
(%i3) polydecomp (p, x);
                        2       3
(%o3)                 [x  - a, x  - x - 1]
</pre></td></tr></table>
<p>The following function composes <code>L = [e_1, ..., e_n]</code> as functions in <code>x</code>;
it is the inverse of polydecomp:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">compose (L, x) :=
  block ([r : x], for e in L do r : subst (e, x, r), r) $
</pre></td></tr></table>
<p>Re-express above example using <code>compose</code>:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i3) polydecomp (compose ([x^2 - a, x^3 - x - 1], x), x);
                        2       3
(%o3)                 [x  - a, x  - x - 1]
</pre></td></tr></table>
<p>Note that though <code>compose (polydecomp (<var>p</var>, <var>x</var>), <var>x</var>)</code>
always returns <var>p</var> (unexpanded),
<code>polydecomp (compose ([<var>p_1</var>, ..., <var>p_n</var>], <var>x</var>), <var>x</var>)</code> does <i>not</i>
necessarily return <code>[<var>p_1</var>, ..., <var>p_n</var>]</code>:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) polydecomp (compose ([x^2 + 2*x + 3, x^2], x), x);
                          2       2
(%o4)                   [x  + 2, x  + 1]
(%i5) polydecomp (compose ([x^2 + x + 1, x^2 + x + 1], x), x);
                      2       2
                     x  + 3  x  + 5
(%o5)               [------, ------, 2 x + 1]
                       4       2
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>quotient</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX415"></a>
</dt>
<dt><u>Function:</u> <b>quotient</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX416"></a>
</dt>
<dd><p>Returns the polynomial <var>p_1</var> divided by the polynomial <var>p_2</var>.
The arguments <var>x_1</var>, ..., <var>x_n</var> are interpreted as in <code>ratvars</code>.
</p>
<p><code>quotient</code> returns the first element of the two-element list returned by <code>divide</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>rat</b><i> (<var>expr</var>)</i>
<a name="IDX417"></a>
</dt>
<dt><u>Function:</u> <b>rat</b><i> (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX418"></a>
</dt>
<dd><p>Converts <var>expr</var> to canonical rational expression (CRE) form by expanding and
combining all terms over a common denominator and cancelling out the
greatest common divisor of the numerator and denominator, as well as
converting floating point numbers to rational numbers within a
tolerance of <code>ratepsilon</code>.
The variables are ordered according
to the <var>x_1</var>, ..., <var>x_n</var>, if specified, as in <code>ratvars</code>.
</p>
<p><code>rat</code> does not generally simplify functions other than
addition <code>+</code>, subtraction <code>-</code>, multiplication <code>*</code>, division <code>/</code>, and
exponentiation to an integer power,
whereas <code>ratsimp</code> does handle those cases.
Note that atoms (numbers and variables) in CRE form are not the
same as they are in the general form.
For example, <code>rat(x)- x</code> yields 
<code>rat(0)</code> which has a different internal representation than 0.
</p>
<p>When <code>ratfac</code> is <code>true</code>, <code>rat</code> yields a partially factored form for CRE.
During rational operations the expression is
maintained as fully factored as possible without an actual call to the
factor package.  This should always save space and may save some time
in some computations.  The numerator and denominator are still made
relatively prime
(e.g.  <code>rat ((x^2 - 1)^4/(x + 1)^2)</code> yields <code>(x - 1)^4 (x + 1)^2)</code>,
but the factors within each part may not be relatively prime.
</p>
<p><code>ratprint</code> if <code>false</code> suppresses the printout of the message
informing the user of the conversion of floating point numbers to
rational numbers.
</p>
<p><code>keepfloat</code> if <code>true</code> prevents floating point numbers from being
converted to rational numbers.
</p>
<p>See also <code>ratexpand</code> and  <code>ratsimp</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) ((x - 2*y)^4/(x^2 - 4*y^2)^2 + 1)*(y + a)*(2*y + x) /(4*y^2 + x^2);
                                           4
                                  (x - 2 y)
              (y + a) (2 y + x) (------------ + 1)
                                   2      2 2
                                 (x  - 4 y )
(%o1)         ------------------------------------
                              2    2
                           4 y  + x
(%i2) rat (%, y, a, x);
                            2 a + 2 y
(%o2)/R/                    ---------
                             x + 2 y
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratalgdenom</b>
<a name="IDX419"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratalgdenom</code> is <code>true</code>, allows rationalization of
denominators with respect to radicals to take effect.
<code>ratalgdenom</code> has an effect only when canonical rational expressions (CRE) are used in algebraic mode.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratcoef</b><i> (<var>expr</var>, <var>x</var>, <var>n</var>)</i>
<a name="IDX420"></a>
</dt>
<dt><u>Function:</u> <b>ratcoef</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX421"></a>
</dt>
<dd><p>Returns the coefficient of the expression <code><var>x</var>^<var>n</var></code>
in the expression <var>expr</var>.
If omitted, <var>n</var> is assumed to be 1.
</p>
<p>The return value is free
(except possibly in a non-rational sense) of the variables in <var>x</var>.
If no coefficient of this type exists, 0 is returned.
</p>
<p><code>ratcoef</code>
expands and rationally simplifies its first argument and thus it may
produce answers different from those of <code>coeff</code> which is purely
syntactic.
Thus <code>ratcoef ((x + 1)/y + x, x)</code> returns <code>(y + 1)/y</code> whereas <code>coeff</code> returns 1.
</p>
<p><code>ratcoef (<var>expr</var>, <var>x</var>, 0)</code>, viewing <var>expr</var> as a sum,
returns a sum of those terms which do not contain <var>x</var>.
Therefore if <var>x</var> occurs to any negative powers, <code>ratcoef</code> should not be used.
</p>
<p>Since <var>expr</var> is rationally
simplified before it is examined, coefficients may not appear quite
the way they were envisioned.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) s: a*x + b*x + 5$
(%i2) ratcoef (s, a + b);
(%o2)                           x
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratdenom</b><i> (<var>expr</var>)</i>
<a name="IDX422"></a>
</dt>
<dd><p>Returns the denominator of <var>expr</var>,
after coercing <var>expr</var> to a canonical rational expression (CRE).
The return value is a CRE.
</p>
<p><var>expr</var> is coerced to a CRE by <code>rat</code>
if it is not already a CRE.
This conversion may change the form of <var>expr</var> by putting all terms
over a common denominator.
</p>
<p><code>denom</code> is similar, but returns an ordinary expression instead of a CRE.
Also, <code>denom</code> does not attempt to place all terms over a common denominator,
and thus some expressions which are considered ratios by <code>ratdenom</code>
are not considered ratios by <code>denom</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratdenomdivide</b>
<a name="IDX423"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratdenomdivide</code> is <code>true</code>,
<code>ratexpand</code> expands a ratio in which the numerator is a sum 
into a sum of ratios,
all having a common denominator.
Otherwise, <code>ratexpand</code> collapses a sum of ratios into a single ratio,
the numerator of which is the sum of the numerators of each ratio.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) expr: (x^2 + x + 1)/(y^2 + 7);
                            2
                           x  + x + 1
(%o1)                      ----------
                              2
                             y  + 7
(%i2) ratdenomdivide: true$
(%i3) ratexpand (expr);
                       2
                      x        x        1
(%o3)               ------ + ------ + ------
                     2        2        2
                    y  + 7   y  + 7   y  + 7
(%i4) ratdenomdivide: false$
(%i5) ratexpand (expr);
                            2
                           x  + x + 1
(%o5)                      ----------
                              2
                             y  + 7
(%i6) expr2: a^2/(b^2 + 3) + b/(b^2 + 3);
                                     2
                           b        a
(%o6)                    ------ + ------
                          2        2
                         b  + 3   b  + 3
(%i7) ratexpand (expr2);
                                  2
                             b + a
(%o7)                        ------
                              2
                             b  + 3
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratdiff</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX424"></a>
</dt>
<dd><p>Differentiates the rational expression <var>expr</var> with respect to <var>x</var>.
<var>expr</var> must be a ratio of polynomials or a polynomial in <var>x</var>.
The argument <var>x</var> may be a variable or a subexpression of <var>expr</var>.
</p>
<p>The result is equivalent to <code>diff</code>, although perhaps in a different form.
<code>ratdiff</code> may be faster than <code>diff</code>, for rational expressions.
</p>
<p><code>ratdiff</code> returns a canonical rational expression (CRE) if <code>expr</code> is a CRE.
Otherwise, <code>ratdiff</code> returns a general expression.
</p>
<p><code>ratdiff</code> considers only the dependence of <var>expr</var> on <var>x</var>,
and ignores any dependencies established by <code>depends</code>.
</p>

<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) expr: (4*x^3 + 10*x - 11)/(x^5 + 5);
                           3
                        4 x  + 10 x - 11
(%o1)                   ----------------
                              5
                             x  + 5
(%i2) ratdiff (expr, x);
                    7       5       4       2
                 8 x  + 40 x  - 55 x  - 60 x  - 50
(%o2)          - ---------------------------------
                          10       5
                         x   + 10 x  + 25
(%i3) expr: f(x)^3 - f(x)^2 + 7;
                         3       2
(%o3)                   f (x) - f (x) + 7
(%i4) ratdiff (expr, f(x));
                           2
(%o4)                   3 f (x) - 2 f(x)
(%i5) expr: (a + b)^3 + (a + b)^2;
                              3          2
(%o5)                  (b + a)  + (b + a)
(%i6) ratdiff (expr, a + b);
                    2                    2
(%o6)            3 b  + (6 a + 2) b + 3 a  + 2 a
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratdisrep</b><i> (<var>expr</var>)</i>
<a name="IDX425"></a>
</dt>
<dd><p>Returns its argument as a general expression.
If <var>expr</var> is a general expression, it is returned unchanged.
</p>
<p>Typically <code>ratdisrep</code> is called to convert a canonical rational expression (CRE)
into a general expression.
This is sometimes convenient if one wishes to stop the &quot;contagion&quot;, or
use rational functions in non-rational contexts.
</p>
<p>See also <code>totaldisrep</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratepsilon</b>
<a name="IDX426"></a>
</dt>
<dd><p>Default value: 2.0e-8
</p>
<p><code>ratepsilon</code> is the tolerance used in the conversion
of floating point numbers to rational numbers.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratexpand</b><i> (<var>expr</var>)</i>
<a name="IDX427"></a>
</dt>
<dt><u>Option variable:</u> <b>ratexpand</b>
<a name="IDX428"></a>
</dt>
<dd><p>Expands <var>expr</var> by multiplying out products of sums and
exponentiated sums, combining fractions over a common denominator,
cancelling the greatest common divisor of the numerator and
denominator, then splitting the numerator (if a sum) into its
respective terms divided by the denominator.
</p>
<p>The return value of <code>ratexpand</code> is a general expression,
even if <var>expr</var> is a canonical rational expression (CRE).
</p>
<p>The switch <code>ratexpand</code> if <code>true</code> will cause CRE
expressions to be fully expanded when they are converted back to
general form or displayed, while if it is <code>false</code> then they will be put
into a recursive form.
See also <code>ratsimp</code>.
</p>
<p>When <code>ratdenomdivide</code> is <code>true</code>,
<code>ratexpand</code> expands a ratio in which the numerator is a sum 
into a sum of ratios,
all having a common denominator.
Otherwise, <code>ratexpand</code> collapses a sum of ratios into a single ratio,
the numerator of which is the sum of the numerators of each ratio.
</p>
<p>When <code>keepfloat</code> is <code>true</code>, prevents floating
point numbers from being rationalized when expressions which contain
them are converted to canonical rational expression (CRE) form.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) ratexpand ((2*x - 3*y)^3);
                     3         2       2        3
(%o1)          - 27 y  + 54 x y  - 36 x  y + 8 x
(%i2) expr: (x - 1)/(x + 1)^2 + 1/(x - 1);
                         x - 1       1
(%o2)                   -------- + -----
                               2   x - 1
                        (x + 1)
(%i3) expand (expr);
                    x              1           1
(%o3)          ------------ - ------------ + -----
                2              2             x - 1
               x  + 2 x + 1   x  + 2 x + 1
(%i4) ratexpand (expr);
                        2
                     2 x                 2
(%o4)           --------------- + ---------------
                 3    2            3    2
                x  + x  - x - 1   x  + x  - x - 1
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratfac</b>
<a name="IDX429"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>ratfac</code> is <code>true</code>,
canonical rational expressions (CRE) are manipulated in a partially factored form.
</p>
<p>During rational operations the
expression is maintained as fully factored as possible without calling <code>factor</code>.
This should always save space and may save time in some computations.
The numerator and denominator are made relatively prime, for example
<code>rat ((x^2 - 1)^4/(x + 1)^2)</code> yields <code>(x - 1)^4 (x + 1)^2)</code>,
but the factors within each part may not be relatively prime.
</p>
<p>In the <code>ctensr</code> (Component Tensor Manipulation) package,
Ricci, Einstein, Riemann, and Weyl tensors and the scalar curvature 
are factored automatically when <code>ratfac</code> is <code>true</code>.
<i><code>ratfac</code> should only be
set for cases where the tensorial components are known to consist of
few terms.</i>
</p>
<p>The <code>ratfac</code> and <code>ratweight</code> schemes are incompatible and may not
both be used at the same time.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratnumer</b><i> (<var>expr</var>)</i>
<a name="IDX430"></a>
</dt>
<dd><p>Returns the numerator of <var>expr</var>,
after coercing <var>expr</var> to a canonical rational expression (CRE).
The return value is a CRE.
</p>
<p><var>expr</var> is coerced to a CRE by <code>rat</code>
if it is not already a CRE.
This conversion may change the form of <var>expr</var> by putting all terms
over a common denominator.
</p>
<p><code>num</code> is similar, but returns an ordinary expression instead of a CRE.
Also, <code>num</code> does not attempt to place all terms over a common denominator,
and thus some expressions which are considered ratios by <code>ratnumer</code>
are not considered ratios by <code>num</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratnump</b><i> (<var>expr</var>)</i>
<a name="IDX431"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a literal integer or ratio of literal integers,
otherwise <code>false</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratp</b><i> (<var>expr</var>)</i>
<a name="IDX432"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a canonical rational expression (CRE) or extended CRE,
otherwise <code>false</code>.
</p>
<p>CRE are created by <code>rat</code> and related functions.
Extended CRE are created by <code>taylor</code> and related functions.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratprint</b>
<a name="IDX433"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>ratprint</code> is <code>true</code>,
a message informing the user of the conversion of floating point numbers
to rational numbers is displayed.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratsimp</b><i> (<var>expr</var>)</i>
<a name="IDX434"></a>
</dt>
<dt><u>Function:</u> <b>ratsimp</b><i> (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX435"></a>
</dt>
<dd><p>Simplifies the expression <var>expr</var> and all of its subexpressions,
including the arguments to non-rational functions.
The result is returned as the quotient of two polynomials in a recursive form,
that is, the coefficients of the main variable are polynomials in the other variables.
Variables may include non-rational functions (e.g., <code>sin (x^2 + 1)</code>)
and the arguments to any such functions are also rationally simplified.
</p>
<p><code>ratsimp (<var>expr</var>, <var>x_1</var>, ..., <var>x_n</var>)</code>
enables rational simplification with the
specification of variable ordering as in <code>ratvars</code>.
</p>
<p>When <code>ratsimpexpons</code> is <code>true</code>,
<code>ratsimp</code> is applied to the exponents of expressions during simplification.
</p>
<p>See also <code>ratexpand</code>.
Note that <code>ratsimp</code> is affected by some of the
flags which affect <code>ratexpand</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) sin (x/(x^2 + x)) = exp ((log(x) + 1)^2 - log(x)^2);
                                         2      2
                   x         (log(x) + 1)  - log (x)
(%o1)        sin(------) = %e
                  2
                 x  + x
(%i2) ratsimp (%);
                             1          2
(%o2)                  sin(-----) = %e x
                           x + 1
(%i3) ((x - 1)^(3/2) - (x + 1)*sqrt(x - 1))/sqrt((x - 1)*(x + 1));
                       3/2
                (x - 1)    - sqrt(x - 1) (x + 1)
(%o3)           --------------------------------
                     sqrt((x - 1) (x + 1))
(%i4) ratsimp (%);
                           2 sqrt(x - 1)
(%o4)                    - -------------
                                 2
                           sqrt(x  - 1)
(%i5) x^(a + 1/a), ratsimpexpons: true;
                               2
                              a  + 1
                              ------
                                a
(%o5)                        x
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratsimpexpons</b>
<a name="IDX436"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>ratsimpexpons</code> is <code>true</code>,
<code>ratsimp</code> is applied to the exponents of expressions during simplification.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratsubst</b><i> (<var>a</var>, <var>b</var>, <var>c</var>)</i>
<a name="IDX437"></a>
</dt>
<dd><p>Substitutes <var>a</var> for <var>b</var> in <var>c</var> and returns the resulting expression.
<var>b</var> may be a sum, product, power, etc.
</p>
<p><code>ratsubst</code> knows something of the meaning of expressions
whereas <code>subst</code> does a purely syntactic substitution.
Thus <code>subst (a, x + y, x + y + z)</code> returns <code>x + y + z</code>
whereas <code>ratsubst</code> returns <code>z + a</code>.
</p>
<p>When <code>radsubstflag</code> is <code>true</code>,
<code>ratsubst</code> makes substitutions for radicals in expressions
which don't explicitly contain them.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) ratsubst (a, x*y^2, x^4*y^3 + x^4*y^8);
                              3      4
(%o1)                      a x  y + a
(%i2) cos(x)^4 + cos(x)^3 + cos(x)^2 + cos(x) + 1;
               4         3         2
(%o2)       cos (x) + cos (x) + cos (x) + cos(x) + 1
(%i3) ratsubst (1 - sin(x)^2, cos(x)^2, %);
            4           2                     2
(%o3)    sin (x) - 3 sin (x) + cos(x) (2 - sin (x)) + 3
(%i4) ratsubst (1 - cos(x)^2, sin(x)^2, sin(x)^4);
                        4           2
(%o4)                cos (x) - 2 cos (x) + 1
(%i5) radsubstflag: false$
(%i6) ratsubst (u, sqrt(x), x);
(%o6)                           x
(%i7) radsubstflag: true$
(%i8) ratsubst (u, sqrt(x), x);
                                2
(%o8)                          u
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratvars</b><i> (<var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX438"></a>
</dt>
<dt><u>Function:</u> <b>ratvars</b><i> ()</i>
<a name="IDX439"></a>
</dt>
<dt><u>System variable:</u> <b>ratvars</b>
<a name="IDX440"></a>
</dt>
<dd><p>Declares main variables <var>x_1</var>, ..., <var>x_n</var> for rational expressions.
<var>x_n</var>, if present in a rational expression, is considered the main variable.
Otherwise, <var>x_[n-1]</var> is considered the main variable if present,
and so on through the preceding variables to <var>x_1</var>,
which is considered the main variable only if none of the succeeding variables are present.
</p>
<p>If a variable in a rational expression is not present in the <code>ratvars</code> list,
it is given a lower priority than <var>x_1</var>.
</p>
<p>The arguments to <code>ratvars</code> can be either variables or non-rational functions
such as <code>sin(x)</code>.
</p>
<p>The variable <code>ratvars</code> is a list of the arguments of 
the function <code>ratvars</code> when it was called most recently.
Each call to the function <code>ratvars</code> resets the list.
<code>ratvars ()</code> clears the list.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ratweight</b><i> (<var>x_1</var>, <var>w_1</var>, ..., <var>x_n</var>, <var>w_n</var>)</i>
<a name="IDX441"></a>
</dt>
<dt><u>Function:</u> <b>ratweight</b><i> ()</i>
<a name="IDX442"></a>
</dt>
<dd><p>Assigns a weight <var>w_i</var> to the variable <var>x_i</var>.
This causes a term to be replaced by 0 if its weight exceeds the
value of the variable <code>ratwtlvl</code> (default yields no truncation).
The weight of a term is the sum of the products of the
weight of a variable in the term times its power.
For example, the weight of <code>3 x_1^2 x_2</code> is <code>2 w_1 + w_2</code>.
Truncation according to <code>ratwtlvl</code> is carried out only when multiplying
or exponentiating canonical rational expressions (CRE).
</p>
<p><code>ratweight ()</code> returns the cumulative list of weight assignments.
</p>
<p>Note: The <code>ratfac</code> and <code>ratweight</code> schemes are incompatible and may not
both be used at the same time.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) ratweight (a, 1, b, 1);
(%o1)                     [a, 1, b, 1]
(%i2) expr1: rat(a + b + 1)$
(%i3) expr1^2;
                  2                  2
(%o3)/R/         b  + (2 a + 2) b + a  + 2 a + 1
(%i4) ratwtlvl: 1$
(%i5) expr1^2;
(%o5)/R/                  2 b + 2 a + 1
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>System variable:</u> <b>ratweights</b>
<a name="IDX443"></a>
</dt>
<dd><p>Default value: <code>[]</code>
</p>
<p><code>ratweights</code> is the list of weights assigned by <code>ratweight</code>.
The list is cumulative:
each call to <code>ratweight</code> places additional items in the list.
</p>
<p><code>kill (ratweights)</code> and <code>save (ratweights)</code> both work as expected.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratwtlvl</b>
<a name="IDX444"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>ratwtlvl</code> is used in combination with the <code>ratweight</code>
function to control the truncation of canonical rational expressions (CRE).
For the default value of <code>false</code>, no truncation occurs.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>remainder</b><i> (<var>p_1</var>, <var>p_2</var>)</i>
<a name="IDX445"></a>
</dt>
<dt><u>Function:</u> <b>remainder</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX446"></a>
</dt>
<dd><p>Returns the remainder of the polynomial <var>p_1</var> divided by the polynomial <var>p_2</var>.
The arguments <var>x_1</var>, ..., <var>x_n</var> are interpreted as in <code>ratvars</code>.
</p>
<p><code>remainder</code> returns the second element
of the two-element list returned by <code>divide</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>resultant</b><i> (<var>p_1</var>, <var>p_2</var>, <var>x</var>)</i>
<a name="IDX447"></a>
</dt>
<dt><u>Variable:</u> <b>resultant</b>
<a name="IDX448"></a>
</dt>
<dd><p>Computes the resultant of the two polynomials <var>p_1</var> and <var>p_2</var>,
eliminating the variable <var>x</var>.
The resultant is a determinant of the coefficients of <var>x</var>
in <var>p_1</var> and <var>p_2</var>,
which equals zero
if and only if <var>p_1</var> and <var>p_2</var> have a non-constant factor in common.
</p>
<p>If <var>p_1</var> or <var>p_2</var> can be factored,
it may be desirable to call <code>factor</code> before calling <code>resultant</code>.
</p>
<p>The variable <code>resultant</code> controls which algorithm will be used to compute
the resultant.
<code>subres</code> for subresultant prs,
<code>mod</code> for modular resultant algorithm,
and <code>red</code> for reduced prs.
On most problems <code>subres</code> should be best.
On some large degree univariate or bivariate problems <code>mod</code> may be better.
</p>
<p>The function <code>bezout</code> takes the same arguments as <code>resultant</code> and returns
a matrix.  The determinant of the return value is the desired resultant.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>savefactors</b>
<a name="IDX449"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>savefactors</code> is <code>true</code>, causes the factors of an
expression which is a product of factors to be saved by certain
functions in order to speed up later factorizations of expressions
containing some of the same factors.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>sqfr</b><i> (<var>expr</var>)</i>
<a name="IDX450"></a>
</dt>
<dd><p>is similar to <code>factor</code> except that the polynomial factors are &quot;square-free.&quot;
That is, they have factors only of degree one.
This algorithm, which is also used by the first stage of <code>factor</code>, utilizes
the fact that a polynomial has in common with its n'th derivative all
its factors of degree greater than n.  Thus by taking greatest common divisors
with the polynomial of
the derivatives with respect to each variable in the polynomial, all
factors of degree greater than 1 can be found.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) sqfr (4*x^4 + 4*x^3 - 3*x^2 - 4*x - 1);
                                2   2
(%o1)                  (2 x + 1)  (x  - 1)
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>tellrat</b><i> (<var>p_1</var>, ..., <var>p_n</var>)</i>
<a name="IDX451"></a>
</dt>
<dt><u>Function:</u> <b>tellrat</b><i> ()</i>
<a name="IDX452"></a>
</dt>
<dd><p>Adds to the ring of algebraic integers known to Maxima
the elements which are the solutions of the polynomials <var>p_1</var>, ..., <var>p_n</var>.
Each argument <var>p_i</var> is a polynomial with integer coefficients.
</p>
<p><code>tellrat (<var>x</var>)</code> effectively means substitute 0 for <var>x</var> in rational
functions.
</p>
<p><code>tellrat ()</code> returns a list of the current substitutions.
</p>
<p><code>algebraic</code> must be set to <code>true</code> in order for the simplification of
algebraic integers to take effect.
</p>
<p>Maxima initially knows about the imaginary unit <code>%i</code>
and all roots of integers.
</p>
<p>There is a command <code>untellrat</code> which takes kernels and
removes <code>tellrat</code> properties.
</p>
<p>When <code>tellrat</code>'ing a multivariate
polynomial, e.g., <code>tellrat (x^2 - y^2)</code>, there would be an ambiguity as to
whether to substitute <code><var>y</var>^2</code> for <code><var>x</var>^2</code>
or vice versa.  
Maxima picks a particular ordering, but if the user wants to specify which, e.g.
<code>tellrat (y^2 = x^2)</code> provides a syntax which says replace
<code><var>y</var>^2</code> by <code><var>x</var>^2</code>.
</p>

<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) 10*(%i + 1)/(%i + 3^(1/3));
                           10 (%i + 1)
(%o1)                      -----------
                                  1/3
                            %i + 3
(%i2) ev (ratdisrep (rat(%)), algebraic);
             2/3      1/3              2/3      1/3
(%o2)    (4 3    - 2 3    - 4) %i + 2 3    + 4 3    - 2
(%i3) tellrat (1 + a + a^2);
                            2
(%o3)                     [a  + a + 1]
(%i4) 1/(a*sqrt(2) - 1) + a/(sqrt(3) + sqrt(2));
                      1                 a
(%o4)           ------------- + -----------------
                sqrt(2) a - 1   sqrt(3) + sqrt(2)
(%i5) ev (ratdisrep (rat(%)), algebraic);
         (7 sqrt(3) - 10 sqrt(2) + 2) a - 2 sqrt(2) - 1
(%o5)    ----------------------------------------------
                               7
(%i6) tellrat (y^2 = x^2);
                        2    2   2
(%o6)                 [y  - x , a  + a + 1]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>totaldisrep</b><i> (<var>expr</var>)</i>
<a name="IDX453"></a>
</dt>
<dd><p>Converts every subexpression of <var>expr</var> from canonical rational expressions (CRE) to
general form and returns the result.
If <var>expr</var> is itself in CRE form then <code>totaldisrep</code> is identical to
<code>ratdisrep</code>.
</p>
<p><code>totaldisrep</code> may be useful for
ratdisrepping expressions such as equations, lists, matrices, etc., which
have some subexpressions in CRE form.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>untellrat</b><i> (<var>x_1</var>, ..., <var>x_n</var>)</i>
<a name="IDX454"></a>
</dt>
<dd><p>Removes <code>tellrat</code> properties from <var>x_1</var>, ..., <var>x_n</var>.
</p>
</dd></dl>

<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC44" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_13.html#SEC47" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated by <em>Robert Dodier</em> on <em>September, 20 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

</p>
</body>
</html>