File: maxima_26.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 (1945 lines) | stat: -rw-r--r-- 75,436 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
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
<!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: 26. Matrices and Linear Algebra</title>

<meta name="description" content="Maxima Manual: 26. Matrices and Linear Algebra">
<meta name="keywords" content="Maxima Manual: 26. Matrices and Linear Algebra">
<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="Matrices-and-Linear-Algebra"></a>
<a name="SEC85"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_25.html#SEC84" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC86" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima_25.html#SEC83" 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_27.html#SEC91" 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"> 26. Matrices and Linear Algebra </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC86">26.1 Introduction to Matrices and Linear Algebra</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC90">26.2 Definitions for Matrices and Linear Algebra</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">  
</td></tr>
</table>

<hr size="6">
<a name="Introduction-to-Matrices-and-Linear-Algebra"></a>
<a name="SEC86"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC85" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC87" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC85" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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"> 26.1 Introduction to Matrices and Linear Algebra </h2>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC87">26.1.1 Dot</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                         
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC88">26.1.2 Vectors</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                     
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC89">26.1.3 eigen</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr size="6">
<a name="Dot"></a>
<a name="SEC87"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC86" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC88" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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>
<h3 class="subsection"> 26.1.1 Dot </h3>
<p>The operator <code>.</code> represents noncommutative multiplication and scalar product.
When the operands are 1-column or 1-row matrices <code>a</code> and <code>b</code>,
the expression <code>a.b</code> is equivalent to <code>sum (a[i]*b[i], i, 1, length(a))</code>.
If <code>a</code> and <code>b</code> are not complex, this is the scalar product,
also called the inner product or dot product, of <code>a</code> and <code>b</code>.
The scalar product is defined as <code>conjugate(a).b</code> when <code>a</code> and <code>b</code> are complex;
<code>innerproduct</code> in the <code>eigen</code> package provides the complex scalar product.
</p>
<p>When the operands are more general matrices,
the product is the matrix product <code>a</code> and <code>b</code>.
The number of rows of <code>b</code> must equal the number of columns of <code>a</code>,
and the result has number of rows equal to the number of rows of <code>a</code>
and number of columns equal to the number of columns of <code>b</code>.
</p>
<p>To distinguish <code>.</code> as an arithmetic operator from 
the decimal point in a floating point number,
it may be necessary to leave spaces on either side.
For example, <code>5.e3</code> is <code>5000.0</code> but <code>5 . e3</code> is <code>5</code> times <code>e3</code>.
</p>
<p>There are several flags which govern the simplification of
expressions involving <code>.</code>, namely
<code>dot</code>, <code>dot0nscsimp</code>, <code>dot0simp</code>, <code>dot1simp</code>, <code>dotassoc</code>, 
<code>dotconstrules</code>, <code>dotdistrib</code>, <code>dotexptsimp</code>, <code>dotident</code>,
and <code>dotscrules</code>.
</p>
<hr size="6">
<a name="Vectors"></a>
<a name="SEC88"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC87" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC89" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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>
<h3 class="subsection"> 26.1.2 Vectors </h3>
<p><code>vect</code> is a package of functions for vector analysis.
<code>load (&quot;vect&quot;)</code> loads this package, and <code>demo (&quot;vect&quot;)</code> displays a demonstration.
</p>
<p>The vector analysis package can combine and simplify symbolic 
expressions including dot products and cross products, together with
the gradient, divergence, curl, and Laplacian operators.  The
distribution of these operators over sums or products is governed
by several flags, as are various other expansions, including expansion
into components in any specific orthogonal coordinate systems.
There are also functions for deriving the scalar or vector potential
of a field.
</p>
<p>The <code>vect</code> package contains these functions:
<code>vectorsimp</code>, <code>scalefactors</code>,
<code>express</code>, <code>potential</code>, and <code>vectorpotential</code>.
</p>
<p>Warning: the <code>vect</code> package declares the dot operator <code>.</code>
to be a commutative operator.
</p>
<hr size="6">
<a name="eigen"></a>
<a name="SEC89"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC88" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC90" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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>
<h3 class="subsection"> 26.1.3 eigen </h3>

<p>The package <code>eigen</code> contains several functions devoted to the
symbolic computation of eigenvalues and eigenvectors.
Maxima loads the package automatically if one of the functions
<code>eigenvalues</code> or <code>eigenvectors</code> is invoked.
The package may be loaded explicitly as <code>load (&quot;eigen&quot;)</code>.
</p>
<p><code>demo (&quot;eigen&quot;)</code> displays a demonstration of the capabilities
of this package.
<code>batch (&quot;eigen&quot;)</code> executes the same demonstration,
but without the user prompt between successive computations.
</p>
<p>The functions in the <code>eigen</code> package are
<code>innerproduct</code>, <code>unitvector</code>, <code>columnvector</code>,
<code>gramschmidt</code>, <code>eigenvalues</code>, <code>eigenvectors</code>, <code>uniteigenvectors</code>,
and <code>similaritytransform</code>.
</p>
<hr size="6">
<a name="Definitions-for-Matrices-and-Linear-Algebra"></a>
<a name="SEC90"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC89" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC85" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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"> 26.2 Definitions for Matrices and Linear Algebra </h2>

<dl>
<dt><u>Function:</u> <b>addcol</b><i> (<var>M</var>, <var>list_1</var>, ..., <var>list_n</var>)</i>
<a name="IDX751"></a>
</dt>
<dd><p>Appends the column(s) given by the one
or more lists (or matrices) onto the matrix <var>M</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>addrow</b><i> (<var>M</var>, <var>list_1</var>, ..., <var>list_n</var>)</i>
<a name="IDX752"></a>
</dt>
<dd><p>Appends the row(s) given by the one or
more lists (or matrices) onto the matrix <var>M</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>adjoint</b><i> (<var>M</var>)</i>
<a name="IDX753"></a>
</dt>
<dd><p>Returns the adjoint of the matrix <var>M</var>.
The adjoint matrix is the transpose of the matrix of cofactors of <var>M</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>augcoefmatrix</b><i> ([<var>eqn_1</var>, ..., <var>eqn_m</var>], [<var>x_1</var>, ..., <var>x_n</var>])</i>
<a name="IDX754"></a>
</dt>
<dd><p>Returns the augmented coefficient
matrix for the variables <var>x_1</var>, ..., <var>x_n</var> of the system of linear equations
<var>eqn_1</var>, ..., <var>eqn_m</var>.  This is the coefficient matrix with a column adjoined for
the constant terms in each equation (i.e., those terms not dependent upon
<var>x_1</var>, ..., <var>x_n</var>).
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: [2*x - (a - 1)*y = 5*b, c + b*y + a*x = 0]$
(%i2) augcoefmatrix (m, [x, y]);
                       [ 2  1 - a  - 5 b ]
(%o2)                  [                 ]
                       [ a    b      c   ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>charpoly</b><i> (<var>M</var>, <var>x</var>)</i>
<a name="IDX755"></a>
</dt>
<dd><p>Returns the characteristic polynomial for the matrix <var>M</var>
with respect to variable <var>x</var>.  That is,
<code>determinant (<var>M</var> - diagmatrix (length (<var>M</var>), <var>x</var>))</code>.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) a: matrix ([3, 1], [2, 4]);
                            [ 3  1 ]
(%o1)                       [      ]
                            [ 2  4 ]
(%i2) expand (charpoly (a, lambda));
                           2
(%o2)                lambda  - 7 lambda + 10
(%i3) (programmode: true, solve (%));
(%o3)               [lambda = 5, lambda = 2]
(%i4) matrix ([x1], [x2]);
                             [ x1 ]
(%o4)                        [    ]
                             [ x2 ]
(%i5) ev (a . % - lambda*%, %th(2)[1]);
                          [ x2 - 2 x1 ]
(%o5)                     [           ]
                          [ 2 x1 - x2 ]
(%i6) %[1, 1] = 0;
(%o6)                     x2 - 2 x1 = 0
(%i7) x2^2 + x1^2 = 1;
                            2     2
(%o7)                     x2  + x1  = 1
(%i8) solve ([%th(2), %], [x1, x2]);
                  1               2
(%o8) [[x1 = - -------, x2 = - -------], 
               sqrt(5)         sqrt(5)

                                             1             2
                                    [x1 = -------, x2 = -------]]
                                          sqrt(5)       sqrt(5)
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>coefmatrix</b><i> ([<var>eqn_1</var>, ..., <var>eqn_m</var>], [<var>x_1</var>, ..., <var>x_n</var>])</i>
<a name="IDX756"></a>
</dt>
<dd><p>Returns the coefficient matrix for the
variables <var>x_1</var>, ..., <var>x_n</var> of the system of linear equations 
<var>eqn_1</var>, ..., <var>eqn_m</var>.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) coefmatrix([2*x-(a-1)*y+5*b = 0, b*y+a*x = 3], [x,y]);
                                 [ 2  1 - a ]
(%o1)                            [          ]
                                 [ a    b   ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>col</b><i> (<var>M</var>, <var>i</var>)</i>
<a name="IDX757"></a>
</dt>
<dd><p>Returns the <var>i</var>'th column of the matrix <var>M</var>.
The return value is a matrix.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>columnvector</b><i> (<var>L</var>)</i>
<a name="IDX758"></a>
</dt>
<dt><u>Function:</u> <b>covect</b><i> (<var>L</var>)</i>
<a name="IDX759"></a>
</dt>
<dd><p>Returns a matrix of one column and <code>length (<var>L</var>)</code> rows,
containing the elements of the list <var>L</var>.
</p>
<p><code>covect</code> is a synonym for <code>columnvector</code>.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p>This is useful if you want to use parts of the outputs of
the functions in this package in matrix calculations.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;eigen&quot;)$
Warning - you are redefining the Macsyma function eigenvalues
Warning - you are redefining the Macsyma function eigenvectors
(%i2) columnvector ([aa, bb, cc, dd]);
                             [ aa ]
                             [    ]
                             [ bb ]
(%o2)                        [    ]
                             [ cc ]
                             [    ]
                             [ dd ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>conjugate</b><i> (<var>x</var>)</i>
<a name="IDX760"></a>
</dt>
<dd><p>Returns the complex conjugate of <var>x</var>.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) declare ([aa, bb], real, cc, complex, ii, imaginary);

(%o1)                         done
(%i2) conjugate (aa + bb*%i);

(%o2)                      aa - %i bb
(%i3) conjugate (cc);

(%o3)                     conjugate(cc)
(%i4) conjugate (ii);

(%o4)                         - ii
(%i5) conjugate (xx + yy);

(%o5)             conjugate(yy) + conjugate(xx)
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>copymatrix</b><i> (<var>M</var>)</i>
<a name="IDX761"></a>
</dt>
<dd><p>Returns a copy of the matrix <var>M</var>.  This is the only way
to make a copy aside from copying <var>M</var> element by element.
</p>
<p>Note that an assignment of one matrix to another, as in <code>m2: m1</code>,
does not copy <code>m1</code>.
An assignment <code>m2 [i,j]: x</code> or <code>setelmx (x, i, j, m2</code> also modifies <code>m1 [i,j]</code>.
Creating a copy with <code>copymatrix</code> and then using assignment creates a separate, modified copy.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>determinant</b><i> (<var>M</var>)</i>
<a name="IDX762"></a>
</dt>
<dd><p>Computes the determinant of <var>M</var> by a method similar to
Gaussian elimination.
</p>
<p>The form of the result depends upon the setting
of the switch <code>ratmx</code>.
</p>
<p>There is a special routine for computing
sparse determinants which is called when the switches
<code>ratmx</code> and <code>sparse</code> are both <code>true</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>detout</b>
<a name="IDX763"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>detout</code> is <code>true</code>, the determinant of a
matrix whose inverse is computed is factored out of the inverse.
</p>
<p>For this switch to have an effect <code>doallmxops</code> and <code>doscmxops</code> should be
<code>false</code> (see their descriptions).  Alternatively this switch can be
given to <code>ev</code> which causes the other two to be set correctly.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: matrix ([a, b], [c, d]);
                            [ a  b ]
(%o1)                       [      ]
                            [ c  d ]
(%i2) detout: true$
(%i3) doallmxops: false$
(%i4) doscmxops: false$
(%i5) invert (m);
                          [  d   - b ]
                          [          ]
                          [ - c   a  ]
(%o5)                     ------------
                           a d - b c
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>diagmatrix</b><i> (<var>n</var>, <var>x</var>)</i>
<a name="IDX764"></a>
</dt>
<dd><p>Returns a diagonal matrix of size <var>n</var> by <var>n</var> with the
diagonal elements all equal to <var>x</var>.
<code>diagmatrix (<var>n</var>, 1)</code> returns an identity matrix (same as <code>ident (<var>n</var>)</code>).
</p>
<p><var>n</var> must evaluate to an integer, otherwise <code>diagmatrix</code> complains with an error message.
</p>
<p><var>x</var> can be any kind of expression, including another matrix.
If <var>x</var> is a matrix, it is not copied; all diagonal elements refer to the same instance, <var>x</var>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>doallmxops</b>
<a name="IDX765"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>doallmxops</code> is <code>true</code>,
all operations relating to matrices are carried out.
When it is <code>false</code> then the setting of the
individual <code>dot</code> switches govern which operations are performed.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>domxexpt</b>
<a name="IDX766"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>domxexpt</code> is <code>true</code>,
a matrix exponential, <code>exp (<var>M</var>)</code> where <var>M</var> is a matrix,
is interpreted as a matrix with element <code>[i,j</code> equal to <code>exp (m[i,j])</code>.
Otherwise <code>exp (<var>M</var>)</code> evaluates to <code>exp (<var>ev(M)</var></code>.
</p>
<p><code>domxexpt</code>
affects all expressions of the form <code><var>base</var>^<var>power</var></code> where <var>base</var> is an
expression assumed scalar or constant, and <var>power</var> is a list or
matrix.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: matrix ([1, %i], [a+b, %pi]);
                         [   1    %i  ]
(%o1)                    [            ]
                         [ b + a  %pi ]
(%i2) domxexpt: false$
(%i3) (1 - c)^m;
                             [   1    %i  ]
                             [            ]
                             [ b + a  %pi ]
(%o3)                 (1 - c)
(%i4) domxexpt: true$
(%i5) (1 - c)^m;
                  [                      %i  ]
                  [    1 - c      (1 - c)    ]
(%o5)             [                          ]
                  [        b + a         %pi ]
                  [ (1 - c)       (1 - c)    ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>domxmxops</b>
<a name="IDX767"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>domxmxops</code> is <code>true</code>, all matrix-matrix or
matrix-list operations are carried out (but not scalar-matrix
operations); if this switch is <code>false</code> such operations are not carried out.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>domxnctimes</b>
<a name="IDX768"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>domxnctimes</code> is <code>true</code>, non-commutative products of
matrices are carried out.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dontfactor</b>
<a name="IDX769"></a>
</dt>
<dd><p>Default value: <code>[]</code>
</p>
<p><code>dontfactor</code> may be set to a list of variables with respect
to which factoring is not to occur.  (The list is initially empty.)
Factoring also will not take place with respect to any variables which
are less important, according the variable ordering assumed for canonical rational expression (CRE) form,
than those on the <code>dontfactor</code> list.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>doscmxops</b>
<a name="IDX770"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>doscmxops</code> is <code>true</code>, scalar-matrix operations are
carried out.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>doscmxplus</b>
<a name="IDX771"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>doscmxplus</code> is <code>true</code>, scalar-matrix operations yield
a matrix result.  This switch is not subsumed under <code>doallmxops</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dot0nscsimp</b>
<a name="IDX772"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dot0nscsimp</code> is <code>true</code>, a non-commutative product of zero
and a nonscalar term is simplified to a commutative product.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dot0simp</b>
<a name="IDX773"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dot0simp</code> is <code>true</code>,
a non-commutative product of zero and
a scalar term is simplified to a commutative product.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dot1simp</b>
<a name="IDX774"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dot1simp</code> is <code>true</code>,
a non-commutative product of one and
another term is simplified to a commutative product.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotassoc</b>
<a name="IDX775"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dotassoc</code> is <code>true</code>, an expression <code>(A.B).C</code> simplifies to
<code>A.(B.C)</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotconstrules</b>
<a name="IDX776"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dotconstrules</code> is <code>true</code>, a non-commutative product of a
constant and another term is simplified to a commutative product.
Turning on this flag effectively turns on <code>dot0simp</code>, <code>dot0nscsimp</code>, and
<code>dot1simp</code> as well.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotdistrib</b>
<a name="IDX777"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>dotdistrib</code> is <code>true</code>, an expression <code>A.(B + C)</code> simplifies to <code>A.B + A.C</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotexptsimp</b>
<a name="IDX778"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>dotexptsimp</code> is <code>true</code>, an expression <code>A.A</code> simplifies to <code>A^^2</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotident</b>
<a name="IDX779"></a>
</dt>
<dd><p>Default value: 1
</p>
<p><code>dotident</code> is the value returned by <code>X^^0</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>dotscrules</b>
<a name="IDX780"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>dotscrules</code> is <code>true</code>, an expression <code>A.SC</code> or <code>SC.A</code> simplifies
to <code>SC*A</code> and <code>A.(SC*B)</code> simplifies to <code>SC*(A.B)</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>echelon</b><i> (<var>M</var>)</i>
<a name="IDX781"></a>
</dt>
<dd><p>Returns the echelon form of the matrix <var>M</var>,
as produced by Gaussian elimination.
The echelon form is computed from <var>M</var>
by elementary row operations such that the first
non-zero element in each row in the resulting matrix is one and the
column elements under the first one in each row are all zero.
</p>
<p><code>triangularize</code> also carries out Gaussian elimination,
but it does not normalize the leading non-zero element in each row.
</p>
<p><code>lu_factor</code> and <code>cholesky</code> are other functions which yield triangularized matrices.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) M: matrix ([3, 7, aa, bb], [-1, 8, 5, 2], [9, 2, 11, 4]);
                       [  3   7  aa  bb ]
                       [                ]
(%o1)                  [ - 1  8  5   2  ]
                       [                ]
                       [  9   2  11  4  ]
(%i2) echelon (M);
                  [ 1  - 8  - 5      - 2     ]
                  [                          ]
                  [         28       11      ]
                  [ 0   1   --       --      ]
(%o2)             [         37       37      ]
                  [                          ]
                  [              37 bb - 119 ]
                  [ 0   0    1   ----------- ]
                  [              37 aa - 313 ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>eigenvalues</b><i> (<var>M</var>)</i>
<a name="IDX782"></a>
</dt>
<dt><u>Function:</u> <b>eivals</b><i> (<var>M</var>)</i>
<a name="IDX783"></a>
</dt>
<dd><p>Returns a list of two lists containing the eigenvalues of the matrix <var>M</var>.
The first sublist of the return value is the list of eigenvalues of the
matrix, and the second sublist is the list of the
multiplicities of the eigenvalues in the corresponding order.
</p>
<p><code>eivals</code> is a synonym for <code>eigenvalues</code>.
</p>
<p><code>eigenvalues</code> calls the function <code>solve</code> to find the roots of the
characteristic polynomial of the matrix.
Sometimes <code>solve</code> may not be able to find the roots of the polynomial;
in that case some other functions in this
package (except <code>innerproduct</code>, <code>unitvector</code>, <code>columnvector</code> and
<code>gramschmidt</code>) will not work.
</p>
<p>In some cases the eigenvalues found by <code>solve</code> may be complicated expressions.
(This may happen when <code>solve</code> returns a not-so-obviously real expression
for an eigenvalue which is known to be real.)
It may be possible to simplify the eigenvalues using some other functions.
</p>
<p>The package <code>eigen.mac</code> is loaded automatically when
<code>eigenvalues</code> or <code>eigenvectors</code> is referenced.
If <code>eigen.mac</code> is not already loaded,
<code>load (&quot;eigen&quot;)</code> loads it.
After loading, all functions and variables in the package are available.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>eigenvectors</b><i> (<var>M</var>)</i>
<a name="IDX784"></a>
</dt>
<dt><u>Function:</u> <b>eivects</b><i> (<var>M</var>)</i>
<a name="IDX785"></a>
</dt>
<dd><p>takes a matrix <var>M</var> as its argument and returns a list
of lists the first sublist of which is the output of <code>eigenvalues</code>
and the other sublists of which are the eigenvectors of the
matrix corresponding to those eigenvalues respectively.
The calculated eigenvectors and the unit eigenvectors of the matrix are the
right eigenvectors and the right unit eigenvectors respectively.
</p>
<p><code>eivects</code> is a synonym for <code>eigenvectors</code>.
</p>
<p>The package <code>eigen.mac</code> is loaded automatically when
<code>eigenvalues</code> or <code>eigenvectors</code> is referenced.
If <code>eigen.mac</code> is not already loaded,
<code>load (&quot;eigen&quot;)</code> loads it.
After loading, all functions and variables in the package are available.
</p>
<p>The flags that affect this function are:
</p>
<p><code>nondiagonalizable</code> is set to <code>true</code> or <code>false</code> depending on
whether the matrix is nondiagonalizable or diagonalizable after
<code>eigenvectors</code> returns.
</p>
<p><code>hermitianmatrix</code> when <code>true</code>, causes the degenerate
eigenvectors of the Hermitian matrix to be orthogonalized using the
Gram-Schmidt algorithm.
</p>
<p><code>knowneigvals</code> when <code>true</code> causes the <code>eigen</code> package to assume the
eigenvalues of the matrix are known to the user and stored under the
global name <code>listeigvals</code>.  <code>listeigvals</code> should be set to a list similar
to the output <code>eigenvalues</code>.
</p>
<p>The function <code>algsys</code> is used here to solve for the eigenvectors. Sometimes if the
eigenvalues are messy, <code>algsys</code> may not be able to find a solution.
In some cases, it may be possible to simplify the eigenvalues by
first finding them using <code>eigenvalues</code> command and then using other functions
to reduce them to something simpler.
Following simplification, <code>eigenvectors</code> can be called again
with the <code>knowneigvals</code> flag set to <code>true</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ematrix</b><i> (<var>m</var>, <var>n</var>, <var>x</var>, <var>i</var>, <var>j</var>)</i>
<a name="IDX786"></a>
</dt>
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, all elements of which
are zero except for the <code>[<var>i</var>, <var>j</var>]</code> element which is <var>x</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>entermatrix</b><i> (<var>m</var>, <var>n</var>)</i>
<a name="IDX787"></a>
</dt>
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, reading the elements interactively.
</p>
<p>If <var>n</var> is equal to <var>m</var>,
Maxima prompts for the type of the matrix (diagonal, symmetric, antisymmetric, or general)
and for each element.
Each response is terminated by a semicolon <code>;</code> or dollar sign <code>$</code>.
</p>
<p>If <var>n</var> is not equal to <var>m</var>,
Maxima prompts for each element.
</p>
<p>The elements may be any expressions, which are evaluated.
<code>entermatrix</code> evaluates its arguments.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) n: 3$
(%i2) m: entermatrix (n, n)$

Is the matrix  1. Diagonal  2. Symmetric  3. Antisymmetric  4. General
Answer 1, 2, 3 or 4 : 
1$
Row 1 Column 1: 
(a+b)^n$
Row 2 Column 2: 
(a+b)^(n+1)$
Row 3 Column 3: 
(a+b)^(n+2)$

Matrix entered.
(%i3) m;
                [        3                     ]
                [ (b + a)      0         0     ]
                [                              ]
(%o3)           [                  4           ]
                [    0      (b + a)      0     ]
                [                              ]
                [                            5 ]
                [    0         0      (b + a)  ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>genmatrix</b><i> (<var>a</var>, <var>i_2</var>, <var>j_2</var>, <var>i_1</var>, <var>j_1</var>)</i>
<a name="IDX788"></a>
</dt>
<dt><u>Function:</u> <b>genmatrix</b><i> (<var>a</var>, <var>i_2</var>, <var>j_2</var>, <var>i_1</var>)</i>
<a name="IDX789"></a>
</dt>
<dt><u>Function:</u> <b>genmatrix</b><i> (<var>a</var>, <var>i_2</var>, <var>j_2</var>)</i>
<a name="IDX790"></a>
</dt>
<dd><p>Returns a matrix generated from <var>a</var>,
taking element <code><var>a</var>[<var>i_1</var>,<var>j_1</var>]</code>
as the upper-left element and <code><var>a</var>[<var>i_2</var>,<var>j_2</var>]</code>
as the lower-right element of the matrix.
Here <var>a</var> is a declared array (created by <code>array</code> but not by <code>make_array</code>)
or an undeclared array,
or an array function,
or a lambda expression of two arguments.
(An array function is created like other functions with <code>:=</code> or <code>define</code>,
but arguments are enclosed in square brackets instead of parentheses.)
</p>
<p>If <var>j_1</var> is omitted, it is assumed equal to <var>i_1</var>.
If both <var>j_1</var> and <var>i_1</var> are omitted, both are assumed equal to 1.
</p>
<p>If a selected element <code>i,j</code> of the array is undefined,
the matrix will contain a symbolic element <code><var>a</var>[i,j]</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) h [i, j] := 1 / (i + j - 1);
                                    1
(%o1)                  h     := ---------
                        i, j    i + j - 1
(%i2) genmatrix (h, 3, 3);
                           [    1  1 ]
                           [ 1  -  - ]
                           [    2  3 ]
                           [         ]
                           [ 1  1  1 ]
(%o2)                      [ -  -  - ]
                           [ 2  3  4 ]
                           [         ]
                           [ 1  1  1 ]
                           [ -  -  - ]
                           [ 3  4  5 ]
(%i3) array (a, fixnum, 2, 2);
(%o3)                           a
(%i4) a [1, 1] : %e;
(%o4)                          %e
(%i5) a [2, 2] : %pi;
(%o5)                          %pi
(%i6) genmatrix (a, 2, 2);
                           [ %e   0  ]
(%o6)                      [         ]
                           [ 0   %pi ]
(%i7) genmatrix (lambda ([i, j], j - i), 3, 3);
                         [  0    1   2 ]
                         [             ]
(%o7)                    [ - 1   0   1 ]
                         [             ]
                         [ - 2  - 1  0 ]
(%i8) genmatrix (B, 2, 2);
                        [ B      B     ]
                        [  1, 1   1, 2 ]
(%o8)                   [              ]
                        [ B      B     ]
                        [  2, 1   2, 2 ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>gramschmidt</b><i> (<var>x</var>)</i>
<a name="IDX791"></a>
</dt>
<dt><u>Function:</u> <b>gschmit</b><i> (<var>x</var>)</i>
<a name="IDX792"></a>
</dt>
<dd><p>Carries out the Gram-Schmidt orthogonalization algorithm on <var>x</var>,
which is either a matrix or a list of lists.
<var>x</var> is not modified by <code>gramschmidt</code>.
</p>
<p>If <var>x</var> is a matrix, the algorithm is applied to the rows of <var>x</var>.
If <var>x</var> is a list of lists, the algorithm is applied to the sublists,
which must have equal numbers of elements.
In either case,
the return value is a list of lists, the sublists of which are orthogonal
and span the same space as <var>x</var>.
If the dimension of the span of <var>x</var> is less than the number of rows or sublists,
some sublists of the return value are zero.
</p>
<p><code>factor</code> is called at each stage of the algorithm to simplify intermediate results.
As a consequence, the return value may contain factored integers.
</p>
<p><code>gschmit</code> (note spelling) is a synonym for <code>gramschmidt</code>.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;eigen&quot;)$
Warning - you are redefining the Macsyma function eigenvalues
Warning - you are redefining the Macsyma function eigenvectors
(%i2) x: matrix ([1, 2, 3], [9, 18, 30], [12, 48, 60]);
                         [ 1   2   3  ]
                         [            ]
(%o2)                    [ 9   18  30 ]
                         [            ]
                         [ 12  48  60 ]
(%i3) y: gramschmidt (x);
                       2      2            4     3
                      3      3   3 5      2  3  2  3
(%o3)  [[1, 2, 3], [- ---, - --, ---], [- ----, ----, 0]]
                      2 7    7   2 7       5     5
(%i4) i: innerproduct$
(%i5) [i (y[1], y[2]), i (y[2], y[3]), i (y[3], y[1])];
(%o5)                       [0, 0, 0]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>hach</b><i> (<var>a</var>, <var>b</var>, <var>m</var>, <var>n</var>, <var>l</var>)</i>
<a name="IDX793"></a>
</dt>
<dd><p><code>hach</code> is an implementation of Hacijan's linear programming algorithm.
</p>
<p><code>load (&quot;kach&quot;)</code> loads this function.
<code>demo (&quot;kach&quot;)</code> executes a demonstration of this function.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ident</b><i> (<var>n</var>)</i>
<a name="IDX794"></a>
</dt>
<dd><p>Returns an <var>n</var> by <var>n</var> identity matrix.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>innerproduct</b><i> (<var>x</var>, <var>y</var>)</i>
<a name="IDX795"></a>
</dt>
<dt><u>Function:</u> <b>inprod</b><i> (<var>x</var>, <var>y</var>)</i>
<a name="IDX796"></a>
</dt>
<dd><p>Returns the inner product (also called the scalar product or dot product) of <var>x</var> and <var>y</var>,
which are lists of equal length, or both 1-column or 1-row matrices of equal length.
The return value is <code>conjugate (x) . y</code>,
where <code>.</code> is the noncommutative multiplication operator.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p><code>inprod</code> is a synonym for <code>innerproduct</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>invert</b><i> (<var>M</var>)</i>
<a name="IDX797"></a>
</dt>
<dd><p>Returns the inverse of the matrix <var>M</var>.
The inverse is computed by the adjoint method.
</p>
<p>This allows a user to compute the inverse of a matrix with
bfloat entries or polynomials with floating pt. coefficients without
converting to cre-form.
</p>
<p>Cofactors are computed by the <code>determinant</code> function,
so if <code>ratmx</code> is <code>false</code> the inverse is computed
without changing the representation of the elements.
</p>
<p>The current
implementation is inefficient for matrices of high order.
</p>
<p>When <code>detout</code> is <code>true</code>, the determinant is factored out of the
inverse.
</p>
<p>The elements of the inverse are not automatically expanded.
If <var>M</var> has polynomial elements, better appearing output can be
generated by <code>expand (invert (m)), detout</code>.
If it is desirable to then
divide through by the determinant this can be accomplished by <code>xthru (%)</code>
or alternatively from scratch by
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">expand (adjoint (m)) / expand (determinant (m))
invert (m) := adjoint (m) / determinant (m)
</pre></td></tr></table>
<p>See <code>^^</code> (noncommutative exponent) for another method of inverting a matrix.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>lmxchar</b>
<a name="IDX798"></a>
</dt>
<dd><p>Default value: <code>[</code>
</p>
<p><code>lmxchar</code> is the character displayed as the left
delimiter of a matrix.
See also <code>rmxchar</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) lmxchar: &quot;|&quot;$
(%i2) matrix ([a, b, c], [d, e, f], [g, h, i]);
                           | a  b  c ]
                           |         ]
(%o2)                      | d  e  f ]
                           |         ]
                           | g  h  i ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>matrix</b><i> (<var>row_1</var>, ..., <var>row_n</var>)</i>
<a name="IDX799"></a>
</dt>
<dd><p>Returns a rectangular matrix which has the rows <var>row_1</var>, ..., <var>row_n</var>.
Each row is a list of expressions.
All rows must be the same length.
</p>
<p>The operations <code>+</code> (addition), <code>-</code> (subtraction), <code>*</code> (multiplication),
and <code>/</code> (division), are carried out element by element
when the operands are two matrices, a scalar and a matrix, or a matrix and a scalar.
The operation <code>^</code> (exponentiation, equivalently <code>**</code>)
is carried out element by element 
if the operands are a scalar and a matrix or a matrix and a scalar,
but not if the operands are two matrices.
All operations are normally carried out in full,
including <code>.</code> (noncommutative multiplication).
</p>
<p>Matrix multiplication is represented by the noncommutative multiplication operator <code>.</code>.
The corresponding noncommutative exponentiation operator is <code>^^</code>.
For a matrix <code><var>A</var></code>, <code><var>A</var>.<var>A</var> = <var>A</var>^^2</code> and
<code><var>A</var>^^-1</code> is the inverse of <var>A</var>, if it exists.
</p>
<p>There are switches for controlling simplification of expressions
involving dot and matrix-list operations.
These are
<code>doallmxops</code>, <code>domxexpt</code>
<code>domxmxops</code>, <code>doscmxops</code>, and <code>doscmxplus</code>.
</p>
<p>There are additional options which are related to matrices. These are:
<code>lmxchar</code>, <code>rmxchar</code>, <code>ratmx</code>, <code>listarith</code>, <code>detout</code>,
<code>scalarmatrix</code>,
and <code>sparse</code>.
</p>
<p>There are a number of
functions which take matrices as arguments or yield matrices as return values.
See <code>eigenvalues</code>, <code>eigenvectors</code>,
<code>determinant</code>,
<code>charpoly</code>, <code>genmatrix</code>, <code>addcol</code>, <code>addrow</code>, 
<code>copymatrix</code>, <code>transpose</code>, <code>echelon</code>,
and <code>rank</code>.
</p>
<p>Examples:
</p>
<ul>
<li>
Construction of matrices from lists.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) x: matrix ([17, 3], [-8, 11]);
                           [ 17   3  ]
(%o1)                      [         ]
                           [ - 8  11 ]
(%i2) y: matrix ([%pi, %e], [a, b]);
                           [ %pi  %e ]
(%o2)                      [         ]
                           [  a   b  ]
</pre></td></tr></table><ul>
<li>
Addition, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i3) x + y;
                      [ %pi + 17  %e + 3 ]
(%o3)                 [                  ]
                      [  a - 8    b + 11 ]
</pre></td></tr></table><ul>
<li>
Subtraction, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) x - y;
                      [ 17 - %pi  3 - %e ]
(%o4)                 [                  ]
                      [ - a - 8   11 - b ]
</pre></td></tr></table><ul>
<li>
Multiplication, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i5) x * y;
                        [ 17 %pi  3 %e ]
(%o5)                   [              ]
                        [ - 8 a   11 b ]
</pre></td></tr></table><ul>
<li>
Division, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i6) x / y;
                        [ 17       - 1 ]
                        [ ---  3 %e    ]
                        [ %pi          ]
(%o6)                   [              ]
                        [   8    11    ]
                        [ - -    --    ]
                        [   a    b     ]
</pre></td></tr></table><ul>
<li>
Matrix to a scalar exponent, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i7) x ^ 3;
                         [ 4913    27  ]
(%o7)                    [             ]
                         [ - 512  1331 ]
</pre></td></tr></table><ul>
<li>
Scalar base to a matrix exponent, element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i8) exp(y); 
                         [   %pi    %e ]
                         [ %e     %e   ]
(%o8)                    [             ]
                         [    a     b  ]
                         [  %e    %e   ]
</pre></td></tr></table><ul>
<li>
Matrix base to a matrix exponent. This is not carried out element by element.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i9) x ^ y;
                                [ %pi  %e ]
                                [         ]
                                [  a   b  ]
                     [ 17   3  ]
(%o9)                [         ]
                     [ - 8  11 ]
</pre></td></tr></table><ul>
<li>
Noncommutative matrix multiplication.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i10) x . y;
                  [ 3 a + 17 %pi  3 b + 17 %e ]
(%o10)            [                           ]
                  [ 11 a - 8 %pi  11 b - 8 %e ]
(%i11) y . x;
                [ 17 %pi - 8 %e  3 %pi + 11 %e ]
(%o11)          [                              ]
                [  17 a - 8 b     11 b + 3 a   ]
</pre></td></tr></table><ul>
<li>
Noncommutative matrix exponentiation.
A scalar base <var>b</var> to a matrix power <var>M</var>
is carried out element by element and so <code>b^^m</code> is the same as <code>b^m</code>.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i12) x ^^ 3;
                        [  3833   1719 ]
(%o12)                  [              ]
                        [ - 4584  395  ]
(%i13) %e ^^ y;
                         [   %pi    %e ]
                         [ %e     %e   ]
(%o13)                   [             ]
                         [    a     b  ]
                         [  %e    %e   ]
</pre></td></tr></table><ul>
<li>
A matrix raised to a -1 exponent with noncommutative exponentiation is the matrix inverse,
if it exists.
</li></ul>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i14) x ^^ -1;
                         [ 11      3  ]
                         [ ---  - --- ]
                         [ 211    211 ]
(%o14)                   [            ]
                         [  8    17   ]
                         [ ---   ---  ]
                         [ 211   211  ]
(%i15) x . (x ^^ -1);
                            [ 1  0 ]
(%o15)                      [      ]
                            [ 0  1 ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>matrixmap</b><i> (<var>f</var>, <var>M</var>)</i>
<a name="IDX800"></a>
</dt>
<dd><p>Returns a matrix with element <code>i,j</code> equal to <code><var>f</var>(<var>M</var>[i,j])</code>.
</p>
<p>See also <code>map</code>, <code>fullmap</code>, <code>fullmapl</code>, and <code>apply</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>matrixp</b><i> (<var>expr</var>)</i>
<a name="IDX801"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a matrix, otherwise <code>false</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>matrix_element_add</b>
<a name="IDX802"></a>
</dt>
<dd><p>Default value: <code>+</code>
</p>
<p><code>matrix_element_add</code> is the operation 
invoked in place of addition in a matrix multiplication.
<code>matrix_element_add</code> can be assigned any n-ary operator
(that is, a function which handles any number of arguments).
The assigned value may be the name of an operator enclosed in quote marks,
the name of a function,
or a lambda expression.
</p>
<p>See also <code>matrix_element_mult</code> and <code>matrix_element_transpose</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) matrix_element_add: &quot;*&quot;$
(%i2) matrix_element_mult: &quot;^&quot;$
(%i3) aa: matrix ([a, b, c], [d, e, f]);
                           [ a  b  c ]
(%o3)                      [         ]
                           [ d  e  f ]
(%i4) bb: matrix ([u, v, w], [x, y, z]);
                           [ u  v  w ]
(%o4)                      [         ]
                           [ x  y  z ]
(%i5) aa . transpose (bb);
                     [  u  v  w   x  y  z ]
                     [ a  b  c   a  b  c  ]
(%o5)                [                    ]
                     [  u  v  w   x  y  z ]
                     [ d  e  f   d  e  f  ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>matrix_element_mult</b>
<a name="IDX803"></a>
</dt>
<dd><p>Default value: <code>*</code>
</p>
<p><code>matrix_element_mult</code> is the operation 
invoked in place of multiplication in a matrix multiplication.
<code>matrix_element_mult</code> can be assigned any binary operator.
The assigned value may be the name of an operator enclosed in quote marks,
the name of a function,
or a lambda expression.
</p>
<p>The dot operator <code>.</code> is a useful choice in some contexts.
</p>
<p>See also <code>matrix_element_add</code> and <code>matrix_element_transpose</code>.
</p>
<p>Example:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) matrix_element_add: lambda ([[x]], sqrt (apply (&quot;+&quot;, x)))$
(%i2) matrix_element_mult: lambda ([x, y], (x - y)^2)$
(%i3) [a, b, c] . [x, y, z];
                          2          2          2
(%o3)         sqrt((c - z)  + (b - y)  + (a - x) )
(%i4) aa: matrix ([a, b, c], [d, e, f]);
                           [ a  b  c ]
(%o4)                      [         ]
                           [ d  e  f ]
(%i5) bb: matrix ([u, v, w], [x, y, z]);
                           [ u  v  w ]
(%o5)                      [         ]
                           [ x  y  z ]
(%i6) aa . transpose (bb);
               [             2          2          2  ]
               [ sqrt((c - w)  + (b - v)  + (a - u) ) ]
(%o6)  Col 1 = [                                      ]
               [             2          2          2  ]
               [ sqrt((f - w)  + (e - v)  + (d - u) ) ]

                         [             2          2          2  ]
                         [ sqrt((c - z)  + (b - y)  + (a - x) ) ]
                 Col 2 = [                                      ]
                         [             2          2          2  ]
                         [ sqrt((f - z)  + (e - y)  + (d - x) ) ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>matrix_element_transpose</b>
<a name="IDX804"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p><code>matrix_element_transpose</code> is the operation 
applied to each element of a matrix when it is transposed.
<code>matrix_element_mult</code> can be assigned any unary operator.
The assigned value may be the name of an operator enclosed in quote marks,
the name of a function,
or a lambda expression.
</p>
<p>When <code>matrix_element_transpose</code> equals <code>transpose</code>,
the <code>transpose</code> function is applied to every element.
When <code>matrix_element_transpose</code> equals <code>nonscalars</code>,
the <code>transpose</code> function is applied to every nonscalar element.
If some element is an atom, the <code>nonscalars</code> option applies
<code>transpose</code> only if the atom is declared nonscalar,
while the <code>transpose</code> option always applies <code>transpose</code>.
</p>
<p>The default value, <code>false</code>, means no operation is applied.
</p>
<p>See also <code>matrix_element_add</code> and <code>matrix_element_mult</code>.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) declare (a, nonscalar)$
(%i2) transpose ([a, b]);
                        [ transpose(a) ]
(%o2)                   [              ]
                        [      b       ]
(%i3) matrix_element_transpose: nonscalars$
(%i4) transpose ([a, b]);
                        [ transpose(a) ]
(%o4)                   [              ]
                        [      b       ]
(%i5) matrix_element_transpose: transpose$
(%i6) transpose ([a, b]);
                        [ transpose(a) ]
(%o6)                   [              ]
                        [ transpose(b) ]
(%i7) matrix_element_transpose: lambda ([x], realpart(x) - %i*imagpart(x))$
(%i8) m: matrix ([1 + 5*%i, 3 - 2*%i], [7*%i, 11]);
                     [ 5 %i + 1  3 - 2 %i ]
(%o8)                [                    ]
                     [   7 %i       11    ]
(%i9) transpose (m);
                      [ 1 - 5 %i  - 7 %i ]
(%o9)                 [                  ]
                      [ 2 %i + 3    11   ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>mattrace</b><i> (<var>M</var>)</i>
<a name="IDX805"></a>
</dt>
<dd><p>Returns the trace (that is, the sum of the elements on the main diagonal) of
the square matrix <var>M</var>.  
</p>
<p><code>mattrace</code> is called by <code>ncharpoly</code>,
an alternative to Maxima's <code>charpoly</code>.
</p>
<p><code>load (&quot;nchrpl&quot;)</code> loads this function.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>minor</b><i> (<var>M</var>, <var>i</var>, <var>j</var>)</i>
<a name="IDX806"></a>
</dt>
<dd><p>Returns the <var>i</var>, <var>j</var> minor of the matrix <var>M</var>.  That is, <var>M</var>
with row <var>i</var> and column <var>j</var> removed.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ncexpt</b><i> (<var>a</var>, <var>b</var>)</i>
<a name="IDX807"></a>
</dt>
<dd><p>If a non-commutative exponential expression is too
wide to be displayed as <code><var>a</var>^^<var>b</var></code> it appears as <code>ncexpt (<var>a</var>,<var>b</var>)</code>.
</p>
<p><code>ncexpt</code> is not the name of a function or operator;
the name only appears in output, and is not recognized in input.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>ncharpoly</b><i> (<var>M</var>, <var>x</var>)</i>
<a name="IDX808"></a>
</dt>
<dd><p>Returns the characteristic polynomial of the matrix <var>M</var>
with respect to <var>x</var>.  This is an alternative to Maxima's <code>charpoly</code>.
</p>
<p><code>ncharpoly</code> works by computing traces of powers of the given matrix,
which are known to be equal to sums of powers of the roots of the
characteristic polynomial.  From these quantities the symmetric
functions of the roots can be calculated, which are nothing more than
the coefficients of the characteristic polynomial.  <code>charpoly</code> works by
forming the determinant of <code><var>x</var> * ident [n] - a</code>.  Thus <code>ncharpoly</code> wins,
for example, in the case of large dense matrices filled with integers,
since it avoids polynomial arithmetic altogether.
</p>
<p><code>load (&quot;nchrpl&quot;)</code> loads this file.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>newdet</b><i> (<var>M</var>, <var>n</var>)</i>
<a name="IDX809"></a>
</dt>
<dd><p>Computes the determinant of the matrix or array <var>M</var> by the
Johnson-Gentleman tree minor algorithm.
The argument <var>n</var> is the order; it is optional if <var>M</var> is a matrix.
</p>
</dd></dl>

<dl>
<dt><u>Declaration:</u> <b>nonscalar</b>
<a name="IDX810"></a>
</dt>
<dd><p>Makes atoms behave as does a list or matrix with respect to
the dot operator.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>nonscalarp</b><i> (<var>expr</var>)</i>
<a name="IDX811"></a>
</dt>
<dd><p>Returns <code>true</code> if <var>expr</var> is a non-scalar, i.e., it contains
atoms declared as non-scalars, lists, or matrices.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>permanent</b><i> (<var>M</var>, <var>n</var>)</i>
<a name="IDX812"></a>
</dt>
<dd><p>Computes the permanent of the matrix <var>M</var>.  A permanent
is like a determinant but with no sign changes.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>rank</b><i> (<var>M</var>)</i>
<a name="IDX813"></a>
</dt>
<dd><p>Computes the rank of the matrix <var>M</var>.  That is, the order of the
largest non-singular subdeterminant of <var>M</var>.
</p>
<p><var>rank</var> may return the
wrong answer if it cannot determine that a matrix element that is
equivalent to zero is indeed so.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>ratmx</b>
<a name="IDX814"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>ratmx</code> is <code>false</code>, determinant and matrix
addition, subtraction, and multiplication are performed in the
representation of the matrix elements and cause the result of
matrix inversion to be left in general representation.
</p>
<p>When <code>ratmx</code> is <code>true</code>,
the 4 operations mentioned above are performed in CRE form and the
result of matrix inverse is in CRE form.  Note that this may
cause the elements to be expanded (depending on the setting of <code>ratfac</code>)
which might not always be desired.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>row</b><i> (<var>M</var>, <var>i</var>)</i>
<a name="IDX815"></a>
</dt>
<dd><p>Returns the <var>i</var>'th row of the matrix <var>M</var>.
The return value is a matrix.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>scalarmatrixp</b>
<a name="IDX816"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>When <code>scalarmatrixp</code> is <code>true</code>, then whenever a 1 x 1 matrix
is produced as a result of computing the dot product of matrices it
is simplified to a scalar, namely the sole element of the matrix.
</p>
<p>When <code>scalarmatrixp</code> is <code>all</code>,
then all 1 x 1 matrices are simplified to scalars.
</p>
<p>When <code>scalarmatrixp</code> is <code>false</code>, 1 x 1 matrices are not simplified to scalars.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>scalefactors</b><i> (<var>coordinatetransform</var>)</i>
<a name="IDX817"></a>
</dt>
<dd><p>Here coordinatetransform
evaluates to the form [[expression1, expression2, ...],
indeterminate1, indeterminat2, ...], where indeterminate1,
indeterminate2, etc. are the curvilinear coordinate variables and
where a set of rectangular Cartesian components is given in terms of
the curvilinear coordinates by [expression1, expression2, ...].
<code>coordinates</code> is set to the vector [indeterminate1, indeterminate2,...],
and <code>dimension</code> is set to the length of this vector.  SF[1], SF[2],
..., SF[DIMENSION] are set to the coordinate scale factors, and <code>sfprod</code>
is set to the product of these scale factors.  Initially, <code>coordinates</code>
is [X, Y, Z], <code>dimension</code> is 3, and SF[1]=SF[2]=SF[3]=SFPROD=1,
corresponding to 3-dimensional rectangular Cartesian coordinates.
To expand an expression into physical components in the current
coordinate system, there is a function with usage of the form
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>setelmx</b><i> (<var>x</var>, <var>i</var>, <var>j</var>, <var>M</var>)</i>
<a name="IDX818"></a>
</dt>
<dd><p>Assigns <var>x</var> to the (<var>i</var>, <var>j</var>)'th element of the matrix <var>M</var>,
and returns the altered matrix.
</p>
<p><code><var>M</var> [<var>i</var>, <var>j</var>]: <var>x</var></code> has the same effect,
but returns <var>x</var> instead of <var>M</var>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>similaritytransform</b><i> (<var>M</var>)</i>
<a name="IDX819"></a>
</dt>
<dt><u>Function:</u> <b>simtran</b><i> (<var>M</var>)</i>
<a name="IDX820"></a>
</dt>
<dd><p><code>similaritytransform</code> computes a similarity transform of the matrix <code>M</code>.
It returns a list which is the output of the
<code>uniteigenvectors</code> command.  In addition if the flag <code>nondiagonalizable</code>
is <code>false</code> two global matrices <code>leftmatrix</code> and <code>rightmatrix</code> are computed.
These matrices have the property that
<code>leftmatrix . <var>M</var> . rightmatrix</code> is a diagonal matrix with the eigenvalues
of <var>M</var> on the diagonal.  If <code>nondiagonalizable</code> is <code>true</code> the left and right
matrices are not computed.
</p>
<p>If the flag <code>hermitianmatrix</code> is <code>true</code>
then <code>leftmatrix</code> is the complex conjugate of the transpose of
<code>rightmatrix</code>.  Otherwise <code>leftmatrix</code> is the inverse of <code>rightmatrix</code>.
</p>
<p><code>rightmatrix</code> is the matrix the columns of which are the unit
eigenvectors of <var>M</var>.  The other flags (see <code>eigenvalues</code> and
<code>eigenvectors</code>) have the same effects since
<code>similaritytransform</code> calls the other functions in the package in order
to be able to form <code>rightmatrix</code>.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p><code>simtran</code> is a synonym for <code>similaritytransform</code>.
</p>
</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>sparse</b>
<a name="IDX821"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>sparse</code> is <code>true</code>, and if <code>ratmx</code> is <code>true</code>, then <code>determinant</code>
will use special routines for computing sparse determinants.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>submatrix</b><i> (<var>i_1</var>, ..., <var>i_m</var>, <var>M</var>, <var>j_1</var>, ..., <var>j_n</var>)</i>
<a name="IDX822"></a>
</dt>
<dt><u>Function:</u> <b>submatrix</b><i> (<var>i_1</var>, ..., <var>i_m</var>, <var>M</var>)</i>
<a name="IDX823"></a>
</dt>
<dt><u>Function:</u> <b>submatrix</b><i> (<var>M</var>, <var>j_1</var>, ..., <var>j_n</var>)</i>
<a name="IDX824"></a>
</dt>
<dd><p>Returns a new matrix composed of the
matrix <var>M</var> with rows <var>i_1</var>, ..., <var>i_m</var> deleted, and columns <var>j_1</var>, ..., <var>j_n</var> deleted.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>transpose</b><i> (<var>M</var>)</i>
<a name="IDX825"></a>
</dt>
<dd><p>Returns the transpose of <var>M</var>.
</p>
<p>If <var>M</var> is a matrix, the return value is another matrix <var>N</var>
such that <code>N[i,j] = M[j,i]</code>.
</p>
<p>Otherwise <var>M</var> is a list, and the return value is a matrix <var>N</var>
of <code>length (m)</code> rows and 1 column, such that <code>N[i,1] = M[i]</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>triangularize</b><i> (<var>M</var>)</i>
<a name="IDX826"></a>
</dt>
<dd><p>Returns the upper triangular form of the matrix <code>M</code>,
as produced by Gaussian elimination.
The return value is the same as <code>echelon</code>,
except that the leading nonzero coefficient in each row is not normalized to 1.
</p>
<p><code>lu_factor</code> and <code>cholesky</code> are other functions which yield triangularized matrices.
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) M: matrix ([3, 7, aa, bb], [-1, 8, 5, 2], [9, 2, 11, 4]);
                       [  3   7  aa  bb ]
                       [                ]
(%o1)                  [ - 1  8  5   2  ]
                       [                ]
                       [  9   2  11  4  ]
(%i2) triangularize (M);
             [ - 1   8         5            2      ]
             [                                     ]
(%o2)        [  0   - 74     - 56         - 22     ]
             [                                     ]
             [  0    0    626 - 74 aa  238 - 74 bb ]
</pre></td></tr></table>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>uniteigenvectors</b><i> (<var>M</var>)</i>
<a name="IDX827"></a>
</dt>
<dt><u>Function:</u> <b>ueivects</b><i> (<var>M</var>)</i>
<a name="IDX828"></a>
</dt>
<dd><p>Computes unit eigenvectors of the matrix <var>M</var>.
The return value is a list of lists, the first sublist of which is the
output of the <code>eigenvalues</code> command, and the other sublists of which are
the unit eigenvectors of the matrix corresponding to those eigenvalues
respectively.
</p>
<p>The flags mentioned in the description of the
<code>eigenvectors</code> command have the same effects in this one as well.
</p>
<p>When <code>knowneigvects</code> is <code>true</code>, the <code>eigen</code> package assumes
that the eigenvectors of the matrix are known to the user and are
stored under the global name <code>listeigvects</code>.  <code>listeigvects</code> should be set
to a list similar to the output of the <code>eigenvectors</code> command.
</p>
<p>If <code>knowneigvects</code> is set to <code>true</code> and the list of eigenvectors is given the
setting of the flag <code>nondiagonalizable</code> may not be correct.  If that is
the case please set it to the correct value.  The author assumes that
the user knows what he is doing and will not try to diagonalize a
matrix the eigenvectors of which do not span the vector space of the
appropriate dimension.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p><code>ueivects</code> is a synonym for <code>uniteigenvectors</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>unitvector</b><i> (<var>x</var>)</i>
<a name="IDX829"></a>
</dt>
<dt><u>Function:</u> <b>uvect</b><i> (<var>x</var>)</i>
<a name="IDX830"></a>
</dt>
<dd><p>Returns <em><var>x</var>/norm(<var>x</var>)</em>;
this is a unit vector in the same direction as <var>x</var>.
</p>
<p><code>load (&quot;eigen&quot;)</code> loads this function.
</p>
<p><code>uvect</code> is a synonym for <code>unitvector</code>.
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>vectorsimp</b><i> (<var>expr</var>)</i>
<a name="IDX831"></a>
</dt>
<dd><p>Applies simplifications and expansions according
to the following global flags:
</p>
<p><code>expandall</code>, <code>expanddot</code>, <code>expanddotplus</code>, <code>expandcross</code>, <code>expandcrossplus</code>,
<code>expandcrosscross</code>, <code>expandgrad</code>, <code>expandgradplus</code>, <code>expandgradprod</code>,
<code>expanddiv</code>, <code>expanddivplus</code>, <code>expanddivprod</code>, <code>expandcurl</code>, <code>expandcurlplus</code>,
<code>expandcurlcurl</code>, <code>expandlaplacian</code>, <code>expandlaplacianplus</code>,
and <code>expandlaplacianprod</code>.
</p>
<p>All these flags have default value <code>false</code>. The <code>plus</code> suffix refers to
employing additivity or distributivity.  The <code>prod</code> suffix refers to the
expansion for an operand that is any kind of product.
</p>
<dl compact="compact">
<dt> <code>expandcrosscross</code></dt>
<dd><p>Simplifies <em>p ~ (q ~ r)</em> to <em>(p . r)*q - (p . q)*r</em>.
</p></dd>
<dt> <code>expandcurlcurl</code></dt>
<dd><p>Simplifies <em>curl curl p</em> to <em>grad div p + div grad p</em>.
</p></dd>
<dt> <code>expandlaplaciantodivgrad</code></dt>
<dd><p>Simplifies <em>laplacian p</em> to <em>div grad p</em>.
</p></dd>
<dt> <code>expandcross</code></dt>
<dd><p>Enables <code>expandcrossplus</code> and <code>expandcrosscross</code>.
</p></dd>
<dt> <code>expandplus</code></dt>
<dd><p>Enables <code>expanddotplus</code>, <code>expandcrossplus</code>, <code>expandgradplus</code>,
<code>expanddivplus</code>, <code>expandcurlplus</code>, and <code>expandlaplacianplus</code>.
</p></dd>
<dt> <code>expandprod</code></dt>
<dd><p>Enables <code>expandgradprod</code>, <code>expanddivprod</code>, and <code>expandlaplacianprod</code>.
</p></dd>
</dl>

<p>These flags have all been declared <code>evflag</code>.
</p>

</dd></dl>

<dl>
<dt><u>Option variable:</u> <b>vect_cross</b>
<a name="IDX832"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>vect_cross</code> is <code>true</code>, it allows DIFF(X~Y,T) to work where
~ is defined in SHARE;VECT (where VECT_CROSS is set to <code>true</code>, anyway.)
</p>
</dd></dl>

<dl>
<dt><u>Function:</u> <b>zeromatrix</b><i> (<var>m</var>, <var>n</var>)</i>
<a name="IDX833"></a>
</dt>
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, all elements of which are zero.
</p>
</dd></dl>

<dl>
<dt><u>Special symbol:</u> <b>[</b>
<a name="IDX834"></a>
</dt>
<dt><u>Special symbol:</u> <b>]</b>
<a name="IDX835"></a>
</dt>
<dd><p><code>[</code> and <code>]</code> mark the beginning and end, respectively, of a list.
</p>
<p><code>[</code> and <code>]</code> also enclose the subscripts of
a list, array, hash array, or array function.
</p>
<p>Examples:
</p>
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) x: [a, b, c];
(%o1)                       [a, b, c]
(%i2) x[3];
(%o2)                           c
(%i3) array (y, fixnum, 3);
(%o3)                           y
(%i4) y[2]: %pi;
(%o4)                          %pi
(%i5) y[2];
(%o5)                          %pi
(%i6) z['foo]: 'bar;
(%o6)                          bar
(%i7) z['foo];
(%o7)                          bar
(%i8) g[k] := 1/(k^2+1);
                                  1
(%o8)                     g  := ------
                           k     2
                                k  + 1
(%i9) g[10];
                                1
(%o9)                          ---
                               101
</pre></td></tr></table>
</dd></dl>

<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" 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>