PolynomialTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Algebra : Polynomials : PolynomialTools : PolynomialTools/CoefficientVector

PolynomialTools

  

CoefficientVector

  

return a Vector of coefficients from a univariate polynomial

  

CoefficientList

  

return a list of coefficients from a univariate polynomial

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

CoefficientVector(p, x, vectoropts, orderopts)

CoefficientList(p, x, orderopts)

Parameters

p

-

polynom(anything, x)

x

-

name of main variable

vectoropt

-

(optional) a sequence of Vector constructor options; see Vector

orderopts

-

(optional) equation of the form termorder=reverse or termorder=forward

Description

• 

The CoefficientVector(p, x) calling sequence returns a Vector of coefficients from a polynomial p in x.

• 

The CoefficientList(p, x) calling sequence returns a list of coefficients from a polynomial p in x.

• 

If the term order is not specified or termorder=forward, for  p=a0+a1x+...+anxn, the k-th element of the Vector or list returned corresponds to ak1.

• 

If termorder=reverse is specified, then the coefficients will be stored in the reverse of the above order.

• 

These commands are useful because the Maple command coeff is of linear complexity in the degree of the polynomial. Thus, a naive implementation of CoefficientVector would be of quadratic complexity. The actual implementation is of linear complexity.  In fact, for CoefficientVector, if sparse storage is specified as an option, the complexity is linear in the actual number of terms.

• 

The inverse commands are FromCoefficientVector and FromCoefficientList.

Examples

withPolynomialTools:

p113x+x5

p:=x513x+1

(1)

CoefficientVectorp,x

1130001

(2)

CoefficientVectorp,x,'termorder'='reverse'

1000131

(3)

CoefficientListexpandp2,x

1,26,169,0,0,2,26,0,0,0,1

(4)

CoefficientVector1+5x1000000000,x,storage=sparse

1 .. 1000000001 VectorcolumnData Type: anythingStorage: sparseOrder: Fortran_order

(5)

CoefficientVector1+5x1000000000,x,storage=sparse,termorder=reverse

1 .. 1000000001 VectorcolumnData Type: anythingStorage: sparseOrder: Fortran_order

(6)
• 

For the zero polynomial, the CoefficientVector command returns a zero-dimensional Vector and the CoefficientList command returns an empty list.

CoefficientVector0,x

(7)

CoefficientList0.,x

(8)
• 

Non-expanded polynomials will also work but since collect will be called on them, this could be inefficient.

qx1x25x2x:

CoefficientListq,x

0,25,51,27,1

(9)
• 

The coefficients of the polynomial do not have to be numbers.

CoefficientListy3y2x+y2x2+x3,x

y3,y2,y2,1

(10)

See Also

coeff

coeffs

expand

FromCoefficientList

PolynomialTools

Vector

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam