File: maxima_61.html

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (1581 lines) | stat: -rw-r--r-- 55,379 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on April, 24 2010 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<head>
<title>Maxima 5.21.1 Manual: 61. linearalgebra</title>

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

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

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

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

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

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

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

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

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

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

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

div.categorybox
{
    border: 1px solid gray;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 1em;
    padding-right: 1em;
    background: rgb(247,242,220);
}


-->
</style>

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

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

<a name="linearalgebra"></a>
<a name="SEC257"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_60.html#SEC256" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC258" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="maxima_60.html#SEC255" 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_62.html#SEC260" 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_79.html#SEC331" 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"> 61. linearalgebra </h1>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC258">61.1 Introduction to linearalgebra</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC259">61.2 Functions and Variables for linearalgebra</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<p><a name="Item_003a-Introduction-to-linearalgebra"></a>
</p><hr size="6">
<a name="Introduction-to-linearalgebra"></a>
<a name="SEC258"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC257" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC259" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC257" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC257" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_62.html#SEC260" 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_79.html#SEC331" 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"> 61.1 Introduction to linearalgebra </h2>

<p><code>linearalgebra</code> is a collection of functions for linear algebra.
</p>
<p>Example:
</p>
<pre class="example">(%i1) M : matrix ([1, 2], [1, 2]);
                            [ 1  2 ]
(%o1)                       [      ]
                            [ 1  2 ]
(%i2) nullspace (M);
                               [  1  ]
                               [     ]
(%o2)                     span([   1 ])
                               [ - - ]
                               [   2 ]
(%i3) columnspace (M);
                                [ 1 ]
(%o3)                      span([   ])
                                [ 1 ]
(%i4) ptriangularize (M - z*ident(2), z);
                         [ 1   2 - z   ]
(%o4)                    [             ]
                         [           2 ]
                         [ 0  3 z - z  ]
(%i5) M : matrix ([1, 2, 3], [4, 5, 6], [7, 8, 9]) - z*ident(3);
                     [ 1 - z    2      3   ]
                     [                     ]
(%o5)                [   4    5 - z    6   ]
                     [                     ]
                     [   7      8    9 - z ]
(%i6) MM : ptriangularize (M, z);
              [ 4  5 - z            6            ]
              [                                  ]
              [                2                 ]
              [     66        z    102 z   132   ]
              [ 0   --      - -- + ----- + ---   ]
(%o6)         [     49        7     49     49    ]
              [                                  ]
              [               3        2         ]
              [           49 z    245 z    147 z ]
              [ 0    0    ----- - ------ - ----- ]
              [            264      88      44   ]
(%i7) algebraic : true;
(%o7)                         true
(%i8) tellrat (MM [3, 3]);
                         3       2
(%o8)                  [z  - 15 z  - 18 z]
(%i9) MM : ratsimp (MM);
               [ 4  5 - z           6           ]
               [                                ]
               [                2               ]
(%o9)          [     66      7 z  - 102 z - 132 ]
               [ 0   --    - ------------------ ]
               [     49              49         ]
               [                                ]
               [ 0    0             0           ]
(%i10) nullspace (MM);
                        [        1         ]
                        [                  ]
                        [   2              ]
                        [  z  - 14 z - 16  ]
                        [  --------------  ]
(%o10)             span([        8         ])
                        [                  ]
                        [    2             ]
                        [   z  - 18 z - 12 ]
                        [ - -------------- ]
                        [         12       ]
(%i11) M : matrix ([1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12],
                   [13, 14, 15, 16]);
                       [ 1   2   3   4  ]
                       [                ]
                       [ 5   6   7   8  ]
(%o11)                 [                ]
                       [ 9   10  11  12 ]
                       [                ]
                       [ 13  14  15  16 ]
(%i12) columnspace (M);
                           [ 1  ]  [ 2  ]
                           [    ]  [    ]
                           [ 5  ]  [ 6  ]
(%o12)                span([    ], [    ])
                           [ 9  ]  [ 10 ]
                           [    ]  [    ]
                           [ 13 ]  [ 14 ]
(%i13) apply ('orthogonal_complement, args (nullspace (transpose (M))));
                           [ 0 ]  [  1  ]
                           [   ]  [     ]
                           [ 1 ]  [  0  ]
(%o13)                span([   ], [     ])
                           [ 2 ]  [ - 1 ]
                           [   ]  [     ]
                           [ 3 ]  [ - 2 ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Linear-algebra">Linear algebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Share-packages">Share packages</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>



<p><a name="Item_003a-Functions-and-Variables-for-linearalgebra"></a>
</p><hr size="6">
<a name="Functions-and-Variables-for-linearalgebra"></a>
<a name="SEC259"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC258" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_62.html#SEC260" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="#SEC257" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#SEC257" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_62.html#SEC260" 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_79.html#SEC331" 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"> 61.2 Functions and Variables for linearalgebra </h2>

<p><a name="Item_003a-addmatrices"></a>
</p><dl>
<dt><u>Function:</u> <b>addmatrices</b><i> (<var>f</var>, <var>M_1</var>, ..., <var>M_n</var>)</i>
<a name="IDX2303"></a>
</dt>
<dd><p>Using the function <var>f</var> as the addition function, return the sum of
the matrices <var>M_1</var>, ..., <var>M_n</var>. The function <var>f</var> must accept any number of
arguments (a Maxima nary function).
</p>
<p>Examples:
</p>
<pre class="example">(%i1) m1 : matrix([1,2],[3,4])$
(%i2) m2 : matrix([7,8],[9,10])$
(%i3) addmatrices('max,m1,m2);
(%o3) matrix([7,8],[9,10])
(%i4) addmatrices('max,m1,m2,5*m1);
(%o4) matrix([7,10],[15,20])
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-blockmatrixp"></a>
</p><dl>
<dt><u>Function:</u> <b>blockmatrixp</b><i> (<var>M</var>)</i>
<a name="IDX2304"></a>
</dt>
<dd><p>Return true if and only if <var>M</var> is a matrix and every entry of 
<var>M</var> is a matrix.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-columnop"></a>
</p><dl>
<dt><u>Function:</u> <b>columnop</b><i> (<var>M</var>, <var>i</var>, <var>j</var>, <var>theta</var>)</i>
<a name="IDX2305"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, return the matrix that results from doing the  
column operation <code>C_i &lt;- C_i - <var>theta</var> * C_j</code>. If <var>M</var> doesn't have a row
<var>i</var> or <var>j</var>, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-columnswap"></a>
</p><dl>
<dt><u>Function:</u> <b>columnswap</b><i> (<var>M</var>, <var>i</var>, <var>j</var>)</i>
<a name="IDX2306"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, swap columns <var>i</var> and <var>j</var>.  If <var>M</var> doesn't have a column
<var>i</var> or <var>j</var>, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-columnspace"></a>
</p><dl>
<dt><u>Function:</u> <b>columnspace</b><i> (<var>M</var>)</i>
<a name="IDX2307"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, return <code>span (v_1, ..., v_n)</code>, where the set
<code>{v_1, ..., v_n}</code> is a basis for the column space of <var>M</var>.  The span 
of the empty set is <code>{0}</code>. Thus, when the column space has only 
one member, return <code>span ()</code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-copy"></a>
</p><dl>
<dt><u>Function:</u> <b>copy</b><i> (<var>e</var>)</i>
<a name="IDX2308"></a>
</dt>
<dd><p>Return a copy of the Maxima expression <var>e</var>. Although <var>e</var> can be any
Maxima expression, the copy function is the most useful when <var>e</var> is either 
a list or a matrix; consider:
</p><pre class="example">(%i1) m : [1,[2,3]]$
(%i2) mm : m$
(%i3) mm[2][1] : x$
(%i4) m;
(%o4)                      [1,[x,3]]
(%i5) mm;
(%o5)                      [1,[x,3]]
</pre><p>Let's try the same experiment, but this time let <var>mm</var> be a copy of <var>m</var>
</p><pre class="example">(%i6) m : [1,[2,3]]$
(%i7) mm : copy(m)$
(%i8) mm[2][1] : x$
(%i9) m;
(%o9)                     [1,[2,3]]
(%i10) mm;
(%o10)                    [1,[x,3]]
</pre><p>This time, the assignment to <var>mm</var> does not change the value of <var>m</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-cholesky"></a>
</p><dl>
<dt><u>Function:</u> <b>cholesky</b><i> (<var>M</var>)</i>
<a name="IDX2309"></a>
</dt>
<dt><u>Function:</u> <b>cholesky</b><i> (<var>M</var>, <var>field</var>)</i>
<a name="IDX2310"></a>
</dt>
<dd><p>Return the Cholesky factorization of the matrix selfadjoint (or hermitian) matrix 
<var>M</var>. The second argument defaults to 'generalring.' For a description of the
possible values for <var>field</var>, see <code>lu_factor</code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Matrix-decompositions">Matrix decompositions</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-ctranspose"></a>
</p><dl>
<dt><u>Function:</u> <b>ctranspose</b><i> (<var>M</var>)</i>
<a name="IDX2311"></a>
</dt>
<dd><p>Return the complex conjugate transpose of the matrix <var>M</var>. The function
<code>ctranspose</code> uses <code>matrix_element_transpose</code> to transpose each matrix element.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-diag_005fmatrix"></a>
</p><dl>
<dt><u>Function:</u> <b>diag_matrix</b><i> (<var>d_1</var>, <var>d_2</var>,...,<var>d_n</var>)</i>
<a name="IDX2312"></a>
</dt>
<dd><p>Return a diagonal matrix with diagonal entries <var>d_1</var>, <var>d_2</var>,...,<var>d_n</var>.
When the diagonal entries are matrices, the zero entries of the returned matrix
are zero matrices of the appropriate size; for example:
</p><pre class="example">(%i1) diag_matrix(diag_matrix(1,2),diag_matrix(3,4));

                            [ [ 1  0 ]  [ 0  0 ] ]
                            [ [      ]  [      ] ]
                            [ [ 0  2 ]  [ 0  0 ] ]
(%o1)                       [                    ]
                            [ [ 0  0 ]  [ 3  0 ] ]
                            [ [      ]  [      ] ]
                            [ [ 0  0 ]  [ 0  4 ] ]
(%i2) diag_matrix(p,q);

                                   [ p  0 ]
(%o2)                              [      ]
                                   [ 0  q ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-dotproduct"></a>
</p><dl>
<dt><u>Function:</u> <b>dotproduct</b><i> (<var>u</var>, <var>v</var>)</i>
<a name="IDX2313"></a>
</dt>
<dd><p>Return the dotproduct of vectors <var>u</var> and <var>v</var>.  This is the same
as <code>conjugate (transpose (<var>u</var>)) . <var>v</var></code>.  The arguments <var>u</var> and <var>v</var> must be
column vectors.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-eigens_005fby_005fjacobi"></a>
</p><dl>
<dt><u>Function:</u> <b>eigens_by_jacobi</b><i> (<var>A</var>)</i>
<a name="IDX2314"></a>
</dt>
<dt><u>Function:</u> <b>eigens_by_jacobi</b><i> (<var>A</var>, <var>field_type</var>)</i>
<a name="IDX2315"></a>
</dt>
<dd><p>Computes the eigenvalues and eigenvectors of <var>A</var> by the method of Jacobi rotations.
<var>A</var> must be a symmetric matrix (but it need not be positive definite nor positive semidefinite).
<var>field_type</var> indicates the computational field, either <code>floatfield</code> or <code>bigfloatfield</code>.
If <var>field_type</var> is not specified, it defaults to <code>floatfield</code>.
</p>
<p>The elements of <var>A</var> must be numbers or expressions which evaluate to numbers
via <code>float</code> or <code>bfloat</code> (depending on <var>field_type</var>).
</p>
<p>Examples:
</p>
<pre class="example">(%i1) S: matrix([1/sqrt(2), 1/sqrt(2)],[-1/sqrt(2), 1/sqrt(2)]);
                     [     1         1    ]
                     [  -------   ------- ]
                     [  sqrt(2)   sqrt(2) ]
(%o1)                [                    ]
                     [      1        1    ]
                     [ - -------  ------- ]
                     [   sqrt(2)  sqrt(2) ]
(%i2) L : matrix ([sqrt(3), 0], [0, sqrt(5)]);
                      [ sqrt(3)     0    ]
(%o2)                 [                  ]
                      [    0     sqrt(5) ]
(%i3) M : S . L . transpose (S);
            [ sqrt(5)   sqrt(3)  sqrt(5)   sqrt(3) ]
            [ ------- + -------  ------- - ------- ]
            [    2         2        2         2    ]
(%o3)       [                                      ]
            [ sqrt(5)   sqrt(3)  sqrt(5)   sqrt(3) ]
            [ ------- - -------  ------- + ------- ]
            [    2         2        2         2    ]
(%i4) eigens_by_jacobi (M);
The largest percent change was 0.1454972243679
The largest percent change was 0.0
number of sweeps: 2
number of rotations: 1
(%o4) [[1.732050807568877, 2.23606797749979], 
                        [  0.70710678118655   0.70710678118655 ]
                        [                                      ]]
                        [ - 0.70710678118655  0.70710678118655 ]
(%i5) float ([[sqrt(3), sqrt(5)], S]);
(%o5) [[1.732050807568877, 2.23606797749979], 
                        [  0.70710678118655   0.70710678118655 ]
                        [                                      ]]
                        [ - 0.70710678118655  0.70710678118655 ]
(%i6) eigens_by_jacobi (M, bigfloatfield);
The largest percent change was 1.454972243679028b-1
The largest percent change was 0.0b0
number of sweeps: 2
number of rotations: 1
(%o6) [[1.732050807568877b0, 2.23606797749979b0], 
                [  7.071067811865475b-1   7.071067811865475b-1 ]
                [                                              ]]
                [ - 7.071067811865475b-1  7.071067811865475b-1 ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Matrix-decompositions">Matrix decompositions</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-get_005flu_005ffactors"></a>
</p><dl>
<dt><u>Function:</u> <b>get_lu_factors</b><i> (<var>x</var>) </i>
<a name="IDX2316"></a>
</dt>
<dd><p>When <code><var>x</var> = lu_factor (<var>A</var>)</code>, then <code>get_lu_factors</code> returns a list of the 
form <code>[P, L, U]</code>, where <var>P</var> is a permutation matrix, <var>L</var> is lower triangular with
ones on the diagonal, and <var>U</var> is upper triangular, and <code><var>A</var> = <var>P</var> <var>L</var> <var>U</var></code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-hankel"></a>
</p><dl>
<dt><u>Function:</u> <b>hankel</b><i> (<var>col</var>)</i>
<a name="IDX2317"></a>
</dt>
<dt><u>Function:</u> <b>hankel</b><i> (<var>col</var>, <var>row</var>)</i>
<a name="IDX2318"></a>
</dt>
<dd><p>Return a Hankel matrix <var>H</var>. The first column of <var>H</var> is <var>col</var>;
except for the first entry, the last row of <var>H</var> is <var>row</var>. The
default for <var>row</var> is the zero vector with the same length as <var>col</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-hessian"></a>
</p><dl>
<dt><u>Function:</u> <b>hessian</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX2319"></a>
</dt>
<dd><p>Returns the Hessian matrix of <var>f</var> with respect to the list of variables <var>x</var>.
The <code>(i, j)</code>-th element of the Hessian matrix is <code>diff(<var>f</var>, <var>x</var>[i], 1, <var>x</var>[j], 1)</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) hessian (x * sin (y), [x, y]);
                     [   0       cos(y)   ]
(%o1)                [                    ]
                     [ cos(y)  - x sin(y) ]
(%i2) depends (F, [a, b]);
(%o2)                       [F(a, b)]
(%i3) hessian (F, [a, b]);
                        [   2      2   ]
                        [  d F    d F  ]
                        [  ---   ----- ]
                        [    2   da db ]
                        [  da          ]
(%o3)                   [              ]
                        [   2      2   ]
                        [  d F    d F  ]
                        [ -----   ---  ]
                        [ da db     2  ]
                        [         db   ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Differential-calculus">Differential calculus</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-hilbert_005fmatrix"></a>
</p><dl>
<dt><u>Function:</u> <b>hilbert_matrix</b><i> (<var>n</var>)</i>
<a name="IDX2320"></a>
</dt>
<dd><p>Return the <var>n</var> by <var>n</var> Hilbert matrix. When <var>n</var> isn't a positive
integer, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-identfor"></a>
</p><dl>
<dt><u>Function:</u> <b>identfor</b><i> (<var>M</var>)</i>
<a name="IDX2321"></a>
</dt>
<dt><u>Function:</u> <b>identfor</b><i> (<var>M</var>, <var>fld</var>)</i>
<a name="IDX2322"></a>
</dt>
<dd><p>Return an identity matrix that has the same shape as the matrix
<var>M</var>.  The diagonal entries of the identity matrix are the 
multiplicative identity of the field <var>fld</var>; the default for
<var>fld</var> is <var>generalring</var>.
</p>
<p>The first argument <var>M</var> should be a square matrix or a 
non-matrix. When <var>M</var> is a matrix, each entry of <var>M</var> can be a
square matrix - thus <var>M</var> can be a blocked Maxima matrix. The
matrix can be blocked to any (finite) depth.
</p>
<p>See also <code>zerofor</code>
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-invert_005fby_005flu"></a>
</p><dl>
<dt><u>Function:</u> <b>invert_by_lu</b><i> (<var>M</var>, <var>(rng generalring)</var>)</i>
<a name="IDX2323"></a>
</dt>
<dd><p>Invert a matrix <var>M</var> by using the LU factorization.  The LU factorization
is done using the ring <var>rng</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-jacobian"></a>
</p><dl>
<dt><u>Function:</u> <b>jacobian</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX2324"></a>
</dt>
<dd><p>Returns the Jacobian matrix of the list of functions <var>f</var> with respect to the list of variables <var>x</var>.
The <code>(i, j)</code>-th element of the Jacobian matrix is <code>diff(<var>f</var>[i], <var>x</var>[j])</code>.
</p>
<p>Examples:
</p>
<pre class="example">(%i1) jacobian ([sin (u - v), sin (u * v)], [u, v]);
                  [ cos(v - u)  - cos(v - u) ]
(%o1)             [                          ]
                  [ v cos(u v)   u cos(u v)  ]
(%i2) depends ([F, G], [y, z]);
(%o2)                  [F(y, z), G(y, z)]
(%i3) jacobian ([F, G], [y, z]);
                           [ dF  dF ]
                           [ --  -- ]
                           [ dy  dz ]
(%o3)                      [        ]
                           [ dG  dG ]
                           [ --  -- ]
                           [ dy  dz ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Differential-calculus">Differential calculus</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-kronecker_005fproduct"></a>
</p><dl>
<dt><u>Function:</u> <b>kronecker_product</b><i> (<var>A</var>, <var>B</var>)</i>
<a name="IDX2325"></a>
</dt>
<dd><p>Return the Kronecker product of the matrices <var>A</var> and <var>B</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>


<dl>
<dt><u>Function:</u> <b>listp</b><i> (<var>e</var>, <var>p</var>)</i>
<a name="IDX2326"></a>
</dt>
<dt><u>Function:</u> <b>listp</b><i> (<var>e</var>)</i>
<a name="IDX2327"></a>
</dt>
<dd><p>Given an optional argument <var>p</var>, return <code>true</code> if <var>e</var> is 
a Maxima list and <var>p</var> evaluates to <code>true</code> for every list element.
When <code>listp</code> is not given the optional argument, return <code>true</code> if <var>e</var> is 
a Maxima list.  In all other cases, return <code>false</code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-locate_005fmatrix_005fentry"></a>
</p><dl>
<dt><u>Function:</u> <b>locate_matrix_entry</b><i> (<var>M</var>, <var>r_1</var>, <var>c_1</var>, <var>r_2</var>, <var>c_2</var>, <var>f</var>, <var>rel</var>)</i>
<a name="IDX2328"></a>
</dt>
<dd><p>The first argument must be a matrix; the arguments
<var>r_1</var> through <var>c_2</var> determine a sub-matrix of <var>M</var> that consists of
rows <var>r_1</var> through <var>r_2</var> and columns <var>c_1</var> through <var>c_2</var>. 
</p>
<p>Find a entry in the sub-matrix <var>M</var> that satisfies some property. 
Three cases:
</p>
<p>(1) <code><var>rel</var> = 'bool</code> and <var>f</var> a predicate: 
</p>
<p>Scan the sub-matrix from left to right then top to bottom,
and return the index of the first entry that satisfies the 
predicate <var>f</var>. If no matrix entry satisfies <var>f</var>, return <code>false</code>.
</p>
<p>(2) <code><var>rel</var> = 'max</code> and <var>f</var> real-valued:
</p>
<p>Scan the sub-matrix looking for an entry that maximizes <var>f</var>.
Return the index of a maximizing entry.
</p>
<p>(3) <code><var>rel</var> = 'min</code> and <var>f</var> real-valued:
</p>
<p>Scan the sub-matrix looking for an entry that minimizes <var>f</var>. 
Return the index of a minimizing entry.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-lu_005fbacksub"></a>
</p><dl>
<dt><u>Function:</u> <b>lu_backsub</b><i> (<var>M</var>, <var>b</var>)</i>
<a name="IDX2329"></a>
</dt>
<dd><p>When <code><var>M</var> = lu_factor (<var>A</var>, <var>field</var>)</code>,
then <code>lu_backsub (<var>M</var>, <var>b</var>)</code> solves the linear
system <code><var>A</var> <var>x</var> = <var>b</var></code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-lu_005ffactor"></a>
</p><dl>
<dt><u>Function:</u> <b>lu_factor</b><i> (<var>M</var>, <var>field</var>)</i>
<a name="IDX2330"></a>
</dt>
<dd><p>Return a list of the form <code>[<var>LU</var>, <var>perm</var>, <var>fld</var>]</code>, 
or <code>[<var>LU</var>, <var>perm</var>, <var>fld</var>, <var>lower-cnd</var> <var>upper-cnd</var>]</code>, where
</p>
<p>  (1) The matrix <var>LU</var> contains the factorization of <var>M</var> in a packed form. Packed
      form means three things: First, the rows of <var>LU</var> are permuted according to the 
      list <var>perm</var>.  If, for example, <var>perm</var> is the list <code>[3,2,1]</code>, the actual first row 
      of the <var>LU</var> factorization is the third row of the matrix <var>LU</var>. Second,
      the lower triangular factor of m is the lower triangular part of <var>LU</var> with the
      diagonal entries replaced by all ones. Third, the upper triangular factor of 
      <var>M</var> is the upper triangular part of <var>LU</var>.  
</p>
<p>  (2) When the field is either <code>floatfield</code> or <code>complexfield</code>,
      the numbers <var>lower-cnd</var> and <var>upper-cnd</var> are lower and upper bounds for the 
      infinity norm condition number of <var>M</var>.  For all fields, the condition number 
      might not be estimated; for such fields, <code>lu_factor</code> returns a two item list.
      Both the lower and upper bounds can differ from their true values by 
      arbitrarily large factors. (See also <code>mat_cond</code>.)
</p>   
<p>  The argument <var>M</var> must be a square matrix.
</p>
<p>  The optional argument <var>fld</var> must be a symbol that determines a ring or field. The pre-defined 
  fields and rings are:
</p>
<p>    (a) <code>generalring</code> - the ring of Maxima expressions,
    (b) <code>floatfield</code> -  the field of floating point numbers of the type double,
    (c) <code>complexfield</code> -  the field of complex floating point numbers of the 
        type double,
    (d) <code>crering</code>  - the ring of Maxima CRE expressions,
    (e) <code>rationalfield</code> - the field of rational numbers,
    (f) <code>runningerror</code> - track the all floating point rounding errors,
    (g) <code>noncommutingring</code> - the ring of Maxima expressions where multiplication is the
        non-commutative dot operator.       
</p>
<p>When the field is <code>floatfield</code>, <code>complexfield</code>, or
<code>runningerror</code>, the algorithm uses partial pivoting; for all
other fields, rows are switched only when needed to avoid a zero
pivot.
</p>
<p>Floating point addition arithmetic isn't associative, so the meaning
of 'field' differs from the mathematical definition.
</p>
<p>A member of the field <code>runningerror</code> is a two member Maxima list
of the form <code>[x,n]</code>,where <var>x</var> is a floating point number and
<code>n</code> is an integer. The relative difference between the 'true'
value of <code>x</code> and <code>x</code> is approximately bounded by the machine
epsilon times <code>n</code>. The running error bound drops some terms that
of the order the square of the machine epsilon.
</p>
<p>There is no user-interface for defining a new field. A user that is
familiar with Common Lisp should be able to define a new field.  To do
this, a user must define functions for the arithmetic operations and
functions for converting from the field representation to Maxima and
back. Additionally, for ordered fields (where partial pivoting will be
used), a user must define functions for the magnitude and for
comparing field members.  After that all that remains is to define a
Common Lisp structure <code>mring</code>.  The file <code>mring</code> has many
examples.
</p> 
<p>To compute the factorization, the first task is to convert each matrix
entry to a member of the indicated field. When conversion isn't
possible, the factorization halts with an error message. Members of
the field needn't be Maxima expressions.  Members of the
<code>complexfield</code>, for example, are Common Lisp complex numbers. Thus
after computing the factorization, the matrix entries must be
converted to Maxima expressions.
</p>
<p>See also  <code>get_lu_factors</code>.
</p>

<p>Examples:
</p>
<pre class="example">(%i1) w[i,j] := random (1.0) + %i * random (1.0);
(%o1)          w     := random(1.) + %i random(1.)
                i, j
(%i2) showtime : true$
Evaluation took 0.00 seconds (0.00 elapsed)
(%i3) M : genmatrix (w, 100, 100)$
Evaluation took 7.40 seconds (8.23 elapsed)
(%i4) lu_factor (M, complexfield)$
Evaluation took 28.71 seconds (35.00 elapsed)
(%i5) lu_factor (M, generalring)$
Evaluation took 109.24 seconds (152.10 elapsed)
(%i6) showtime : false$

(%i7) M : matrix ([1 - z, 3], [3, 8 - z]); 
                        [ 1 - z    3   ]
(%o7)                   [              ]
                        [   3    8 - z ]
(%i8) lu_factor (M, generalring);
          [ 1 - z         3        ]
          [                        ]
(%o8)    [[   3            9       ], [1, 2], generalring]
          [ -----  - z - ----- + 8 ]
          [ 1 - z        1 - z     ]
(%i9) get_lu_factors (%);
                  [   1    0 ]  [ 1 - z         3        ]
        [ 1  0 ]  [          ]  [                        ]
(%o9)  [[      ], [   3      ], [                9       ]]
        [ 0  1 ]  [ -----  1 ]  [   0    - z - ----- + 8 ]
                  [ 1 - z    ]  [              1 - z     ]
(%i10) %[1] . %[2] . %[3];
                        [ 1 - z    3   ]
(%o10)                  [              ]
                        [   3    8 - z ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Matrix-decompositions">Matrix decompositions</a>
 &middot;
<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-mat_005fcond"></a>
</p><dl>
<dt><u>Function:</u> <b>mat_cond</b><i> (<var>M</var>, 1)</i>
<a name="IDX2331"></a>
</dt>
<dt><u>Function:</u> <b>mat_cond</b><i> (<var>M</var>, inf)</i>
<a name="IDX2332"></a>
</dt>
<dd><p>Return the <var>p</var>-norm matrix condition number of the matrix
<var>m</var>. The allowed values for <var>p</var> are 1 and <var>inf</var>.  This
function uses the LU factorization to invert the matrix <var>m</var>. Thus
the running time for <code>mat_cond</code> is proportional to the cube of
the matrix size; <code>lu_factor</code> determines lower and upper bounds
for the infinity norm condition number in time proportional to the
square of the matrix size.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-mat_005fnorm"></a>
</p><dl>
<dt><u>Function:</u> <b>mat_norm</b><i> (<var>M</var>, 1)</i>
<a name="IDX2333"></a>
</dt>
<dt><u>Function:</u> <b>mat_norm</b><i> (<var>M</var>, inf)</i>
<a name="IDX2334"></a>
</dt>
<dt><u>Function:</u> <b>mat_norm</b><i> (<var>M</var>, frobenius)</i>
<a name="IDX2335"></a>
</dt>
<dd><p>Return the matrix <var>p</var>-norm of the matrix <var>M</var>.  The allowed values for <var>p</var> are
1, <code>inf</code>, and <code>frobenius</code> (the Frobenius matrix norm). The matrix <var>M</var> should be
an unblocked matrix.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>


<dl>
<dt><u>Function:</u> <b>matrixp</b><i> (<var>e</var>, <var>p</var>)</i>
<a name="IDX2336"></a>
</dt>
<dt><u>Function:</u> <b>matrixp</b><i> (<var>e</var>)</i>
<a name="IDX2337"></a>
</dt>
<dd><p>Given an optional argument <var>p</var>, return <code>true</code> if <var>e</var> is 
a matrix and <var>p</var> evaluates to <code>true</code> for every matrix element.
When <code>matrixp</code> is not given an optional argument, return <code>true</code> 
if <code>e</code> is a matrix.  In all other cases, return <code>false</code>.
</p>
<p>See also <code>blockmatrixp</code>
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-matrix_005fsize"></a>
</p><dl>
<dt><u>Function:</u> <b>matrix_size</b><i> (<var>M</var>)</i>
<a name="IDX2338"></a>
</dt>
<dd><p>Return a two member list that gives the number of rows and columns, respectively
of the matrix <var>M</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-mat_005ffullunblocker"></a>
</p><dl>
<dt><u>Function:</u> <b>mat_fullunblocker</b><i> (<var>M</var>)</i>
<a name="IDX2339"></a>
</dt>
<dd><p>If <var>M</var> is a block matrix, unblock the matrix to all levels. If <var>M</var> is a matrix,
return <var>M</var>; otherwise, signal an error.  
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-mat_005ftrace"></a>
</p><dl>
<dt><u>Function:</u> <b>mat_trace</b><i> (<var>M</var>)</i>
<a name="IDX2340"></a>
</dt>
<dd><p>Return the trace of the matrix <var>M</var>. If <var>M</var> isn't a matrix, return a
noun form. When <var>M</var> is a block matrix, <code>mat_trace(M)</code> returns
the same value as does <code>mat_trace(mat_unblocker(m))</code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-mat_005funblocker"></a>
</p><dl>
<dt><u>Function:</u> <b>mat_unblocker</b><i> (<var>M</var>)</i>
<a name="IDX2341"></a>
</dt>
<dd><p>If <var>M</var> is a block matrix, unblock <var>M</var> one level. If <var>M</var> is a matrix, 
<code>mat_unblocker (M)</code> returns <var>M</var>; otherwise, signal an error.
</p>
<p>Thus if each entry of <var>M</var> is matrix, <code>mat_unblocker (M)</code> returns an 
unblocked matrix, but if each entry of <var>M</var> is a block matrix, <code>mat_unblocker (M)</code> 
returns a block matrix with one less level of blocking.
</p>
<p>If you use block matrices, most likely you'll want to set <code>matrix_element_mult</code> to 
<code>&quot;.&quot;</code> and <code>matrix_element_transpose</code> to <code>'transpose</code>. See also <code>mat_fullunblocker</code>.
</p>
<p>Example:
</p>
<pre class="example">(%i1) A : matrix ([1, 2], [3, 4]);
                            [ 1  2 ]
(%o1)                       [      ]
                            [ 3  4 ]
(%i2) B : matrix ([7, 8], [9, 10]);
                            [ 7  8  ]
(%o2)                       [       ]
                            [ 9  10 ]
(%i3) matrix ([A, B]);
                     [ [ 1  2 ]  [ 7  8  ] ]
(%o3)                [ [      ]  [       ] ]
                     [ [ 3  4 ]  [ 9  10 ] ]
(%i4) mat_unblocker (%);
                         [ 1  2  7  8  ]
(%o4)                    [             ]
                         [ 3  4  9  10 ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-nonnegintegerp"></a>
</p><dl>
<dt><u>Function:</u> <b>nonnegintegerp</b><i> (<var>n</var>)</i>
<a name="IDX2342"></a>
</dt>
<dd><p>Return <code>true</code> if and only if <code><var>n</var> &gt;= 0</code> and <var>n</var> is an integer.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-nullspace"></a>
</p><dl>
<dt><u>Function:</u> <b>nullspace</b><i> (<var>M</var>)</i>
<a name="IDX2343"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, return <code>span (v_1, ..., v_n)</code>, where the set <code>{v_1, ..., v_n}</code>
is a basis for the nullspace of <var>M</var>.  The span of the empty set is <code>{0}</code>.  
Thus, when the nullspace has only one member, return <code>span ()</code>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-nullity"></a>
</p><dl>
<dt><u>Function:</u> <b>nullity</b><i> (<var>M</var>)</i>
<a name="IDX2344"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, return the dimension of the nullspace of <var>M</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-orthogonal_005fcomplement"></a>
</p><dl>
<dt><u>Function:</u> <b>orthogonal_complement</b><i> (<var>v_1</var>, ..., <var>v_n</var>)</i>
<a name="IDX2345"></a>
</dt>
<dd><p>Return <code>span (u_1, ..., u_m)</code>, where the set <code>{u_1, ..., u_m}</code> is a 
basis for the orthogonal complement of the set <code>(v_1, ..., v_n)</code>.
</p>
<p>Each vector <var>v_1</var> through <var>v_n</var> must be a column vector.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-polynomialp"></a>
</p><dl>
<dt><u>Function:</u> <b>polynomialp</b><i> (<var>p</var>, <var>L</var>, <var>coeffp</var>, <var>exponp</var>)</i>
<a name="IDX2346"></a>
</dt>
<dt><u>Function:</u> <b>polynomialp</b><i> (<var>p</var>, <var>L</var>, <var>coeffp</var>)</i>
<a name="IDX2347"></a>
</dt>
<dt><u>Function:</u> <b>polynomialp</b><i> (<var>p</var>, <var>L</var>)</i>
<a name="IDX2348"></a>
</dt>
<dd><p>Return <code>true</code> if <var>p</var> is a polynomial in the variables in the list <var>L</var>,
The predicate <var>coeffp</var> must evaluate to <code>true</code> for each
coefficient, and the predicate <var>exponp</var> must evaluate to <code>true</code> for all 
exponents of the variables in <var>L</var>. If you want to use a non-default
value for <var>exponp</var>, you must supply <var>coeffp</var> with a value even if you want
to use the default for <var>coeffp</var>.
</p>
<p><code>polynomialp (<var>p</var>, <var>L</var>, <var>coeffp</var>)</code> is equivalent to
<code>polynomialp (<var>p</var>, <var>L</var>, <var>coeffp</var>, 'nonnegintegerp)</code>.
</p>
<p><code>polynomialp (<var>p</var>, <var>L</var>)</code> is equivalent to
<code>polynomialp (<var>p</var>, L<var>,</var> 'constantp, 'nonnegintegerp)</code>.
</p>
<p>The polynomial needn't be expanded:
</p>
<pre class="example">(%i1) polynomialp ((x + 1)*(x + 2), [x]);
(%o1)                         true
(%i2) polynomialp ((x + 1)*(x + 2)^a, [x]);
(%o2)                         false
</pre>
<p>An example using non-default values for coeffp and exponp:
</p>
<pre class="example">(%i1) polynomialp ((x + 1)*(x + 2)^(3/2), [x], numberp, numberp);
(%o1)                         true
(%i2) polynomialp ((x^(1/2) + 1)*(x + 2)^(3/2), [x], numberp,
                                                        numberp);
(%o2)                         true
</pre>
<p>Polynomials with two variables:
</p>
<pre class="example">(%i1) polynomialp (x^2 + 5*x*y + y^2, [x]);
(%o1)                         false
(%i2) polynomialp (x^2 + 5*x*y + y^2, [x, y]);
(%o2)                         true
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-polytocompanion"></a>
</p><dl>
<dt><u>Function:</u> <b>polytocompanion</b><i> (<var>p</var>, <var>x</var>)</i>
<a name="IDX2349"></a>
</dt>
<dd><p>If <var>p</var> is a polynomial in <var>x</var>, return the companion matrix of <var>p</var>. For
a monic polynomial <var>p</var> of degree <var>n</var>,
we have <code><var>p</var> = (-1)^<var>n</var> charpoly (polytocompanion (<var>p</var>, <var>x</var>))</code>.
</p>
<p>When <var>p</var> isn't a polynomial in <var>x</var>, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-ptriangularize"></a>
</p><dl>
<dt><u>Function:</u> <b>ptriangularize</b><i> (<var>M</var>, <var>v</var>)</i>
<a name="IDX2350"></a>
</dt>
<dd><p>If <var>M</var> is a matrix with each entry a polynomial in <var>v</var>, return 
a matrix <var>M2</var> such that
</p>
<p>(1) <var>M2</var> is upper triangular,
</p>
<p>(2) <code><var>M2</var> = <var>E_n</var> ... <var>E_1</var> <var>M</var></code>,
where <var>E_1</var> through <var>E_n</var> are elementary matrices 
whose entries are polynomials in <var>v</var>,
</p>
<p>(3) <code>|det (<var>M</var>)| = |det (<var>M2</var>)|</code>,
</p>
<p>Note: This function doesn't check that every entry is a polynomial in <var>v</var>.  
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-rowop"></a>
</p><dl>
<dt><u>Function:</u> <b>rowop</b><i> (<var>M</var>, <var>i</var>, <var>j</var>, <var>theta</var>)</i>
<a name="IDX2351"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, return the matrix that results from doing the  
row operation <code>R_i &lt;- R_i - theta * R_j</code>. If <var>M</var> doesn't have a row
<var>i</var> or <var>j</var>, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>


<dl>
<dt><u>Function:</u> <b>rank</b><i> (<var>M</var>)</i>
<a name="IDX2352"></a>
</dt>
<dd><p>Return the rank of that matrix <var>M</var>. The rank is the dimension of the
column space. Example:
</p><pre class="example">(%i1) rank(matrix([1,2],[2,4]));
(%o1)                                  1
(%i2) rank(matrix([1,b],[c,d]));
Proviso:  {d - b c # 0}
(%o2)                                  2
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>


<p><a name="Item_003a-rowswap"></a>
</p><dl>
<dt><u>Function:</u> <b>rowswap</b><i> (<var>M</var>, <var>i</var>, <var>j</var>)</i>
<a name="IDX2353"></a>
</dt>
<dd><p>If <var>M</var> is a matrix, swap rows <var>i</var> and <var>j</var>. If <var>M</var> doesn't have a row
<var>i</var> or <var>j</var>, signal an error.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-toeplitz"></a>
</p><dl>
<dt><u>Function:</u> <b>toeplitz</b><i> (<var>col</var>)</i>
<a name="IDX2354"></a>
</dt>
<dt><u>Function:</u> <b>toeplitz</b><i> (<var>col</var>, <var>row</var>)</i>
<a name="IDX2355"></a>
</dt>
<dd><p>Return a Toeplitz matrix <var>T</var>. The first first column of <var>T</var> is <var>col</var>;
except for the first entry, the first row of <var>T</var> is <var>row</var>. The
default for <var>row</var> is complex conjugate of <var>col</var>. Example:
</p><pre class="example">(%i1)  toeplitz([1,2,3],[x,y,z]);

                                  [ 1  y  z ]
                                  [         ]
(%o1)                             [ 2  1  y ]
                                  [         ]
                                  [ 3  2  1 ]
(%i2)  toeplitz([1,1+%i]);

                              [   1     1 - %I ]
(%o2)                         [                ]
                              [ %I + 1    1    ]
</pre>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-vandermonde_005fmatrix"></a>
</p><dl>
<dt><u>Function:</u> <b>vandermonde_matrix</b><i> ([<var>x_1</var>, ..., <var>x_n</var>])</i>
<a name="IDX2356"></a>
</dt>
<dd><p>Return a <var>n</var> by <var>n</var> matrix whose <var>i</var>-th row is 
<code>[1, <var>x_i</var>, <var>x_i</var>^2, ... <var>x_i</var>^(<var>n</var>-1)]</code>. 
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-zerofor"></a>
</p><dl>
<dt><u>Function:</u> <b>zerofor</b><i> (<var>M</var>)</i>
<a name="IDX2357"></a>
</dt>
<dt><u>Function:</u> <b>zerofor</b><i> (<var>M</var>, <var>fld</var>)</i>
<a name="IDX2358"></a>
</dt>
<dd><p>Return a zero  matrix that has the same shape as the matrix
<var>M</var>.  Every entry of the zero matrix is the
additive identity of the field <var>fld</var>; the default for
<var>fld</var> is <var>generalring</var>.
</p>
<p>The first argument <var>M</var> should be a square matrix or a
non-matrix. When <var>M</var> is a matrix, each entry of <var>M</var> can be a
square matrix - thus <var>M</var> can be a blocked Maxima matrix. The
matrix can be blocked to any (finite) depth.
</p>
<p>See also <code>identfor</code>
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-zeromatrixp"></a>
</p><dl>
<dt><u>Function:</u> <b>zeromatrixp</b><i> (<var>M</var>)</i>
<a name="IDX2359"></a>
</dt>
<dd><p>If <var>M</var> is not a block matrix, return <code>true</code> if <code>is (equal (<var>e</var>, 0))</code> 
is true for each element <var>e</var> of the matrix <var>M</var>.  If <var>M</var> is a block matrix, return
<code>true</code> if <code>zeromatrixp</code> evaluates to <code>true</code> for each element of <var>e</var>.
</p>
<div class=categorybox>


<p>Categories:&nbsp;&nbsp;<a href="maxima_95.html#Category_003a-Package-linearalgebra">Package linearalgebra</a>
 &middot;
<a href="maxima_95.html#Category_003a-Predicate-functions">Predicate functions</a>
</p>
</div>


</dd></dl>

<p><a name="Item_003a-lsquares"></a>
</p><hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC257" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="maxima_62.html#SEC260" 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_79.html#SEC331" 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>April, 24 2010</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
 </font>
 <br>

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