Previous Page Next Page Contents

tcoeff -- the trailing coefficient of a polynomial

Introduction

tcoeff(p) returns the trailing coefficient of the polynomial p.

Call(s)

tcoeff(p <, vars> <, order>)

Parameters

p - a polynomial of type DOM_POLY or a polynomial expression
vars - a list of indeterminates of the polynomial: typically, identifiers or indexed identifiers
order - the term ordering: either LexOrder, or DegreeOrder, or DegInvLexOrder, or a user-defined term ordering of type Dom::MonomOrdering. The default is the lexicographical ordering LexOrder.

Returns

an element of the coefficient domain of the polynomial or FAIL.

Overloadable:

p

Related Functions

coeff, collect, degree, degreevec, ground, lcoeff, ldegree, lmonomial, lterm, nterms, nthcoeff, nthmonomial, nthterm, poly, poly2list

Details

Example 1

We demonstrate how the indeterminates influence the result:

>> p := 2*x^2*y + 3*x*y^2:
   tcoeff(p), tcoeff(p, [x, y]), tcoeff(p, [y, x])
                                  2, 3, 2

Note that the indeterminates passed to tcoeff will be used, even if the polynomial provides different indeterminates :

>> p := poly(2*x^2*y + 3*x*y^2, [x, y]):    
   tcoeff(p), tcoeff(p, [x, y]), tcoeff(p, [y, x]),
   tcoeff(p, [y]), tcoeff(p, [z])
                                  2     2          2
                      3, 3, 2, 2 x , 2 x  y + 3 x y
>> delete p:

Example 2

We demonstrate how various orderings influence the result:

>> p := poly(5*x^4 + 4*x^3*y + 3*x^2*y^3*z, [x, y, z]):
   tcoeff(p), tcoeff(p, DegreeOrder), tcoeff(p, DegInvLexOrder)
                                  3, 4, 5

The following call uses the reverse lexicographical order on 3 indeterminates:

>> tcoeff(p, Dom::MonomOrdering(RevLex(3)))
                                     5
>> delete p:

Example 3

The result of tcoeff is not fully evaluated:

>> p := poly(27*x^2 + a*x, [x]): a := 5:
   tcoeff(p, [x]), eval(tcoeff(p, [x]))
                                   a, 5
>> delete p, a:

Example 4

We define a polynomial over the integers modulo 7:

>> p := poly(3*x, [x], Dom::IntegerMod(7)): tcoeff(p)
                                  3 mod 7

This polynomial cannot be regarded as a polynomial with respect to another indeterminate, because the ``coefficient'' 3*x cannot be interpreted as an element of the coefficient ring Dom::IntegerMod(7):

>> tcoeff(p, [y])
                                   FAIL
>> delete p:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000