File r37/lisp/csl/html/r37_0162.html artifact bc461af013 part of check-in e1a8550313



<A NAME=MAINVAR>

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



<B>MAINVAR</B> _ _ _  _ _ _  _ _ _  _ _ _ <B>operator</B><P>
<P>
 
 <P>
<P>
The <em>mainvar</em> operator returns the main variable (in the system's 
internal representation) of its argument. 
 <P> <H3> 
syntax: </H3>
<P>
<P>
<em>mainvar</em>(&lt;expression&gt;) 
<P>
<P>
<P>
<P>
&lt;expression&gt; is usually a polynomial, but may be any valid REDUCE 
scalar expression. In the case of a rational function, the main variable 
of the numerator is returned. The main variable returned is a 

<A HREF=r37_0002.html>kernel</A>. 
<P>
<P>
 <P> <H3> 
examples: </H3>
<P><PRE><TT>
test := (a + b + c)**2; 

           2                    2            2
  TEST := A  + 2*A*B + 2*A*C + B  + 2*B*C + C  


mainvar(test); 

  A 


korder c,b,a; 

mainvar(test); 

  C 


mainvar(2*cos(x)**2); 

  COS(X) 


mainvar(17); 

  0

</TT></PRE><P>The main variable is the first variable in the canonical ordering 
of 
kernels. Generally, alphabetically ordered functions come first, then 
alphabetically ordered identifiers (variables). Numbers come last, and as 
far as <em>mainvar</em> is concerned belong in the family <em>0</em>. The 
canonical ordering can be changed by the declaration 
<A HREF=r37_0198.html>korder</A>, as 
shown above. 
<P>
<P>
<P>


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