MAINVAR INDEX

MAINVAR _ _ _ _ _ _ _ _ _ _ _ _ operator

The mainvar operator returns the main variable (in the system's internal representation) of its argument.

syntax:

mainvar(<expression>)

<expression> 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 kernel.

examples:


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

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 mainvar is concerned belong in the family 0. The canonical ordering can be changed by the declaration korder, as shown above.