File r37/lisp/csl/html/r37_0343.html artifact ff899aec58 part of check-in d9e362f11e



<A NAME=MAT>

<TITLE>MAT</TITLE></A>
<b><a href=r37_idx.html>INDEX</a></b><p><p>



<B>MAT</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The <em>mat</em> operator is used to represent a two-dimensional 

<A HREF=r37_0345.html>matrix</A>. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>mat</em>((&lt;expr&gt;{,&lt;expr&gt;}*) {(&lt;expr&gt;{<em>,</em>&lt;expr
&gt;}*)}*) 
<P>
<P>
<P>
&lt;expr&gt; may be any valid REDUCE scalar expression. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
mat((1,2),(3,4)); 

  MAT(1,1) := 1
  MAT(2,3) := 2
  MAT(2,1) := 3
  MAT(2,2) := 4


mat(2,1); 

  ***** Matrix mismatch
  Cont? (Y or N) 


matrix qt; 

qt := ws; 

  QT(1,1) := 1
  QT(1,2) := 2
  QT(2,1) := 3
  QT(2,2) := 4 


matrix a,b; 

a := mat((x),(y),(z)); 

  A(1,1) := X
  A(2,1) := Y
  A(3,1) := Z 


b := mat((sin x,cos x,1)); 

  B(1,1) := SIN(X)
  B(1,2) := COS(X)
  B(1,3) := 1

</TT></PRE><P>Matrices need not have a size declared (unlike arrays). <em>mat
</em> 
redimensions a matrix variable as needed. It is necessary, of course, 
that all rows be the same length. An anonymous matrix, as shown in the 
first example, must be named before it can be referenced (note error 
message). When using <em>mat</em> to fill a 1 x n 
matrix, the row of values must be inside a second set of parentheses, to 
eliminate ambiguity. 
<P>
<P>
<P>


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]