~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to doc/info/maxima_26.html

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
 
2
<html>
 
3
<!-- Created on September, 20 2006 by texi2html 1.76 -->
 
4
<!--
 
5
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
 
6
            Karl Berry  <karl@freefriends.org>
 
7
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
 
8
            and many others.
 
9
Maintained by: Many creative people <dev@texi2html.cvshome.org>
 
10
Send bugs and suggestions to <users@texi2html.cvshome.org>
 
11
 
 
12
-->
 
13
<head>
 
14
<title>Maxima Manual: 26. Matrices and Linear Algebra</title>
 
15
 
 
16
<meta name="description" content="Maxima Manual: 26. Matrices and Linear Algebra">
 
17
<meta name="keywords" content="Maxima Manual: 26. Matrices and Linear Algebra">
 
18
<meta name="resource-type" content="document">
 
19
<meta name="distribution" content="global">
 
20
<meta name="Generator" content="texi2html 1.76">
 
21
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
 
22
<style type="text/css">
 
23
<!--
 
24
a.summary-letter {text-decoration: none}
 
25
pre.display {font-family: serif}
 
26
pre.format {font-family: serif}
 
27
pre.menu-comment {font-family: serif}
 
28
pre.menu-preformatted {font-family: serif}
 
29
pre.smalldisplay {font-family: serif; font-size: smaller}
 
30
pre.smallexample {font-size: smaller}
 
31
pre.smallformat {font-family: serif; font-size: smaller}
 
32
pre.smalllisp {font-size: smaller}
 
33
span.sansserif {font-family:sans-serif; font-weight:normal;}
 
34
ul.toc {list-style: none}
 
35
body
 
36
{
 
37
    color: black;
 
38
    background: white; 
 
39
    margin-left: 8%;
 
40
    margin-right: 13%;
 
41
}
 
42
 
 
43
h1
 
44
{
 
45
    margin-left: +8%;
 
46
    font-size: 150%;
 
47
    font-family: sans-serif
 
48
}
 
49
 
 
50
h2
 
51
{
 
52
    font-size: 125%;
 
53
    font-family: sans-serif
 
54
}
 
55
 
 
56
h3
 
57
{
 
58
    font-size: 100%;
 
59
    font-family: sans-serif
 
60
}
 
61
 
 
62
h2,h3,h4,h5,h6 { margin-left: +4%; }
 
63
 
 
64
div.textbox
 
65
{
 
66
    border: solid;
 
67
    border-width: thin;
 
68
    /* width: 100%; */
 
69
    padding-top: 1em;
 
70
    padding-bottom: 1em;
 
71
    padding-left: 2em;
 
72
    padding-right: 2em
 
73
}
 
74
 
 
75
div.titlebox
 
76
{
 
77
    border: none;
 
78
    padding-top: 1em;
 
79
    padding-bottom: 1em;
 
80
    padding-left: 2em;
 
81
    padding-right: 2em;
 
82
    background: rgb(200,255,255);
 
83
    font-family: sans-serif
 
84
}
 
85
 
 
86
div.synopsisbox
 
87
{
 
88
    border: none;
 
89
    padding-top: 1em;
 
90
    padding-bottom: 1em;
 
91
    padding-left: 2em;
 
92
    padding-right: 2em;
 
93
     background: rgb(255,220,255);
 
94
    /*background: rgb(200,255,255); */
 
95
    /* font-family: fixed */
 
96
}
 
97
 
 
98
pre.example
 
99
{
 
100
    border: none;
 
101
    padding-top: 1em;
 
102
    padding-bottom: 1em;
 
103
    padding-left: 1em;
 
104
    padding-right: 1em;
 
105
    background: rgb(247,242,180); /* kind of sandy */
 
106
    /* background: rgb(200,255,255); */ /* sky blue */
 
107
    font-family: "Lucida Console", monospace
 
108
}
 
109
 
 
110
div.spacerbox
 
111
{
 
112
    border: none;
 
113
    padding-top: 2em;
 
114
    padding-bottom: 2em
 
115
}
 
116
 
 
117
div.image
 
118
{
 
119
    margin: 0;
 
120
    padding: 1em;
 
121
    text-align: center;
 
122
}
 
123
-->
 
124
</style>
 
125
 
 
126
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
 
127
</head>
 
128
 
 
129
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
 
130
 
 
131
<a name="Matrices-and-Linear-Algebra"></a>
 
132
<a name="SEC85"></a>
 
133
<table cellpadding="1" cellspacing="1" border="0">
 
134
<tr><td valign="middle" align="left">[<a href="maxima_25.html#SEC84" title="Previous section in reading order"> &lt; </a>]</td>
 
135
<td valign="middle" align="left">[<a href="#SEC86" title="Next section in reading order"> &gt; </a>]</td>
 
136
<td valign="middle" align="left"> &nbsp; </td>
 
137
<td valign="middle" align="left">[<a href="maxima_25.html#SEC83" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
138
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
 
139
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
140
<td valign="middle" align="left"> &nbsp; </td>
 
141
<td valign="middle" align="left"> &nbsp; </td>
 
142
<td valign="middle" align="left"> &nbsp; </td>
 
143
<td valign="middle" align="left"> &nbsp; </td>
 
144
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
145
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
146
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
147
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
148
</tr></table>
 
149
<h1 class="chapter"> 26. Matrices and Linear Algebra </h1>
 
150
 
 
151
<table class="menu" border="0" cellspacing="0">
 
152
<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">  
 
153
</td></tr>
 
154
<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">  
 
155
</td></tr>
 
156
</table>
 
157
 
 
158
<hr size="6">
 
159
<a name="Introduction-to-Matrices-and-Linear-Algebra"></a>
 
160
<a name="SEC86"></a>
 
161
<table cellpadding="1" cellspacing="1" border="0">
 
162
<tr><td valign="middle" align="left">[<a href="#SEC85" title="Previous section in reading order"> &lt; </a>]</td>
 
163
<td valign="middle" align="left">[<a href="#SEC87" title="Next section in reading order"> &gt; </a>]</td>
 
164
<td valign="middle" align="left"> &nbsp; </td>
 
165
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
166
<td valign="middle" align="left">[<a href="#SEC85" title="Up section"> Up </a>]</td>
 
167
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
168
<td valign="middle" align="left"> &nbsp; </td>
 
169
<td valign="middle" align="left"> &nbsp; </td>
 
170
<td valign="middle" align="left"> &nbsp; </td>
 
171
<td valign="middle" align="left"> &nbsp; </td>
 
172
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
173
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
174
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
175
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
176
</tr></table>
 
177
<h2 class="section"> 26.1 Introduction to Matrices and Linear Algebra </h2>
 
178
 
 
179
<table class="menu" border="0" cellspacing="0">
 
180
<tr><td align="left" valign="top"><a href="#SEC87">26.1.1 Dot</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                         
 
181
</td></tr>
 
182
<tr><td align="left" valign="top"><a href="#SEC88">26.1.2 Vectors</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">                     
 
183
</td></tr>
 
184
<tr><td align="left" valign="top"><a href="#SEC89">26.1.3 eigen</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
 
185
</td></tr>
 
186
</table>
 
187
 
 
188
<hr size="6">
 
189
<a name="Dot"></a>
 
190
<a name="SEC87"></a>
 
191
<table cellpadding="1" cellspacing="1" border="0">
 
192
<tr><td valign="middle" align="left">[<a href="#SEC86" title="Previous section in reading order"> &lt; </a>]</td>
 
193
<td valign="middle" align="left">[<a href="#SEC88" title="Next section in reading order"> &gt; </a>]</td>
 
194
<td valign="middle" align="left"> &nbsp; </td>
 
195
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
196
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
 
197
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
198
<td valign="middle" align="left"> &nbsp; </td>
 
199
<td valign="middle" align="left"> &nbsp; </td>
 
200
<td valign="middle" align="left"> &nbsp; </td>
 
201
<td valign="middle" align="left"> &nbsp; </td>
 
202
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
203
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
204
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
205
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
206
</tr></table>
 
207
<h3 class="subsection"> 26.1.1 Dot </h3>
 
208
<p>The operator <code>.</code> represents noncommutative multiplication and scalar product.
 
209
When the operands are 1-column or 1-row matrices <code>a</code> and <code>b</code>,
 
210
the expression <code>a.b</code> is equivalent to <code>sum (a[i]*b[i], i, 1, length(a))</code>.
 
211
If <code>a</code> and <code>b</code> are not complex, this is the scalar product,
 
212
also called the inner product or dot product, of <code>a</code> and <code>b</code>.
 
213
The scalar product is defined as <code>conjugate(a).b</code> when <code>a</code> and <code>b</code> are complex;
 
214
<code>innerproduct</code> in the <code>eigen</code> package provides the complex scalar product.
 
215
</p>
 
216
<p>When the operands are more general matrices,
 
217
the product is the matrix product <code>a</code> and <code>b</code>.
 
218
The number of rows of <code>b</code> must equal the number of columns of <code>a</code>,
 
219
and the result has number of rows equal to the number of rows of <code>a</code>
 
220
and number of columns equal to the number of columns of <code>b</code>.
 
221
</p>
 
222
<p>To distinguish <code>.</code> as an arithmetic operator from 
 
223
the decimal point in a floating point number,
 
224
it may be necessary to leave spaces on either side.
 
225
For example, <code>5.e3</code> is <code>5000.0</code> but <code>5 . e3</code> is <code>5</code> times <code>e3</code>.
 
226
</p>
 
227
<p>There are several flags which govern the simplification of
 
228
expressions involving <code>.</code>, namely
 
229
<code>dot</code>, <code>dot0nscsimp</code>, <code>dot0simp</code>, <code>dot1simp</code>, <code>dotassoc</code>, 
 
230
<code>dotconstrules</code>, <code>dotdistrib</code>, <code>dotexptsimp</code>, <code>dotident</code>,
 
231
and <code>dotscrules</code>.
 
232
</p>
 
233
<hr size="6">
 
234
<a name="Vectors"></a>
 
235
<a name="SEC88"></a>
 
236
<table cellpadding="1" cellspacing="1" border="0">
 
237
<tr><td valign="middle" align="left">[<a href="#SEC87" title="Previous section in reading order"> &lt; </a>]</td>
 
238
<td valign="middle" align="left">[<a href="#SEC89" title="Next section in reading order"> &gt; </a>]</td>
 
239
<td valign="middle" align="left"> &nbsp; </td>
 
240
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
241
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
 
242
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
243
<td valign="middle" align="left"> &nbsp; </td>
 
244
<td valign="middle" align="left"> &nbsp; </td>
 
245
<td valign="middle" align="left"> &nbsp; </td>
 
246
<td valign="middle" align="left"> &nbsp; </td>
 
247
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
248
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
249
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
250
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
251
</tr></table>
 
252
<h3 class="subsection"> 26.1.2 Vectors </h3>
 
253
<p><code>vect</code> is a package of functions for vector analysis.
 
254
<code>load (&quot;vect&quot;)</code> loads this package, and <code>demo (&quot;vect&quot;)</code> displays a demonstration.
 
255
</p>
 
256
<p>The vector analysis package can combine and simplify symbolic 
 
257
expressions including dot products and cross products, together with
 
258
the gradient, divergence, curl, and Laplacian operators.  The
 
259
distribution of these operators over sums or products is governed
 
260
by several flags, as are various other expansions, including expansion
 
261
into components in any specific orthogonal coordinate systems.
 
262
There are also functions for deriving the scalar or vector potential
 
263
of a field.
 
264
</p>
 
265
<p>The <code>vect</code> package contains these functions:
 
266
<code>vectorsimp</code>, <code>scalefactors</code>,
 
267
<code>express</code>, <code>potential</code>, and <code>vectorpotential</code>.
 
268
</p>
 
269
<p>Warning: the <code>vect</code> package declares the dot operator <code>.</code>
 
270
to be a commutative operator.
 
271
</p>
 
272
<hr size="6">
 
273
<a name="eigen"></a>
 
274
<a name="SEC89"></a>
 
275
<table cellpadding="1" cellspacing="1" border="0">
 
276
<tr><td valign="middle" align="left">[<a href="#SEC88" title="Previous section in reading order"> &lt; </a>]</td>
 
277
<td valign="middle" align="left">[<a href="#SEC90" title="Next section in reading order"> &gt; </a>]</td>
 
278
<td valign="middle" align="left"> &nbsp; </td>
 
279
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
280
<td valign="middle" align="left">[<a href="#SEC86" title="Up section"> Up </a>]</td>
 
281
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
282
<td valign="middle" align="left"> &nbsp; </td>
 
283
<td valign="middle" align="left"> &nbsp; </td>
 
284
<td valign="middle" align="left"> &nbsp; </td>
 
285
<td valign="middle" align="left"> &nbsp; </td>
 
286
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
287
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
288
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
289
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
290
</tr></table>
 
291
<h3 class="subsection"> 26.1.3 eigen </h3>
 
292
 
 
293
<p>The package <code>eigen</code> contains several functions devoted to the
 
294
symbolic computation of eigenvalues and eigenvectors.
 
295
Maxima loads the package automatically if one of the functions
 
296
<code>eigenvalues</code> or <code>eigenvectors</code> is invoked.
 
297
The package may be loaded explicitly as <code>load (&quot;eigen&quot;)</code>.
 
298
</p>
 
299
<p><code>demo (&quot;eigen&quot;)</code> displays a demonstration of the capabilities
 
300
of this package.
 
301
<code>batch (&quot;eigen&quot;)</code> executes the same demonstration,
 
302
but without the user prompt between successive computations.
 
303
</p>
 
304
<p>The functions in the <code>eigen</code> package are
 
305
<code>innerproduct</code>, <code>unitvector</code>, <code>columnvector</code>,
 
306
<code>gramschmidt</code>, <code>eigenvalues</code>, <code>eigenvectors</code>, <code>uniteigenvectors</code>,
 
307
and <code>similaritytransform</code>.
 
308
</p>
 
309
<hr size="6">
 
310
<a name="Definitions-for-Matrices-and-Linear-Algebra"></a>
 
311
<a name="SEC90"></a>
 
312
<table cellpadding="1" cellspacing="1" border="0">
 
313
<tr><td valign="middle" align="left">[<a href="#SEC89" title="Previous section in reading order"> &lt; </a>]</td>
 
314
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next section in reading order"> &gt; </a>]</td>
 
315
<td valign="middle" align="left"> &nbsp; </td>
 
316
<td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
317
<td valign="middle" align="left">[<a href="#SEC85" title="Up section"> Up </a>]</td>
 
318
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
319
<td valign="middle" align="left"> &nbsp; </td>
 
320
<td valign="middle" align="left"> &nbsp; </td>
 
321
<td valign="middle" align="left"> &nbsp; </td>
 
322
<td valign="middle" align="left"> &nbsp; </td>
 
323
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
324
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
325
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
326
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
327
</tr></table>
 
328
<h2 class="section"> 26.2 Definitions for Matrices and Linear Algebra </h2>
 
329
 
 
330
<dl>
 
331
<dt><u>Function:</u> <b>addcol</b><i> (<var>M</var>, <var>list_1</var>, ..., <var>list_n</var>)</i>
 
332
<a name="IDX751"></a>
 
333
</dt>
 
334
<dd><p>Appends the column(s) given by the one
 
335
or more lists (or matrices) onto the matrix <var>M</var>.
 
336
</p>
 
337
</dd></dl>
 
338
 
 
339
<dl>
 
340
<dt><u>Function:</u> <b>addrow</b><i> (<var>M</var>, <var>list_1</var>, ..., <var>list_n</var>)</i>
 
341
<a name="IDX752"></a>
 
342
</dt>
 
343
<dd><p>Appends the row(s) given by the one or
 
344
more lists (or matrices) onto the matrix <var>M</var>.
 
345
</p>
 
346
</dd></dl>
 
347
 
 
348
<dl>
 
349
<dt><u>Function:</u> <b>adjoint</b><i> (<var>M</var>)</i>
 
350
<a name="IDX753"></a>
 
351
</dt>
 
352
<dd><p>Returns the adjoint of the matrix <var>M</var>.
 
353
The adjoint matrix is the transpose of the matrix of cofactors of <var>M</var>.
 
354
</p>
 
355
</dd></dl>
 
356
 
 
357
<dl>
 
358
<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>
 
359
<a name="IDX754"></a>
 
360
</dt>
 
361
<dd><p>Returns the augmented coefficient
 
362
matrix for the variables <var>x_1</var>, ..., <var>x_n</var> of the system of linear equations
 
363
<var>eqn_1</var>, ..., <var>eqn_m</var>.  This is the coefficient matrix with a column adjoined for
 
364
the constant terms in each equation (i.e., those terms not dependent upon
 
365
<var>x_1</var>, ..., <var>x_n</var>).
 
366
</p>
 
367
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: [2*x - (a - 1)*y = 5*b, c + b*y + a*x = 0]$
 
368
(%i2) augcoefmatrix (m, [x, y]);
 
369
                       [ 2  1 - a  - 5 b ]
 
370
(%o2)                  [                 ]
 
371
                       [ a    b      c   ]
 
372
</pre></td></tr></table>
 
373
</dd></dl>
 
374
 
 
375
<dl>
 
376
<dt><u>Function:</u> <b>charpoly</b><i> (<var>M</var>, <var>x</var>)</i>
 
377
<a name="IDX755"></a>
 
378
</dt>
 
379
<dd><p>Returns the characteristic polynomial for the matrix <var>M</var>
 
380
with respect to variable <var>x</var>.  That is,
 
381
<code>determinant (<var>M</var> - diagmatrix (length (<var>M</var>), <var>x</var>))</code>.
 
382
</p>
 
383
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) a: matrix ([3, 1], [2, 4]);
 
384
                            [ 3  1 ]
 
385
(%o1)                       [      ]
 
386
                            [ 2  4 ]
 
387
(%i2) expand (charpoly (a, lambda));
 
388
                           2
 
389
(%o2)                lambda  - 7 lambda + 10
 
390
(%i3) (programmode: true, solve (%));
 
391
(%o3)               [lambda = 5, lambda = 2]
 
392
(%i4) matrix ([x1], [x2]);
 
393
                             [ x1 ]
 
394
(%o4)                        [    ]
 
395
                             [ x2 ]
 
396
(%i5) ev (a . % - lambda*%, %th(2)[1]);
 
397
                          [ x2 - 2 x1 ]
 
398
(%o5)                     [           ]
 
399
                          [ 2 x1 - x2 ]
 
400
(%i6) %[1, 1] = 0;
 
401
(%o6)                     x2 - 2 x1 = 0
 
402
(%i7) x2^2 + x1^2 = 1;
 
403
                            2     2
 
404
(%o7)                     x2  + x1  = 1
 
405
(%i8) solve ([%th(2), %], [x1, x2]);
 
406
                  1               2
 
407
(%o8) [[x1 = - -------, x2 = - -------], 
 
408
               sqrt(5)         sqrt(5)
 
409
 
 
410
                                             1             2
 
411
                                    [x1 = -------, x2 = -------]]
 
412
                                          sqrt(5)       sqrt(5)
 
413
</pre></td></tr></table>
 
414
</dd></dl>
 
415
 
 
416
<dl>
 
417
<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>
 
418
<a name="IDX756"></a>
 
419
</dt>
 
420
<dd><p>Returns the coefficient matrix for the
 
421
variables <var>x_1</var>, ..., <var>x_n</var> of the system of linear equations 
 
422
<var>eqn_1</var>, ..., <var>eqn_m</var>.
 
423
</p>
 
424
<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]);
 
425
                                 [ 2  1 - a ]
 
426
(%o1)                            [          ]
 
427
                                 [ a    b   ]
 
428
</pre></td></tr></table>
 
429
</dd></dl>
 
430
 
 
431
<dl>
 
432
<dt><u>Function:</u> <b>col</b><i> (<var>M</var>, <var>i</var>)</i>
 
433
<a name="IDX757"></a>
 
434
</dt>
 
435
<dd><p>Returns the <var>i</var>'th column of the matrix <var>M</var>.
 
436
The return value is a matrix.
 
437
</p>
 
438
</dd></dl>
 
439
 
 
440
<dl>
 
441
<dt><u>Function:</u> <b>columnvector</b><i> (<var>L</var>)</i>
 
442
<a name="IDX758"></a>
 
443
</dt>
 
444
<dt><u>Function:</u> <b>covect</b><i> (<var>L</var>)</i>
 
445
<a name="IDX759"></a>
 
446
</dt>
 
447
<dd><p>Returns a matrix of one column and <code>length (<var>L</var>)</code> rows,
 
448
containing the elements of the list <var>L</var>.
 
449
</p>
 
450
<p><code>covect</code> is a synonym for <code>columnvector</code>.
 
451
</p>
 
452
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
453
</p>
 
454
<p>This is useful if you want to use parts of the outputs of
 
455
the functions in this package in matrix calculations.
 
456
</p>
 
457
<p>Example:
 
458
</p>
 
459
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;eigen&quot;)$
 
460
Warning - you are redefining the Macsyma function eigenvalues
 
461
Warning - you are redefining the Macsyma function eigenvectors
 
462
(%i2) columnvector ([aa, bb, cc, dd]);
 
463
                             [ aa ]
 
464
                             [    ]
 
465
                             [ bb ]
 
466
(%o2)                        [    ]
 
467
                             [ cc ]
 
468
                             [    ]
 
469
                             [ dd ]
 
470
</pre></td></tr></table>
 
471
</dd></dl>
 
472
 
 
473
<dl>
 
474
<dt><u>Function:</u> <b>conjugate</b><i> (<var>x</var>)</i>
 
475
<a name="IDX760"></a>
 
476
</dt>
 
477
<dd><p>Returns the complex conjugate of <var>x</var>.
 
478
</p>
 
479
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) declare ([aa, bb], real, cc, complex, ii, imaginary);
 
480
 
 
481
(%o1)                         done
 
482
(%i2) conjugate (aa + bb*%i);
 
483
 
 
484
(%o2)                      aa - %i bb
 
485
(%i3) conjugate (cc);
 
486
 
 
487
(%o3)                     conjugate(cc)
 
488
(%i4) conjugate (ii);
 
489
 
 
490
(%o4)                         - ii
 
491
(%i5) conjugate (xx + yy);
 
492
 
 
493
(%o5)             conjugate(yy) + conjugate(xx)
 
494
</pre></td></tr></table>
 
495
</dd></dl>
 
496
 
 
497
<dl>
 
498
<dt><u>Function:</u> <b>copymatrix</b><i> (<var>M</var>)</i>
 
499
<a name="IDX761"></a>
 
500
</dt>
 
501
<dd><p>Returns a copy of the matrix <var>M</var>.  This is the only way
 
502
to make a copy aside from copying <var>M</var> element by element.
 
503
</p>
 
504
<p>Note that an assignment of one matrix to another, as in <code>m2: m1</code>,
 
505
does not copy <code>m1</code>.
 
506
An assignment <code>m2 [i,j]: x</code> or <code>setelmx (x, i, j, m2</code> also modifies <code>m1 [i,j]</code>.
 
507
Creating a copy with <code>copymatrix</code> and then using assignment creates a separate, modified copy.
 
508
</p>
 
509
</dd></dl>
 
510
 
 
511
<dl>
 
512
<dt><u>Function:</u> <b>determinant</b><i> (<var>M</var>)</i>
 
513
<a name="IDX762"></a>
 
514
</dt>
 
515
<dd><p>Computes the determinant of <var>M</var> by a method similar to
 
516
Gaussian elimination.
 
517
</p>
 
518
<p>The form of the result depends upon the setting
 
519
of the switch <code>ratmx</code>.
 
520
</p>
 
521
<p>There is a special routine for computing
 
522
sparse determinants which is called when the switches
 
523
<code>ratmx</code> and <code>sparse</code> are both <code>true</code>.
 
524
</p>
 
525
</dd></dl>
 
526
 
 
527
<dl>
 
528
<dt><u>Option variable:</u> <b>detout</b>
 
529
<a name="IDX763"></a>
 
530
</dt>
 
531
<dd><p>Default value: <code>false</code>
 
532
</p>
 
533
<p>When <code>detout</code> is <code>true</code>, the determinant of a
 
534
matrix whose inverse is computed is factored out of the inverse.
 
535
</p>
 
536
<p>For this switch to have an effect <code>doallmxops</code> and <code>doscmxops</code> should be
 
537
<code>false</code> (see their descriptions).  Alternatively this switch can be
 
538
given to <code>ev</code> which causes the other two to be set correctly.
 
539
</p>
 
540
<p>Example:
 
541
</p>
 
542
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: matrix ([a, b], [c, d]);
 
543
                            [ a  b ]
 
544
(%o1)                       [      ]
 
545
                            [ c  d ]
 
546
(%i2) detout: true$
 
547
(%i3) doallmxops: false$
 
548
(%i4) doscmxops: false$
 
549
(%i5) invert (m);
 
550
                          [  d   - b ]
 
551
                          [          ]
 
552
                          [ - c   a  ]
 
553
(%o5)                     ------------
 
554
                           a d - b c
 
555
</pre></td></tr></table>
 
556
</dd></dl>
 
557
 
 
558
<dl>
 
559
<dt><u>Function:</u> <b>diagmatrix</b><i> (<var>n</var>, <var>x</var>)</i>
 
560
<a name="IDX764"></a>
 
561
</dt>
 
562
<dd><p>Returns a diagonal matrix of size <var>n</var> by <var>n</var> with the
 
563
diagonal elements all equal to <var>x</var>.
 
564
<code>diagmatrix (<var>n</var>, 1)</code> returns an identity matrix (same as <code>ident (<var>n</var>)</code>).
 
565
</p>
 
566
<p><var>n</var> must evaluate to an integer, otherwise <code>diagmatrix</code> complains with an error message.
 
567
</p>
 
568
<p><var>x</var> can be any kind of expression, including another matrix.
 
569
If <var>x</var> is a matrix, it is not copied; all diagonal elements refer to the same instance, <var>x</var>.
 
570
</p>
 
571
</dd></dl>
 
572
 
 
573
<dl>
 
574
<dt><u>Option variable:</u> <b>doallmxops</b>
 
575
<a name="IDX765"></a>
 
576
</dt>
 
577
<dd><p>Default value: <code>true</code>
 
578
</p>
 
579
<p>When <code>doallmxops</code> is <code>true</code>,
 
580
all operations relating to matrices are carried out.
 
581
When it is <code>false</code> then the setting of the
 
582
individual <code>dot</code> switches govern which operations are performed.
 
583
</p>
 
584
</dd></dl>
 
585
 
 
586
<dl>
 
587
<dt><u>Option variable:</u> <b>domxexpt</b>
 
588
<a name="IDX766"></a>
 
589
</dt>
 
590
<dd><p>Default value: <code>true</code>
 
591
</p>
 
592
<p>When <code>domxexpt</code> is <code>true</code>,
 
593
a matrix exponential, <code>exp (<var>M</var>)</code> where <var>M</var> is a matrix,
 
594
is interpreted as a matrix with element <code>[i,j</code> equal to <code>exp (m[i,j])</code>.
 
595
Otherwise <code>exp (<var>M</var>)</code> evaluates to <code>exp (<var>ev(M)</var></code>.
 
596
</p>
 
597
<p><code>domxexpt</code>
 
598
affects all expressions of the form <code><var>base</var>^<var>power</var></code> where <var>base</var> is an
 
599
expression assumed scalar or constant, and <var>power</var> is a list or
 
600
matrix.
 
601
</p>
 
602
<p>Example:
 
603
</p>
 
604
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) m: matrix ([1, %i], [a+b, %pi]);
 
605
                         [   1    %i  ]
 
606
(%o1)                    [            ]
 
607
                         [ b + a  %pi ]
 
608
(%i2) domxexpt: false$
 
609
(%i3) (1 - c)^m;
 
610
                             [   1    %i  ]
 
611
                             [            ]
 
612
                             [ b + a  %pi ]
 
613
(%o3)                 (1 - c)
 
614
(%i4) domxexpt: true$
 
615
(%i5) (1 - c)^m;
 
616
                  [                      %i  ]
 
617
                  [    1 - c      (1 - c)    ]
 
618
(%o5)             [                          ]
 
619
                  [        b + a         %pi ]
 
620
                  [ (1 - c)       (1 - c)    ]
 
621
</pre></td></tr></table>
 
622
</dd></dl>
 
623
 
 
624
<dl>
 
625
<dt><u>Option variable:</u> <b>domxmxops</b>
 
626
<a name="IDX767"></a>
 
627
</dt>
 
628
<dd><p>Default value: <code>true</code>
 
629
</p>
 
630
<p>When <code>domxmxops</code> is <code>true</code>, all matrix-matrix or
 
631
matrix-list operations are carried out (but not scalar-matrix
 
632
operations); if this switch is <code>false</code> such operations are not carried out.
 
633
</p>
 
634
</dd></dl>
 
635
 
 
636
<dl>
 
637
<dt><u>Option variable:</u> <b>domxnctimes</b>
 
638
<a name="IDX768"></a>
 
639
</dt>
 
640
<dd><p>Default value: <code>false</code>
 
641
</p>
 
642
<p>When <code>domxnctimes</code> is <code>true</code>, non-commutative products of
 
643
matrices are carried out.
 
644
</p>
 
645
</dd></dl>
 
646
 
 
647
<dl>
 
648
<dt><u>Option variable:</u> <b>dontfactor</b>
 
649
<a name="IDX769"></a>
 
650
</dt>
 
651
<dd><p>Default value: <code>[]</code>
 
652
</p>
 
653
<p><code>dontfactor</code> may be set to a list of variables with respect
 
654
to which factoring is not to occur.  (The list is initially empty.)
 
655
Factoring also will not take place with respect to any variables which
 
656
are less important, according the variable ordering assumed for canonical rational expression (CRE) form,
 
657
than those on the <code>dontfactor</code> list.
 
658
</p>
 
659
</dd></dl>
 
660
 
 
661
<dl>
 
662
<dt><u>Option variable:</u> <b>doscmxops</b>
 
663
<a name="IDX770"></a>
 
664
</dt>
 
665
<dd><p>Default value: <code>false</code>
 
666
</p>
 
667
<p>When <code>doscmxops</code> is <code>true</code>, scalar-matrix operations are
 
668
carried out.
 
669
</p>
 
670
</dd></dl>
 
671
 
 
672
<dl>
 
673
<dt><u>Option variable:</u> <b>doscmxplus</b>
 
674
<a name="IDX771"></a>
 
675
</dt>
 
676
<dd><p>Default value: <code>false</code>
 
677
</p>
 
678
<p>When <code>doscmxplus</code> is <code>true</code>, scalar-matrix operations yield
 
679
a matrix result.  This switch is not subsumed under <code>doallmxops</code>.
 
680
</p>
 
681
</dd></dl>
 
682
 
 
683
<dl>
 
684
<dt><u>Option variable:</u> <b>dot0nscsimp</b>
 
685
<a name="IDX772"></a>
 
686
</dt>
 
687
<dd><p>Default value: <code>true</code>
 
688
</p>
 
689
<p>When <code>dot0nscsimp</code> is <code>true</code>, a non-commutative product of zero
 
690
and a nonscalar term is simplified to a commutative product.
 
691
</p>
 
692
</dd></dl>
 
693
 
 
694
<dl>
 
695
<dt><u>Option variable:</u> <b>dot0simp</b>
 
696
<a name="IDX773"></a>
 
697
</dt>
 
698
<dd><p>Default value: <code>true</code>
 
699
</p>
 
700
<p>When <code>dot0simp</code> is <code>true</code>,
 
701
a non-commutative product of zero and
 
702
a scalar term is simplified to a commutative product.
 
703
</p>
 
704
</dd></dl>
 
705
 
 
706
<dl>
 
707
<dt><u>Option variable:</u> <b>dot1simp</b>
 
708
<a name="IDX774"></a>
 
709
</dt>
 
710
<dd><p>Default value: <code>true</code>
 
711
</p>
 
712
<p>When <code>dot1simp</code> is <code>true</code>,
 
713
a non-commutative product of one and
 
714
another term is simplified to a commutative product.
 
715
</p>
 
716
</dd></dl>
 
717
 
 
718
<dl>
 
719
<dt><u>Option variable:</u> <b>dotassoc</b>
 
720
<a name="IDX775"></a>
 
721
</dt>
 
722
<dd><p>Default value: <code>true</code>
 
723
</p>
 
724
<p>When <code>dotassoc</code> is <code>true</code>, an expression <code>(A.B).C</code> simplifies to
 
725
<code>A.(B.C)</code>.
 
726
</p>
 
727
</dd></dl>
 
728
 
 
729
<dl>
 
730
<dt><u>Option variable:</u> <b>dotconstrules</b>
 
731
<a name="IDX776"></a>
 
732
</dt>
 
733
<dd><p>Default value: <code>true</code>
 
734
</p>
 
735
<p>When <code>dotconstrules</code> is <code>true</code>, a non-commutative product of a
 
736
constant and another term is simplified to a commutative product.
 
737
Turning on this flag effectively turns on <code>dot0simp</code>, <code>dot0nscsimp</code>, and
 
738
<code>dot1simp</code> as well.
 
739
</p>
 
740
</dd></dl>
 
741
 
 
742
<dl>
 
743
<dt><u>Option variable:</u> <b>dotdistrib</b>
 
744
<a name="IDX777"></a>
 
745
</dt>
 
746
<dd><p>Default value: <code>false</code>
 
747
</p>
 
748
<p>When <code>dotdistrib</code> is <code>true</code>, an expression <code>A.(B + C)</code> simplifies to <code>A.B + A.C</code>.
 
749
</p>
 
750
</dd></dl>
 
751
 
 
752
<dl>
 
753
<dt><u>Option variable:</u> <b>dotexptsimp</b>
 
754
<a name="IDX778"></a>
 
755
</dt>
 
756
<dd><p>Default value: <code>true</code>
 
757
</p>
 
758
<p>When <code>dotexptsimp</code> is <code>true</code>, an expression <code>A.A</code> simplifies to <code>A^^2</code>.
 
759
</p>
 
760
</dd></dl>
 
761
 
 
762
<dl>
 
763
<dt><u>Option variable:</u> <b>dotident</b>
 
764
<a name="IDX779"></a>
 
765
</dt>
 
766
<dd><p>Default value: 1
 
767
</p>
 
768
<p><code>dotident</code> is the value returned by <code>X^^0</code>.
 
769
</p>
 
770
</dd></dl>
 
771
 
 
772
<dl>
 
773
<dt><u>Option variable:</u> <b>dotscrules</b>
 
774
<a name="IDX780"></a>
 
775
</dt>
 
776
<dd><p>Default value: <code>false</code>
 
777
</p>
 
778
<p>When <code>dotscrules</code> is <code>true</code>, an expression <code>A.SC</code> or <code>SC.A</code> simplifies
 
779
to <code>SC*A</code> and <code>A.(SC*B)</code> simplifies to <code>SC*(A.B)</code>.
 
780
</p>
 
781
</dd></dl>
 
782
 
 
783
<dl>
 
784
<dt><u>Function:</u> <b>echelon</b><i> (<var>M</var>)</i>
 
785
<a name="IDX781"></a>
 
786
</dt>
 
787
<dd><p>Returns the echelon form of the matrix <var>M</var>,
 
788
as produced by Gaussian elimination.
 
789
The echelon form is computed from <var>M</var>
 
790
by elementary row operations such that the first
 
791
non-zero element in each row in the resulting matrix is one and the
 
792
column elements under the first one in each row are all zero.
 
793
</p>
 
794
<p><code>triangularize</code> also carries out Gaussian elimination,
 
795
but it does not normalize the leading non-zero element in each row.
 
796
</p>
 
797
<p><code>lu_factor</code> and <code>cholesky</code> are other functions which yield triangularized matrices.
 
798
</p>
 
799
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) M: matrix ([3, 7, aa, bb], [-1, 8, 5, 2], [9, 2, 11, 4]);
 
800
                       [  3   7  aa  bb ]
 
801
                       [                ]
 
802
(%o1)                  [ - 1  8  5   2  ]
 
803
                       [                ]
 
804
                       [  9   2  11  4  ]
 
805
(%i2) echelon (M);
 
806
                  [ 1  - 8  - 5      - 2     ]
 
807
                  [                          ]
 
808
                  [         28       11      ]
 
809
                  [ 0   1   --       --      ]
 
810
(%o2)             [         37       37      ]
 
811
                  [                          ]
 
812
                  [              37 bb - 119 ]
 
813
                  [ 0   0    1   ----------- ]
 
814
                  [              37 aa - 313 ]
 
815
</pre></td></tr></table>
 
816
</dd></dl>
 
817
 
 
818
<dl>
 
819
<dt><u>Function:</u> <b>eigenvalues</b><i> (<var>M</var>)</i>
 
820
<a name="IDX782"></a>
 
821
</dt>
 
822
<dt><u>Function:</u> <b>eivals</b><i> (<var>M</var>)</i>
 
823
<a name="IDX783"></a>
 
824
</dt>
 
825
<dd><p>Returns a list of two lists containing the eigenvalues of the matrix <var>M</var>.
 
826
The first sublist of the return value is the list of eigenvalues of the
 
827
matrix, and the second sublist is the list of the
 
828
multiplicities of the eigenvalues in the corresponding order.
 
829
</p>
 
830
<p><code>eivals</code> is a synonym for <code>eigenvalues</code>.
 
831
</p>
 
832
<p><code>eigenvalues</code> calls the function <code>solve</code> to find the roots of the
 
833
characteristic polynomial of the matrix.
 
834
Sometimes <code>solve</code> may not be able to find the roots of the polynomial;
 
835
in that case some other functions in this
 
836
package (except <code>innerproduct</code>, <code>unitvector</code>, <code>columnvector</code> and
 
837
<code>gramschmidt</code>) will not work.
 
838
</p>
 
839
<p>In some cases the eigenvalues found by <code>solve</code> may be complicated expressions.
 
840
(This may happen when <code>solve</code> returns a not-so-obviously real expression
 
841
for an eigenvalue which is known to be real.)
 
842
It may be possible to simplify the eigenvalues using some other functions.
 
843
</p>
 
844
<p>The package <code>eigen.mac</code> is loaded automatically when
 
845
<code>eigenvalues</code> or <code>eigenvectors</code> is referenced.
 
846
If <code>eigen.mac</code> is not already loaded,
 
847
<code>load (&quot;eigen&quot;)</code> loads it.
 
848
After loading, all functions and variables in the package are available.
 
849
</p>
 
850
</dd></dl>
 
851
 
 
852
<dl>
 
853
<dt><u>Function:</u> <b>eigenvectors</b><i> (<var>M</var>)</i>
 
854
<a name="IDX784"></a>
 
855
</dt>
 
856
<dt><u>Function:</u> <b>eivects</b><i> (<var>M</var>)</i>
 
857
<a name="IDX785"></a>
 
858
</dt>
 
859
<dd><p>takes a matrix <var>M</var> as its argument and returns a list
 
860
of lists the first sublist of which is the output of <code>eigenvalues</code>
 
861
and the other sublists of which are the eigenvectors of the
 
862
matrix corresponding to those eigenvalues respectively.
 
863
The calculated eigenvectors and the unit eigenvectors of the matrix are the
 
864
right eigenvectors and the right unit eigenvectors respectively.
 
865
</p>
 
866
<p><code>eivects</code> is a synonym for <code>eigenvectors</code>.
 
867
</p>
 
868
<p>The package <code>eigen.mac</code> is loaded automatically when
 
869
<code>eigenvalues</code> or <code>eigenvectors</code> is referenced.
 
870
If <code>eigen.mac</code> is not already loaded,
 
871
<code>load (&quot;eigen&quot;)</code> loads it.
 
872
After loading, all functions and variables in the package are available.
 
873
</p>
 
874
<p>The flags that affect this function are:
 
875
</p>
 
876
<p><code>nondiagonalizable</code> is set to <code>true</code> or <code>false</code> depending on
 
877
whether the matrix is nondiagonalizable or diagonalizable after
 
878
<code>eigenvectors</code> returns.
 
879
</p>
 
880
<p><code>hermitianmatrix</code> when <code>true</code>, causes the degenerate
 
881
eigenvectors of the Hermitian matrix to be orthogonalized using the
 
882
Gram-Schmidt algorithm.
 
883
</p>
 
884
<p><code>knowneigvals</code> when <code>true</code> causes the <code>eigen</code> package to assume the
 
885
eigenvalues of the matrix are known to the user and stored under the
 
886
global name <code>listeigvals</code>.  <code>listeigvals</code> should be set to a list similar
 
887
to the output <code>eigenvalues</code>.
 
888
</p>
 
889
<p>The function <code>algsys</code> is used here to solve for the eigenvectors. Sometimes if the
 
890
eigenvalues are messy, <code>algsys</code> may not be able to find a solution.
 
891
In some cases, it may be possible to simplify the eigenvalues by
 
892
first finding them using <code>eigenvalues</code> command and then using other functions
 
893
to reduce them to something simpler.
 
894
Following simplification, <code>eigenvectors</code> can be called again
 
895
with the <code>knowneigvals</code> flag set to <code>true</code>.
 
896
</p>
 
897
</dd></dl>
 
898
 
 
899
<dl>
 
900
<dt><u>Function:</u> <b>ematrix</b><i> (<var>m</var>, <var>n</var>, <var>x</var>, <var>i</var>, <var>j</var>)</i>
 
901
<a name="IDX786"></a>
 
902
</dt>
 
903
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, all elements of which
 
904
are zero except for the <code>[<var>i</var>, <var>j</var>]</code> element which is <var>x</var>.
 
905
</p>
 
906
</dd></dl>
 
907
 
 
908
<dl>
 
909
<dt><u>Function:</u> <b>entermatrix</b><i> (<var>m</var>, <var>n</var>)</i>
 
910
<a name="IDX787"></a>
 
911
</dt>
 
912
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, reading the elements interactively.
 
913
</p>
 
914
<p>If <var>n</var> is equal to <var>m</var>,
 
915
Maxima prompts for the type of the matrix (diagonal, symmetric, antisymmetric, or general)
 
916
and for each element.
 
917
Each response is terminated by a semicolon <code>;</code> or dollar sign <code>$</code>.
 
918
</p>
 
919
<p>If <var>n</var> is not equal to <var>m</var>,
 
920
Maxima prompts for each element.
 
921
</p>
 
922
<p>The elements may be any expressions, which are evaluated.
 
923
<code>entermatrix</code> evaluates its arguments.
 
924
</p>
 
925
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) n: 3$
 
926
(%i2) m: entermatrix (n, n)$
 
927
 
 
928
Is the matrix  1. Diagonal  2. Symmetric  3. Antisymmetric  4. General
 
929
Answer 1, 2, 3 or 4 : 
 
930
1$
 
931
Row 1 Column 1: 
 
932
(a+b)^n$
 
933
Row 2 Column 2: 
 
934
(a+b)^(n+1)$
 
935
Row 3 Column 3: 
 
936
(a+b)^(n+2)$
 
937
 
 
938
Matrix entered.
 
939
(%i3) m;
 
940
                [        3                     ]
 
941
                [ (b + a)      0         0     ]
 
942
                [                              ]
 
943
(%o3)           [                  4           ]
 
944
                [    0      (b + a)      0     ]
 
945
                [                              ]
 
946
                [                            5 ]
 
947
                [    0         0      (b + a)  ]
 
948
</pre></td></tr></table>
 
949
</dd></dl>
 
950
 
 
951
<dl>
 
952
<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>
 
953
<a name="IDX788"></a>
 
954
</dt>
 
955
<dt><u>Function:</u> <b>genmatrix</b><i> (<var>a</var>, <var>i_2</var>, <var>j_2</var>, <var>i_1</var>)</i>
 
956
<a name="IDX789"></a>
 
957
</dt>
 
958
<dt><u>Function:</u> <b>genmatrix</b><i> (<var>a</var>, <var>i_2</var>, <var>j_2</var>)</i>
 
959
<a name="IDX790"></a>
 
960
</dt>
 
961
<dd><p>Returns a matrix generated from <var>a</var>,
 
962
taking element <code><var>a</var>[<var>i_1</var>,<var>j_1</var>]</code>
 
963
as the upper-left element and <code><var>a</var>[<var>i_2</var>,<var>j_2</var>]</code>
 
964
as the lower-right element of the matrix.
 
965
Here <var>a</var> is a declared array (created by <code>array</code> but not by <code>make_array</code>)
 
966
or an undeclared array,
 
967
or an array function,
 
968
or a lambda expression of two arguments.
 
969
(An array function is created like other functions with <code>:=</code> or <code>define</code>,
 
970
but arguments are enclosed in square brackets instead of parentheses.)
 
971
</p>
 
972
<p>If <var>j_1</var> is omitted, it is assumed equal to <var>i_1</var>.
 
973
If both <var>j_1</var> and <var>i_1</var> are omitted, both are assumed equal to 1.
 
974
</p>
 
975
<p>If a selected element <code>i,j</code> of the array is undefined,
 
976
the matrix will contain a symbolic element <code><var>a</var>[i,j]</code>.
 
977
</p>
 
978
<p>Examples:
 
979
</p>
 
980
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) h [i, j] := 1 / (i + j - 1);
 
981
                                    1
 
982
(%o1)                  h     := ---------
 
983
                        i, j    i + j - 1
 
984
(%i2) genmatrix (h, 3, 3);
 
985
                           [    1  1 ]
 
986
                           [ 1  -  - ]
 
987
                           [    2  3 ]
 
988
                           [         ]
 
989
                           [ 1  1  1 ]
 
990
(%o2)                      [ -  -  - ]
 
991
                           [ 2  3  4 ]
 
992
                           [         ]
 
993
                           [ 1  1  1 ]
 
994
                           [ -  -  - ]
 
995
                           [ 3  4  5 ]
 
996
(%i3) array (a, fixnum, 2, 2);
 
997
(%o3)                           a
 
998
(%i4) a [1, 1] : %e;
 
999
(%o4)                          %e
 
1000
(%i5) a [2, 2] : %pi;
 
1001
(%o5)                          %pi
 
1002
(%i6) genmatrix (a, 2, 2);
 
1003
                           [ %e   0  ]
 
1004
(%o6)                      [         ]
 
1005
                           [ 0   %pi ]
 
1006
(%i7) genmatrix (lambda ([i, j], j - i), 3, 3);
 
1007
                         [  0    1   2 ]
 
1008
                         [             ]
 
1009
(%o7)                    [ - 1   0   1 ]
 
1010
                         [             ]
 
1011
                         [ - 2  - 1  0 ]
 
1012
(%i8) genmatrix (B, 2, 2);
 
1013
                        [ B      B     ]
 
1014
                        [  1, 1   1, 2 ]
 
1015
(%o8)                   [              ]
 
1016
                        [ B      B     ]
 
1017
                        [  2, 1   2, 2 ]
 
1018
</pre></td></tr></table>
 
1019
</dd></dl>
 
1020
 
 
1021
<dl>
 
1022
<dt><u>Function:</u> <b>gramschmidt</b><i> (<var>x</var>)</i>
 
1023
<a name="IDX791"></a>
 
1024
</dt>
 
1025
<dt><u>Function:</u> <b>gschmit</b><i> (<var>x</var>)</i>
 
1026
<a name="IDX792"></a>
 
1027
</dt>
 
1028
<dd><p>Carries out the Gram-Schmidt orthogonalization algorithm on <var>x</var>,
 
1029
which is either a matrix or a list of lists.
 
1030
<var>x</var> is not modified by <code>gramschmidt</code>.
 
1031
</p>
 
1032
<p>If <var>x</var> is a matrix, the algorithm is applied to the rows of <var>x</var>.
 
1033
If <var>x</var> is a list of lists, the algorithm is applied to the sublists,
 
1034
which must have equal numbers of elements.
 
1035
In either case,
 
1036
the return value is a list of lists, the sublists of which are orthogonal
 
1037
and span the same space as <var>x</var>.
 
1038
If the dimension of the span of <var>x</var> is less than the number of rows or sublists,
 
1039
some sublists of the return value are zero.
 
1040
</p>
 
1041
<p><code>factor</code> is called at each stage of the algorithm to simplify intermediate results.
 
1042
As a consequence, the return value may contain factored integers.
 
1043
</p>
 
1044
<p><code>gschmit</code> (note spelling) is a synonym for <code>gramschmidt</code>.
 
1045
</p>
 
1046
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
1047
</p>
 
1048
<p>Example:
 
1049
</p>
 
1050
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) load (&quot;eigen&quot;)$
 
1051
Warning - you are redefining the Macsyma function eigenvalues
 
1052
Warning - you are redefining the Macsyma function eigenvectors
 
1053
(%i2) x: matrix ([1, 2, 3], [9, 18, 30], [12, 48, 60]);
 
1054
                         [ 1   2   3  ]
 
1055
                         [            ]
 
1056
(%o2)                    [ 9   18  30 ]
 
1057
                         [            ]
 
1058
                         [ 12  48  60 ]
 
1059
(%i3) y: gramschmidt (x);
 
1060
                       2      2            4     3
 
1061
                      3      3   3 5      2  3  2  3
 
1062
(%o3)  [[1, 2, 3], [- ---, - --, ---], [- ----, ----, 0]]
 
1063
                      2 7    7   2 7       5     5
 
1064
(%i4) i: innerproduct$
 
1065
(%i5) [i (y[1], y[2]), i (y[2], y[3]), i (y[3], y[1])];
 
1066
(%o5)                       [0, 0, 0]
 
1067
</pre></td></tr></table>
 
1068
</dd></dl>
 
1069
 
 
1070
<dl>
 
1071
<dt><u>Function:</u> <b>hach</b><i> (<var>a</var>, <var>b</var>, <var>m</var>, <var>n</var>, <var>l</var>)</i>
 
1072
<a name="IDX793"></a>
 
1073
</dt>
 
1074
<dd><p><code>hach</code> is an implementation of Hacijan's linear programming algorithm.
 
1075
</p>
 
1076
<p><code>load (&quot;kach&quot;)</code> loads this function.
 
1077
<code>demo (&quot;kach&quot;)</code> executes a demonstration of this function.
 
1078
</p>
 
1079
</dd></dl>
 
1080
 
 
1081
<dl>
 
1082
<dt><u>Function:</u> <b>ident</b><i> (<var>n</var>)</i>
 
1083
<a name="IDX794"></a>
 
1084
</dt>
 
1085
<dd><p>Returns an <var>n</var> by <var>n</var> identity matrix.
 
1086
</p>
 
1087
</dd></dl>
 
1088
 
 
1089
<dl>
 
1090
<dt><u>Function:</u> <b>innerproduct</b><i> (<var>x</var>, <var>y</var>)</i>
 
1091
<a name="IDX795"></a>
 
1092
</dt>
 
1093
<dt><u>Function:</u> <b>inprod</b><i> (<var>x</var>, <var>y</var>)</i>
 
1094
<a name="IDX796"></a>
 
1095
</dt>
 
1096
<dd><p>Returns the inner product (also called the scalar product or dot product) of <var>x</var> and <var>y</var>,
 
1097
which are lists of equal length, or both 1-column or 1-row matrices of equal length.
 
1098
The return value is <code>conjugate (x) . y</code>,
 
1099
where <code>.</code> is the noncommutative multiplication operator.
 
1100
</p>
 
1101
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
1102
</p>
 
1103
<p><code>inprod</code> is a synonym for <code>innerproduct</code>.
 
1104
</p>
 
1105
</dd></dl>
 
1106
 
 
1107
<dl>
 
1108
<dt><u>Function:</u> <b>invert</b><i> (<var>M</var>)</i>
 
1109
<a name="IDX797"></a>
 
1110
</dt>
 
1111
<dd><p>Returns the inverse of the matrix <var>M</var>.
 
1112
The inverse is computed by the adjoint method.
 
1113
</p>
 
1114
<p>This allows a user to compute the inverse of a matrix with
 
1115
bfloat entries or polynomials with floating pt. coefficients without
 
1116
converting to cre-form.
 
1117
</p>
 
1118
<p>Cofactors are computed by the <code>determinant</code> function,
 
1119
so if <code>ratmx</code> is <code>false</code> the inverse is computed
 
1120
without changing the representation of the elements.
 
1121
</p>
 
1122
<p>The current
 
1123
implementation is inefficient for matrices of high order.
 
1124
</p>
 
1125
<p>When <code>detout</code> is <code>true</code>, the determinant is factored out of the
 
1126
inverse.
 
1127
</p>
 
1128
<p>The elements of the inverse are not automatically expanded.
 
1129
If <var>M</var> has polynomial elements, better appearing output can be
 
1130
generated by <code>expand (invert (m)), detout</code>.
 
1131
If it is desirable to then
 
1132
divide through by the determinant this can be accomplished by <code>xthru (%)</code>
 
1133
or alternatively from scratch by
 
1134
</p>
 
1135
<table><tr><td>&nbsp;</td><td><pre class="example">expand (adjoint (m)) / expand (determinant (m))
 
1136
invert (m) := adjoint (m) / determinant (m)
 
1137
</pre></td></tr></table>
 
1138
<p>See <code>^^</code> (noncommutative exponent) for another method of inverting a matrix.
 
1139
</p>
 
1140
</dd></dl>
 
1141
 
 
1142
<dl>
 
1143
<dt><u>Option variable:</u> <b>lmxchar</b>
 
1144
<a name="IDX798"></a>
 
1145
</dt>
 
1146
<dd><p>Default value: <code>[</code>
 
1147
</p>
 
1148
<p><code>lmxchar</code> is the character displayed as the left
 
1149
delimiter of a matrix.
 
1150
See also <code>rmxchar</code>.
 
1151
</p>
 
1152
<p>Example:
 
1153
</p>
 
1154
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) lmxchar: &quot;|&quot;$
 
1155
(%i2) matrix ([a, b, c], [d, e, f], [g, h, i]);
 
1156
                           | a  b  c ]
 
1157
                           |         ]
 
1158
(%o2)                      | d  e  f ]
 
1159
                           |         ]
 
1160
                           | g  h  i ]
 
1161
</pre></td></tr></table>
 
1162
</dd></dl>
 
1163
 
 
1164
<dl>
 
1165
<dt><u>Function:</u> <b>matrix</b><i> (<var>row_1</var>, ..., <var>row_n</var>)</i>
 
1166
<a name="IDX799"></a>
 
1167
</dt>
 
1168
<dd><p>Returns a rectangular matrix which has the rows <var>row_1</var>, ..., <var>row_n</var>.
 
1169
Each row is a list of expressions.
 
1170
All rows must be the same length.
 
1171
</p>
 
1172
<p>The operations <code>+</code> (addition), <code>-</code> (subtraction), <code>*</code> (multiplication),
 
1173
and <code>/</code> (division), are carried out element by element
 
1174
when the operands are two matrices, a scalar and a matrix, or a matrix and a scalar.
 
1175
The operation <code>^</code> (exponentiation, equivalently <code>**</code>)
 
1176
is carried out element by element 
 
1177
if the operands are a scalar and a matrix or a matrix and a scalar,
 
1178
but not if the operands are two matrices.
 
1179
All operations are normally carried out in full,
 
1180
including <code>.</code> (noncommutative multiplication).
 
1181
</p>
 
1182
<p>Matrix multiplication is represented by the noncommutative multiplication operator <code>.</code>.
 
1183
The corresponding noncommutative exponentiation operator is <code>^^</code>.
 
1184
For a matrix <code><var>A</var></code>, <code><var>A</var>.<var>A</var> = <var>A</var>^^2</code> and
 
1185
<code><var>A</var>^^-1</code> is the inverse of <var>A</var>, if it exists.
 
1186
</p>
 
1187
<p>There are switches for controlling simplification of expressions
 
1188
involving dot and matrix-list operations.
 
1189
These are
 
1190
<code>doallmxops</code>, <code>domxexpt</code>
 
1191
<code>domxmxops</code>, <code>doscmxops</code>, and <code>doscmxplus</code>.
 
1192
</p>
 
1193
<p>There are additional options which are related to matrices. These are:
 
1194
<code>lmxchar</code>, <code>rmxchar</code>, <code>ratmx</code>, <code>listarith</code>, <code>detout</code>,
 
1195
<code>scalarmatrix</code>,
 
1196
and <code>sparse</code>.
 
1197
</p>
 
1198
<p>There are a number of
 
1199
functions which take matrices as arguments or yield matrices as return values.
 
1200
See <code>eigenvalues</code>, <code>eigenvectors</code>,
 
1201
<code>determinant</code>,
 
1202
<code>charpoly</code>, <code>genmatrix</code>, <code>addcol</code>, <code>addrow</code>, 
 
1203
<code>copymatrix</code>, <code>transpose</code>, <code>echelon</code>,
 
1204
and <code>rank</code>.
 
1205
</p>
 
1206
<p>Examples:
 
1207
</p>
 
1208
<ul>
 
1209
<li>
 
1210
Construction of matrices from lists.
 
1211
</li></ul>
 
1212
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) x: matrix ([17, 3], [-8, 11]);
 
1213
                           [ 17   3  ]
 
1214
(%o1)                      [         ]
 
1215
                           [ - 8  11 ]
 
1216
(%i2) y: matrix ([%pi, %e], [a, b]);
 
1217
                           [ %pi  %e ]
 
1218
(%o2)                      [         ]
 
1219
                           [  a   b  ]
 
1220
</pre></td></tr></table><ul>
 
1221
<li>
 
1222
Addition, element by element.
 
1223
</li></ul>
 
1224
<table><tr><td>&nbsp;</td><td><pre class="example">(%i3) x + y;
 
1225
                      [ %pi + 17  %e + 3 ]
 
1226
(%o3)                 [                  ]
 
1227
                      [  a - 8    b + 11 ]
 
1228
</pre></td></tr></table><ul>
 
1229
<li>
 
1230
Subtraction, element by element.
 
1231
</li></ul>
 
1232
<table><tr><td>&nbsp;</td><td><pre class="example">(%i4) x - y;
 
1233
                      [ 17 - %pi  3 - %e ]
 
1234
(%o4)                 [                  ]
 
1235
                      [ - a - 8   11 - b ]
 
1236
</pre></td></tr></table><ul>
 
1237
<li>
 
1238
Multiplication, element by element.
 
1239
</li></ul>
 
1240
<table><tr><td>&nbsp;</td><td><pre class="example">(%i5) x * y;
 
1241
                        [ 17 %pi  3 %e ]
 
1242
(%o5)                   [              ]
 
1243
                        [ - 8 a   11 b ]
 
1244
</pre></td></tr></table><ul>
 
1245
<li>
 
1246
Division, element by element.
 
1247
</li></ul>
 
1248
<table><tr><td>&nbsp;</td><td><pre class="example">(%i6) x / y;
 
1249
                        [ 17       - 1 ]
 
1250
                        [ ---  3 %e    ]
 
1251
                        [ %pi          ]
 
1252
(%o6)                   [              ]
 
1253
                        [   8    11    ]
 
1254
                        [ - -    --    ]
 
1255
                        [   a    b     ]
 
1256
</pre></td></tr></table><ul>
 
1257
<li>
 
1258
Matrix to a scalar exponent, element by element.
 
1259
</li></ul>
 
1260
<table><tr><td>&nbsp;</td><td><pre class="example">(%i7) x ^ 3;
 
1261
                         [ 4913    27  ]
 
1262
(%o7)                    [             ]
 
1263
                         [ - 512  1331 ]
 
1264
</pre></td></tr></table><ul>
 
1265
<li>
 
1266
Scalar base to a matrix exponent, element by element.
 
1267
</li></ul>
 
1268
<table><tr><td>&nbsp;</td><td><pre class="example">(%i8) exp(y); 
 
1269
                         [   %pi    %e ]
 
1270
                         [ %e     %e   ]
 
1271
(%o8)                    [             ]
 
1272
                         [    a     b  ]
 
1273
                         [  %e    %e   ]
 
1274
</pre></td></tr></table><ul>
 
1275
<li>
 
1276
Matrix base to a matrix exponent. This is not carried out element by element.
 
1277
</li></ul>
 
1278
<table><tr><td>&nbsp;</td><td><pre class="example">(%i9) x ^ y;
 
1279
                                [ %pi  %e ]
 
1280
                                [         ]
 
1281
                                [  a   b  ]
 
1282
                     [ 17   3  ]
 
1283
(%o9)                [         ]
 
1284
                     [ - 8  11 ]
 
1285
</pre></td></tr></table><ul>
 
1286
<li>
 
1287
Noncommutative matrix multiplication.
 
1288
</li></ul>
 
1289
<table><tr><td>&nbsp;</td><td><pre class="example">(%i10) x . y;
 
1290
                  [ 3 a + 17 %pi  3 b + 17 %e ]
 
1291
(%o10)            [                           ]
 
1292
                  [ 11 a - 8 %pi  11 b - 8 %e ]
 
1293
(%i11) y . x;
 
1294
                [ 17 %pi - 8 %e  3 %pi + 11 %e ]
 
1295
(%o11)          [                              ]
 
1296
                [  17 a - 8 b     11 b + 3 a   ]
 
1297
</pre></td></tr></table><ul>
 
1298
<li>
 
1299
Noncommutative matrix exponentiation.
 
1300
A scalar base <var>b</var> to a matrix power <var>M</var>
 
1301
is carried out element by element and so <code>b^^m</code> is the same as <code>b^m</code>.
 
1302
</li></ul>
 
1303
<table><tr><td>&nbsp;</td><td><pre class="example">(%i12) x ^^ 3;
 
1304
                        [  3833   1719 ]
 
1305
(%o12)                  [              ]
 
1306
                        [ - 4584  395  ]
 
1307
(%i13) %e ^^ y;
 
1308
                         [   %pi    %e ]
 
1309
                         [ %e     %e   ]
 
1310
(%o13)                   [             ]
 
1311
                         [    a     b  ]
 
1312
                         [  %e    %e   ]
 
1313
</pre></td></tr></table><ul>
 
1314
<li>
 
1315
A matrix raised to a -1 exponent with noncommutative exponentiation is the matrix inverse,
 
1316
if it exists.
 
1317
</li></ul>
 
1318
<table><tr><td>&nbsp;</td><td><pre class="example">(%i14) x ^^ -1;
 
1319
                         [ 11      3  ]
 
1320
                         [ ---  - --- ]
 
1321
                         [ 211    211 ]
 
1322
(%o14)                   [            ]
 
1323
                         [  8    17   ]
 
1324
                         [ ---   ---  ]
 
1325
                         [ 211   211  ]
 
1326
(%i15) x . (x ^^ -1);
 
1327
                            [ 1  0 ]
 
1328
(%o15)                      [      ]
 
1329
                            [ 0  1 ]
 
1330
</pre></td></tr></table>
 
1331
</dd></dl>
 
1332
 
 
1333
<dl>
 
1334
<dt><u>Function:</u> <b>matrixmap</b><i> (<var>f</var>, <var>M</var>)</i>
 
1335
<a name="IDX800"></a>
 
1336
</dt>
 
1337
<dd><p>Returns a matrix with element <code>i,j</code> equal to <code><var>f</var>(<var>M</var>[i,j])</code>.
 
1338
</p>
 
1339
<p>See also <code>map</code>, <code>fullmap</code>, <code>fullmapl</code>, and <code>apply</code>.
 
1340
</p>
 
1341
</dd></dl>
 
1342
 
 
1343
<dl>
 
1344
<dt><u>Function:</u> <b>matrixp</b><i> (<var>expr</var>)</i>
 
1345
<a name="IDX801"></a>
 
1346
</dt>
 
1347
<dd><p>Returns <code>true</code> if <var>expr</var> is a matrix, otherwise <code>false</code>.
 
1348
</p>
 
1349
</dd></dl>
 
1350
 
 
1351
<dl>
 
1352
<dt><u>Option variable:</u> <b>matrix_element_add</b>
 
1353
<a name="IDX802"></a>
 
1354
</dt>
 
1355
<dd><p>Default value: <code>+</code>
 
1356
</p>
 
1357
<p><code>matrix_element_add</code> is the operation 
 
1358
invoked in place of addition in a matrix multiplication.
 
1359
<code>matrix_element_add</code> can be assigned any n-ary operator
 
1360
(that is, a function which handles any number of arguments).
 
1361
The assigned value may be the name of an operator enclosed in quote marks,
 
1362
the name of a function,
 
1363
or a lambda expression.
 
1364
</p>
 
1365
<p>See also <code>matrix_element_mult</code> and <code>matrix_element_transpose</code>.
 
1366
</p>
 
1367
<p>Example:
 
1368
</p>
 
1369
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) matrix_element_add: &quot;*&quot;$
 
1370
(%i2) matrix_element_mult: &quot;^&quot;$
 
1371
(%i3) aa: matrix ([a, b, c], [d, e, f]);
 
1372
                           [ a  b  c ]
 
1373
(%o3)                      [         ]
 
1374
                           [ d  e  f ]
 
1375
(%i4) bb: matrix ([u, v, w], [x, y, z]);
 
1376
                           [ u  v  w ]
 
1377
(%o4)                      [         ]
 
1378
                           [ x  y  z ]
 
1379
(%i5) aa . transpose (bb);
 
1380
                     [  u  v  w   x  y  z ]
 
1381
                     [ a  b  c   a  b  c  ]
 
1382
(%o5)                [                    ]
 
1383
                     [  u  v  w   x  y  z ]
 
1384
                     [ d  e  f   d  e  f  ]
 
1385
</pre></td></tr></table>
 
1386
</dd></dl>
 
1387
 
 
1388
<dl>
 
1389
<dt><u>Option variable:</u> <b>matrix_element_mult</b>
 
1390
<a name="IDX803"></a>
 
1391
</dt>
 
1392
<dd><p>Default value: <code>*</code>
 
1393
</p>
 
1394
<p><code>matrix_element_mult</code> is the operation 
 
1395
invoked in place of multiplication in a matrix multiplication.
 
1396
<code>matrix_element_mult</code> can be assigned any binary operator.
 
1397
The assigned value may be the name of an operator enclosed in quote marks,
 
1398
the name of a function,
 
1399
or a lambda expression.
 
1400
</p>
 
1401
<p>The dot operator <code>.</code> is a useful choice in some contexts.
 
1402
</p>
 
1403
<p>See also <code>matrix_element_add</code> and <code>matrix_element_transpose</code>.
 
1404
</p>
 
1405
<p>Example:
 
1406
</p>
 
1407
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) matrix_element_add: lambda ([[x]], sqrt (apply (&quot;+&quot;, x)))$
 
1408
(%i2) matrix_element_mult: lambda ([x, y], (x - y)^2)$
 
1409
(%i3) [a, b, c] . [x, y, z];
 
1410
                          2          2          2
 
1411
(%o3)         sqrt((c - z)  + (b - y)  + (a - x) )
 
1412
(%i4) aa: matrix ([a, b, c], [d, e, f]);
 
1413
                           [ a  b  c ]
 
1414
(%o4)                      [         ]
 
1415
                           [ d  e  f ]
 
1416
(%i5) bb: matrix ([u, v, w], [x, y, z]);
 
1417
                           [ u  v  w ]
 
1418
(%o5)                      [         ]
 
1419
                           [ x  y  z ]
 
1420
(%i6) aa . transpose (bb);
 
1421
               [             2          2          2  ]
 
1422
               [ sqrt((c - w)  + (b - v)  + (a - u) ) ]
 
1423
(%o6)  Col 1 = [                                      ]
 
1424
               [             2          2          2  ]
 
1425
               [ sqrt((f - w)  + (e - v)  + (d - u) ) ]
 
1426
 
 
1427
                         [             2          2          2  ]
 
1428
                         [ sqrt((c - z)  + (b - y)  + (a - x) ) ]
 
1429
                 Col 2 = [                                      ]
 
1430
                         [             2          2          2  ]
 
1431
                         [ sqrt((f - z)  + (e - y)  + (d - x) ) ]
 
1432
</pre></td></tr></table>
 
1433
</dd></dl>
 
1434
 
 
1435
<dl>
 
1436
<dt><u>Option variable:</u> <b>matrix_element_transpose</b>
 
1437
<a name="IDX804"></a>
 
1438
</dt>
 
1439
<dd><p>Default value: <code>false</code>
 
1440
</p>
 
1441
<p><code>matrix_element_transpose</code> is the operation 
 
1442
applied to each element of a matrix when it is transposed.
 
1443
<code>matrix_element_mult</code> can be assigned any unary operator.
 
1444
The assigned value may be the name of an operator enclosed in quote marks,
 
1445
the name of a function,
 
1446
or a lambda expression.
 
1447
</p>
 
1448
<p>When <code>matrix_element_transpose</code> equals <code>transpose</code>,
 
1449
the <code>transpose</code> function is applied to every element.
 
1450
When <code>matrix_element_transpose</code> equals <code>nonscalars</code>,
 
1451
the <code>transpose</code> function is applied to every nonscalar element.
 
1452
If some element is an atom, the <code>nonscalars</code> option applies
 
1453
<code>transpose</code> only if the atom is declared nonscalar,
 
1454
while the <code>transpose</code> option always applies <code>transpose</code>.
 
1455
</p>
 
1456
<p>The default value, <code>false</code>, means no operation is applied.
 
1457
</p>
 
1458
<p>See also <code>matrix_element_add</code> and <code>matrix_element_mult</code>.
 
1459
</p>
 
1460
<p>Examples:
 
1461
</p>
 
1462
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) declare (a, nonscalar)$
 
1463
(%i2) transpose ([a, b]);
 
1464
                        [ transpose(a) ]
 
1465
(%o2)                   [              ]
 
1466
                        [      b       ]
 
1467
(%i3) matrix_element_transpose: nonscalars$
 
1468
(%i4) transpose ([a, b]);
 
1469
                        [ transpose(a) ]
 
1470
(%o4)                   [              ]
 
1471
                        [      b       ]
 
1472
(%i5) matrix_element_transpose: transpose$
 
1473
(%i6) transpose ([a, b]);
 
1474
                        [ transpose(a) ]
 
1475
(%o6)                   [              ]
 
1476
                        [ transpose(b) ]
 
1477
(%i7) matrix_element_transpose: lambda ([x], realpart(x) - %i*imagpart(x))$
 
1478
(%i8) m: matrix ([1 + 5*%i, 3 - 2*%i], [7*%i, 11]);
 
1479
                     [ 5 %i + 1  3 - 2 %i ]
 
1480
(%o8)                [                    ]
 
1481
                     [   7 %i       11    ]
 
1482
(%i9) transpose (m);
 
1483
                      [ 1 - 5 %i  - 7 %i ]
 
1484
(%o9)                 [                  ]
 
1485
                      [ 2 %i + 3    11   ]
 
1486
</pre></td></tr></table>
 
1487
</dd></dl>
 
1488
 
 
1489
<dl>
 
1490
<dt><u>Function:</u> <b>mattrace</b><i> (<var>M</var>)</i>
 
1491
<a name="IDX805"></a>
 
1492
</dt>
 
1493
<dd><p>Returns the trace (that is, the sum of the elements on the main diagonal) of
 
1494
the square matrix <var>M</var>.  
 
1495
</p>
 
1496
<p><code>mattrace</code> is called by <code>ncharpoly</code>,
 
1497
an alternative to Maxima's <code>charpoly</code>.
 
1498
</p>
 
1499
<p><code>load (&quot;nchrpl&quot;)</code> loads this function.
 
1500
</p>
 
1501
</dd></dl>
 
1502
 
 
1503
<dl>
 
1504
<dt><u>Function:</u> <b>minor</b><i> (<var>M</var>, <var>i</var>, <var>j</var>)</i>
 
1505
<a name="IDX806"></a>
 
1506
</dt>
 
1507
<dd><p>Returns the <var>i</var>, <var>j</var> minor of the matrix <var>M</var>.  That is, <var>M</var>
 
1508
with row <var>i</var> and column <var>j</var> removed.
 
1509
</p>
 
1510
</dd></dl>
 
1511
 
 
1512
<dl>
 
1513
<dt><u>Function:</u> <b>ncexpt</b><i> (<var>a</var>, <var>b</var>)</i>
 
1514
<a name="IDX807"></a>
 
1515
</dt>
 
1516
<dd><p>If a non-commutative exponential expression is too
 
1517
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>.
 
1518
</p>
 
1519
<p><code>ncexpt</code> is not the name of a function or operator;
 
1520
the name only appears in output, and is not recognized in input.
 
1521
</p>
 
1522
</dd></dl>
 
1523
 
 
1524
<dl>
 
1525
<dt><u>Function:</u> <b>ncharpoly</b><i> (<var>M</var>, <var>x</var>)</i>
 
1526
<a name="IDX808"></a>
 
1527
</dt>
 
1528
<dd><p>Returns the characteristic polynomial of the matrix <var>M</var>
 
1529
with respect to <var>x</var>.  This is an alternative to Maxima's <code>charpoly</code>.
 
1530
</p>
 
1531
<p><code>ncharpoly</code> works by computing traces of powers of the given matrix,
 
1532
which are known to be equal to sums of powers of the roots of the
 
1533
characteristic polynomial.  From these quantities the symmetric
 
1534
functions of the roots can be calculated, which are nothing more than
 
1535
the coefficients of the characteristic polynomial.  <code>charpoly</code> works by
 
1536
forming the determinant of <code><var>x</var> * ident [n] - a</code>.  Thus <code>ncharpoly</code> wins,
 
1537
for example, in the case of large dense matrices filled with integers,
 
1538
since it avoids polynomial arithmetic altogether.
 
1539
</p>
 
1540
<p><code>load (&quot;nchrpl&quot;)</code> loads this file.
 
1541
</p>
 
1542
</dd></dl>
 
1543
 
 
1544
<dl>
 
1545
<dt><u>Function:</u> <b>newdet</b><i> (<var>M</var>, <var>n</var>)</i>
 
1546
<a name="IDX809"></a>
 
1547
</dt>
 
1548
<dd><p>Computes the determinant of the matrix or array <var>M</var> by the
 
1549
Johnson-Gentleman tree minor algorithm.
 
1550
The argument <var>n</var> is the order; it is optional if <var>M</var> is a matrix.
 
1551
</p>
 
1552
</dd></dl>
 
1553
 
 
1554
<dl>
 
1555
<dt><u>Declaration:</u> <b>nonscalar</b>
 
1556
<a name="IDX810"></a>
 
1557
</dt>
 
1558
<dd><p>Makes atoms behave as does a list or matrix with respect to
 
1559
the dot operator.
 
1560
</p>
 
1561
</dd></dl>
 
1562
 
 
1563
<dl>
 
1564
<dt><u>Function:</u> <b>nonscalarp</b><i> (<var>expr</var>)</i>
 
1565
<a name="IDX811"></a>
 
1566
</dt>
 
1567
<dd><p>Returns <code>true</code> if <var>expr</var> is a non-scalar, i.e., it contains
 
1568
atoms declared as non-scalars, lists, or matrices.
 
1569
</p>
 
1570
</dd></dl>
 
1571
 
 
1572
<dl>
 
1573
<dt><u>Function:</u> <b>permanent</b><i> (<var>M</var>, <var>n</var>)</i>
 
1574
<a name="IDX812"></a>
 
1575
</dt>
 
1576
<dd><p>Computes the permanent of the matrix <var>M</var>.  A permanent
 
1577
is like a determinant but with no sign changes.
 
1578
</p>
 
1579
</dd></dl>
 
1580
 
 
1581
<dl>
 
1582
<dt><u>Function:</u> <b>rank</b><i> (<var>M</var>)</i>
 
1583
<a name="IDX813"></a>
 
1584
</dt>
 
1585
<dd><p>Computes the rank of the matrix <var>M</var>.  That is, the order of the
 
1586
largest non-singular subdeterminant of <var>M</var>.
 
1587
</p>
 
1588
<p><var>rank</var> may return the
 
1589
wrong answer if it cannot determine that a matrix element that is
 
1590
equivalent to zero is indeed so.
 
1591
</p>
 
1592
</dd></dl>
 
1593
 
 
1594
<dl>
 
1595
<dt><u>Option variable:</u> <b>ratmx</b>
 
1596
<a name="IDX814"></a>
 
1597
</dt>
 
1598
<dd><p>Default value: <code>false</code>
 
1599
</p>
 
1600
<p>When <code>ratmx</code> is <code>false</code>, determinant and matrix
 
1601
addition, subtraction, and multiplication are performed in the
 
1602
representation of the matrix elements and cause the result of
 
1603
matrix inversion to be left in general representation.
 
1604
</p>
 
1605
<p>When <code>ratmx</code> is <code>true</code>,
 
1606
the 4 operations mentioned above are performed in CRE form and the
 
1607
result of matrix inverse is in CRE form.  Note that this may
 
1608
cause the elements to be expanded (depending on the setting of <code>ratfac</code>)
 
1609
which might not always be desired.
 
1610
</p>
 
1611
</dd></dl>
 
1612
 
 
1613
<dl>
 
1614
<dt><u>Function:</u> <b>row</b><i> (<var>M</var>, <var>i</var>)</i>
 
1615
<a name="IDX815"></a>
 
1616
</dt>
 
1617
<dd><p>Returns the <var>i</var>'th row of the matrix <var>M</var>.
 
1618
The return value is a matrix.
 
1619
</p>
 
1620
</dd></dl>
 
1621
 
 
1622
<dl>
 
1623
<dt><u>Option variable:</u> <b>scalarmatrixp</b>
 
1624
<a name="IDX816"></a>
 
1625
</dt>
 
1626
<dd><p>Default value: <code>true</code>
 
1627
</p>
 
1628
<p>When <code>scalarmatrixp</code> is <code>true</code>, then whenever a 1 x 1 matrix
 
1629
is produced as a result of computing the dot product of matrices it
 
1630
is simplified to a scalar, namely the sole element of the matrix.
 
1631
</p>
 
1632
<p>When <code>scalarmatrixp</code> is <code>all</code>,
 
1633
then all 1 x 1 matrices are simplified to scalars.
 
1634
</p>
 
1635
<p>When <code>scalarmatrixp</code> is <code>false</code>, 1 x 1 matrices are not simplified to scalars.
 
1636
</p>
 
1637
</dd></dl>
 
1638
 
 
1639
<dl>
 
1640
<dt><u>Function:</u> <b>scalefactors</b><i> (<var>coordinatetransform</var>)</i>
 
1641
<a name="IDX817"></a>
 
1642
</dt>
 
1643
<dd><p>Here coordinatetransform
 
1644
evaluates to the form [[expression1, expression2, ...],
 
1645
indeterminate1, indeterminat2, ...], where indeterminate1,
 
1646
indeterminate2, etc. are the curvilinear coordinate variables and
 
1647
where a set of rectangular Cartesian components is given in terms of
 
1648
the curvilinear coordinates by [expression1, expression2, ...].
 
1649
<code>coordinates</code> is set to the vector [indeterminate1, indeterminate2,...],
 
1650
and <code>dimension</code> is set to the length of this vector.  SF[1], SF[2],
 
1651
..., SF[DIMENSION] are set to the coordinate scale factors, and <code>sfprod</code>
 
1652
is set to the product of these scale factors.  Initially, <code>coordinates</code>
 
1653
is [X, Y, Z], <code>dimension</code> is 3, and SF[1]=SF[2]=SF[3]=SFPROD=1,
 
1654
corresponding to 3-dimensional rectangular Cartesian coordinates.
 
1655
To expand an expression into physical components in the current
 
1656
coordinate system, there is a function with usage of the form
 
1657
</p>
 
1658
</dd></dl>
 
1659
 
 
1660
<dl>
 
1661
<dt><u>Function:</u> <b>setelmx</b><i> (<var>x</var>, <var>i</var>, <var>j</var>, <var>M</var>)</i>
 
1662
<a name="IDX818"></a>
 
1663
</dt>
 
1664
<dd><p>Assigns <var>x</var> to the (<var>i</var>, <var>j</var>)'th element of the matrix <var>M</var>,
 
1665
and returns the altered matrix.
 
1666
</p>
 
1667
<p><code><var>M</var> [<var>i</var>, <var>j</var>]: <var>x</var></code> has the same effect,
 
1668
but returns <var>x</var> instead of <var>M</var>.
 
1669
</p>
 
1670
</dd></dl>
 
1671
 
 
1672
<dl>
 
1673
<dt><u>Function:</u> <b>similaritytransform</b><i> (<var>M</var>)</i>
 
1674
<a name="IDX819"></a>
 
1675
</dt>
 
1676
<dt><u>Function:</u> <b>simtran</b><i> (<var>M</var>)</i>
 
1677
<a name="IDX820"></a>
 
1678
</dt>
 
1679
<dd><p><code>similaritytransform</code> computes a similarity transform of the matrix <code>M</code>.
 
1680
It returns a list which is the output of the
 
1681
<code>uniteigenvectors</code> command.  In addition if the flag <code>nondiagonalizable</code>
 
1682
is <code>false</code> two global matrices <code>leftmatrix</code> and <code>rightmatrix</code> are computed.
 
1683
These matrices have the property that
 
1684
<code>leftmatrix . <var>M</var> . rightmatrix</code> is a diagonal matrix with the eigenvalues
 
1685
of <var>M</var> on the diagonal.  If <code>nondiagonalizable</code> is <code>true</code> the left and right
 
1686
matrices are not computed.
 
1687
</p>
 
1688
<p>If the flag <code>hermitianmatrix</code> is <code>true</code>
 
1689
then <code>leftmatrix</code> is the complex conjugate of the transpose of
 
1690
<code>rightmatrix</code>.  Otherwise <code>leftmatrix</code> is the inverse of <code>rightmatrix</code>.
 
1691
</p>
 
1692
<p><code>rightmatrix</code> is the matrix the columns of which are the unit
 
1693
eigenvectors of <var>M</var>.  The other flags (see <code>eigenvalues</code> and
 
1694
<code>eigenvectors</code>) have the same effects since
 
1695
<code>similaritytransform</code> calls the other functions in the package in order
 
1696
to be able to form <code>rightmatrix</code>.
 
1697
</p>
 
1698
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
1699
</p>
 
1700
<p><code>simtran</code> is a synonym for <code>similaritytransform</code>.
 
1701
</p>
 
1702
</dd></dl>
 
1703
 
 
1704
<dl>
 
1705
<dt><u>Option variable:</u> <b>sparse</b>
 
1706
<a name="IDX821"></a>
 
1707
</dt>
 
1708
<dd><p>Default value: <code>false</code>
 
1709
</p>
 
1710
<p>When <code>sparse</code> is <code>true</code>, and if <code>ratmx</code> is <code>true</code>, then <code>determinant</code>
 
1711
will use special routines for computing sparse determinants.
 
1712
</p>
 
1713
</dd></dl>
 
1714
 
 
1715
<dl>
 
1716
<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>
 
1717
<a name="IDX822"></a>
 
1718
</dt>
 
1719
<dt><u>Function:</u> <b>submatrix</b><i> (<var>i_1</var>, ..., <var>i_m</var>, <var>M</var>)</i>
 
1720
<a name="IDX823"></a>
 
1721
</dt>
 
1722
<dt><u>Function:</u> <b>submatrix</b><i> (<var>M</var>, <var>j_1</var>, ..., <var>j_n</var>)</i>
 
1723
<a name="IDX824"></a>
 
1724
</dt>
 
1725
<dd><p>Returns a new matrix composed of the
 
1726
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.
 
1727
</p>
 
1728
</dd></dl>
 
1729
 
 
1730
<dl>
 
1731
<dt><u>Function:</u> <b>transpose</b><i> (<var>M</var>)</i>
 
1732
<a name="IDX825"></a>
 
1733
</dt>
 
1734
<dd><p>Returns the transpose of <var>M</var>.
 
1735
</p>
 
1736
<p>If <var>M</var> is a matrix, the return value is another matrix <var>N</var>
 
1737
such that <code>N[i,j] = M[j,i]</code>.
 
1738
</p>
 
1739
<p>Otherwise <var>M</var> is a list, and the return value is a matrix <var>N</var>
 
1740
of <code>length (m)</code> rows and 1 column, such that <code>N[i,1] = M[i]</code>.
 
1741
</p>
 
1742
</dd></dl>
 
1743
 
 
1744
<dl>
 
1745
<dt><u>Function:</u> <b>triangularize</b><i> (<var>M</var>)</i>
 
1746
<a name="IDX826"></a>
 
1747
</dt>
 
1748
<dd><p>Returns the upper triangular form of the matrix <code>M</code>,
 
1749
as produced by Gaussian elimination.
 
1750
The return value is the same as <code>echelon</code>,
 
1751
except that the leading nonzero coefficient in each row is not normalized to 1.
 
1752
</p>
 
1753
<p><code>lu_factor</code> and <code>cholesky</code> are other functions which yield triangularized matrices.
 
1754
</p>
 
1755
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) M: matrix ([3, 7, aa, bb], [-1, 8, 5, 2], [9, 2, 11, 4]);
 
1756
                       [  3   7  aa  bb ]
 
1757
                       [                ]
 
1758
(%o1)                  [ - 1  8  5   2  ]
 
1759
                       [                ]
 
1760
                       [  9   2  11  4  ]
 
1761
(%i2) triangularize (M);
 
1762
             [ - 1   8         5            2      ]
 
1763
             [                                     ]
 
1764
(%o2)        [  0   - 74     - 56         - 22     ]
 
1765
             [                                     ]
 
1766
             [  0    0    626 - 74 aa  238 - 74 bb ]
 
1767
</pre></td></tr></table>
 
1768
</dd></dl>
 
1769
 
 
1770
<dl>
 
1771
<dt><u>Function:</u> <b>uniteigenvectors</b><i> (<var>M</var>)</i>
 
1772
<a name="IDX827"></a>
 
1773
</dt>
 
1774
<dt><u>Function:</u> <b>ueivects</b><i> (<var>M</var>)</i>
 
1775
<a name="IDX828"></a>
 
1776
</dt>
 
1777
<dd><p>Computes unit eigenvectors of the matrix <var>M</var>.
 
1778
The return value is a list of lists, the first sublist of which is the
 
1779
output of the <code>eigenvalues</code> command, and the other sublists of which are
 
1780
the unit eigenvectors of the matrix corresponding to those eigenvalues
 
1781
respectively.
 
1782
</p>
 
1783
<p>The flags mentioned in the description of the
 
1784
<code>eigenvectors</code> command have the same effects in this one as well.
 
1785
</p>
 
1786
<p>When <code>knowneigvects</code> is <code>true</code>, the <code>eigen</code> package assumes
 
1787
that the eigenvectors of the matrix are known to the user and are
 
1788
stored under the global name <code>listeigvects</code>.  <code>listeigvects</code> should be set
 
1789
to a list similar to the output of the <code>eigenvectors</code> command.
 
1790
</p>
 
1791
<p>If <code>knowneigvects</code> is set to <code>true</code> and the list of eigenvectors is given the
 
1792
setting of the flag <code>nondiagonalizable</code> may not be correct.  If that is
 
1793
the case please set it to the correct value.  The author assumes that
 
1794
the user knows what he is doing and will not try to diagonalize a
 
1795
matrix the eigenvectors of which do not span the vector space of the
 
1796
appropriate dimension.
 
1797
</p>
 
1798
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
1799
</p>
 
1800
<p><code>ueivects</code> is a synonym for <code>uniteigenvectors</code>.
 
1801
</p>
 
1802
</dd></dl>
 
1803
 
 
1804
<dl>
 
1805
<dt><u>Function:</u> <b>unitvector</b><i> (<var>x</var>)</i>
 
1806
<a name="IDX829"></a>
 
1807
</dt>
 
1808
<dt><u>Function:</u> <b>uvect</b><i> (<var>x</var>)</i>
 
1809
<a name="IDX830"></a>
 
1810
</dt>
 
1811
<dd><p>Returns <em><var>x</var>/norm(<var>x</var>)</em>;
 
1812
this is a unit vector in the same direction as <var>x</var>.
 
1813
</p>
 
1814
<p><code>load (&quot;eigen&quot;)</code> loads this function.
 
1815
</p>
 
1816
<p><code>uvect</code> is a synonym for <code>unitvector</code>.
 
1817
</p>
 
1818
</dd></dl>
 
1819
 
 
1820
<dl>
 
1821
<dt><u>Function:</u> <b>vectorsimp</b><i> (<var>expr</var>)</i>
 
1822
<a name="IDX831"></a>
 
1823
</dt>
 
1824
<dd><p>Applies simplifications and expansions according
 
1825
to the following global flags:
 
1826
</p>
 
1827
<p><code>expandall</code>, <code>expanddot</code>, <code>expanddotplus</code>, <code>expandcross</code>, <code>expandcrossplus</code>,
 
1828
<code>expandcrosscross</code>, <code>expandgrad</code>, <code>expandgradplus</code>, <code>expandgradprod</code>,
 
1829
<code>expanddiv</code>, <code>expanddivplus</code>, <code>expanddivprod</code>, <code>expandcurl</code>, <code>expandcurlplus</code>,
 
1830
<code>expandcurlcurl</code>, <code>expandlaplacian</code>, <code>expandlaplacianplus</code>,
 
1831
and <code>expandlaplacianprod</code>.
 
1832
</p>
 
1833
<p>All these flags have default value <code>false</code>. The <code>plus</code> suffix refers to
 
1834
employing additivity or distributivity.  The <code>prod</code> suffix refers to the
 
1835
expansion for an operand that is any kind of product.
 
1836
</p>
 
1837
<dl compact="compact">
 
1838
<dt> <code>expandcrosscross</code></dt>
 
1839
<dd><p>Simplifies <em>p ~ (q ~ r)</em> to <em>(p . r)*q - (p . q)*r</em>.
 
1840
</p></dd>
 
1841
<dt> <code>expandcurlcurl</code></dt>
 
1842
<dd><p>Simplifies <em>curl curl p</em> to <em>grad div p + div grad p</em>.
 
1843
</p></dd>
 
1844
<dt> <code>expandlaplaciantodivgrad</code></dt>
 
1845
<dd><p>Simplifies <em>laplacian p</em> to <em>div grad p</em>.
 
1846
</p></dd>
 
1847
<dt> <code>expandcross</code></dt>
 
1848
<dd><p>Enables <code>expandcrossplus</code> and <code>expandcrosscross</code>.
 
1849
</p></dd>
 
1850
<dt> <code>expandplus</code></dt>
 
1851
<dd><p>Enables <code>expanddotplus</code>, <code>expandcrossplus</code>, <code>expandgradplus</code>,
 
1852
<code>expanddivplus</code>, <code>expandcurlplus</code>, and <code>expandlaplacianplus</code>.
 
1853
</p></dd>
 
1854
<dt> <code>expandprod</code></dt>
 
1855
<dd><p>Enables <code>expandgradprod</code>, <code>expanddivprod</code>, and <code>expandlaplacianprod</code>.
 
1856
</p></dd>
 
1857
</dl>
 
1858
 
 
1859
<p>These flags have all been declared <code>evflag</code>.
 
1860
</p>
 
1861
 
 
1862
</dd></dl>
 
1863
 
 
1864
<dl>
 
1865
<dt><u>Option variable:</u> <b>vect_cross</b>
 
1866
<a name="IDX832"></a>
 
1867
</dt>
 
1868
<dd><p>Default value: <code>false</code>
 
1869
</p>
 
1870
<p>When <code>vect_cross</code> is <code>true</code>, it allows DIFF(X~Y,T) to work where
 
1871
~ is defined in SHARE;VECT (where VECT_CROSS is set to <code>true</code>, anyway.)
 
1872
</p>
 
1873
</dd></dl>
 
1874
 
 
1875
<dl>
 
1876
<dt><u>Function:</u> <b>zeromatrix</b><i> (<var>m</var>, <var>n</var>)</i>
 
1877
<a name="IDX833"></a>
 
1878
</dt>
 
1879
<dd><p>Returns an <var>m</var> by <var>n</var> matrix, all elements of which are zero.
 
1880
</p>
 
1881
</dd></dl>
 
1882
 
 
1883
<dl>
 
1884
<dt><u>Special symbol:</u> <b>[</b>
 
1885
<a name="IDX834"></a>
 
1886
</dt>
 
1887
<dt><u>Special symbol:</u> <b>]</b>
 
1888
<a name="IDX835"></a>
 
1889
</dt>
 
1890
<dd><p><code>[</code> and <code>]</code> mark the beginning and end, respectively, of a list.
 
1891
</p>
 
1892
<p><code>[</code> and <code>]</code> also enclose the subscripts of
 
1893
a list, array, hash array, or array function.
 
1894
</p>
 
1895
<p>Examples:
 
1896
</p>
 
1897
<table><tr><td>&nbsp;</td><td><pre class="example">(%i1) x: [a, b, c];
 
1898
(%o1)                       [a, b, c]
 
1899
(%i2) x[3];
 
1900
(%o2)                           c
 
1901
(%i3) array (y, fixnum, 3);
 
1902
(%o3)                           y
 
1903
(%i4) y[2]: %pi;
 
1904
(%o4)                          %pi
 
1905
(%i5) y[2];
 
1906
(%o5)                          %pi
 
1907
(%i6) z['foo]: 'bar;
 
1908
(%o6)                          bar
 
1909
(%i7) z['foo];
 
1910
(%o7)                          bar
 
1911
(%i8) g[k] := 1/(k^2+1);
 
1912
                                  1
 
1913
(%o8)                     g  := ------
 
1914
                           k     2
 
1915
                                k  + 1
 
1916
(%i9) g[10];
 
1917
                                1
 
1918
(%o9)                          ---
 
1919
                               101
 
1920
</pre></td></tr></table>
 
1921
</dd></dl>
 
1922
 
 
1923
<hr size="6">
 
1924
<table cellpadding="1" cellspacing="1" border="0">
 
1925
<tr><td valign="middle" align="left">[<a href="#SEC85" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
 
1926
<td valign="middle" align="left">[<a href="maxima_27.html#SEC91" title="Next chapter"> &gt;&gt; </a>]</td>
 
1927
<td valign="middle" align="left"> &nbsp; </td>
 
1928
<td valign="middle" align="left"> &nbsp; </td>
 
1929
<td valign="middle" align="left"> &nbsp; </td>
 
1930
<td valign="middle" align="left"> &nbsp; </td>
 
1931
<td valign="middle" align="left"> &nbsp; </td>
 
1932
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
 
1933
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
 
1934
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
 
1935
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
 
1936
</tr></table>
 
1937
<p>
 
1938
 <font size="-1">
 
1939
  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>.
 
1940
 </font>
 
1941
 <br>
 
1942
 
 
1943
</p>
 
1944
</body>
 
1945
</html>