convert/MatrixPolynomialObject
convert a matrix polynomial or scalar polynomial to a standard internal representation
type/MatrixPolynomialObject
test for a MatrixPolynomialObject
Calling Sequence
Parameters
Description
Examples
convert(p, MatrixPolynomialObject, x)
convert(values, MatrixPolynomialObject, nodes)
type(expr, MatrixPolynomialObject, x)
p
-
polynomial expressed in any of a number of polynomial bases
x
name; the variable for the polynomial
values
list of values of the (matrix or scalar) polynomial p at the (distinct) nodes
nodes
list of algebraic expressions representing distinct scalar nodes
expr
arbitrary Maple object
The convert(p, MatrixPolynomialObject, x) function converts the (matrix or scalar) polynomial p into a standard representation, a Record. This allows systematic (conventional) access to the polynomial properties, such as Degree, in a manner independent of the polynomial basis. The bases understood by MatrixPolynomialObject include:
BernsteinBasis
ChebyshevT
ChebyshevU
GegenbauerC
JacobiP
LagrangeBasis
NewtonBasis
PochhammerBasis
and most others understood by the OrthogonalSeries package. This routine is used internally by LinearAlgebra[CompanionMatrix].
If the input polynomial p contains more than one basis, then this (heuristic) conversion will fail.
The type(expr, MatrixPolynomialObject) function checks whether expr is a Record of the type returned by convert(...,MatrixPolynomialObject).
A MatrixPolynomialObject record has the following fields:
Basis - the name of the basis used; either PowerBasis or any of the supported basis names listed above.
BasisParameters - a list of the parameters of the particular basis; e.g. for LagrangeBasis or NewtonBasis these are the nodes; for BernsteinBasis these are the degree n and the left and right ends a and b of the interval.
Coefficient - a procedure to return a specific coefficient matrix. It takes as argument a nonnegative integer less or equal to Degree and returns a Matrix.
Degree - a nonnegative integer; the degree of the polynomial (in the LagrangeBasis or BernsteinBasis case, an upper bound on the degree).
Dimension - a positive integer; the matrix dimension s of the matrix polynomial (s=1 if the original polynomial is a scalar polynomial).
IsMonic - a procedure without arguments returning true or false, depending on whether the polynomial is known to be monic (not relevant for Lagrange or Bernstein bases).
OutputOptions - a list of output options for the coefficient Matrices (see MatrixOptions).
Value - a procedure to evaluate the polynomial at any point. It takes as an argument the point (an algebraic expression) and returns a Matrix.
Variable - a name; the original variable used to define the polynomial (which may be unspecified in the LagrangeBasis case).
p≔add⁡k+1k+2⁢ChebyshevT⁡k,x,k=0..5
p≔ChebyshevT⁡0,x2+2⁢ChebyshevT⁡1,x3+3⁢ChebyshevT⁡2,x4+4⁢ChebyshevT⁡3,x5+5⁢ChebyshevT⁡4,x6+6⁢ChebyshevT⁡5,x7
P≔convert⁡p,MatrixPolynomialObject,x
P≔Record⁡Value=Defaultvalue,Variable=x,Degree=5,Coefficient=coe,Dimension=1,1,Basis=ChebyshevT,BasisParameters=,IsMonic=mon,OutputOptions=shape=,storage=rectangular,order=Fortran_order,fill=0,attributes=
P:-Degree
5
P:-Dimension
1,1
P:-Value⁡0.3
0.5949161905
Lagrange basis.
nodes≔−1,−13,13,1
values≔−1,1,−1,1
P≔convert⁡values,MatrixPolynomialObject,nodes
P≔Record⁡Value=Defaultvalue,Variable=_X1,Degree=3,Coefficient=coe,Dimension=1,1,Basis=LagrangeBasis,BasisParameters=−1,−13,13,1,IsMonic=mon,OutputOptions=shape=,storage=rectangular,order=Fortran_order,fill=0,attributes=
3
−0.9284999999
pinterp≔CurveFitting:-PolynomialInterpolation⁡nodes,values,t,form=Lagrange
pinterp≔9⁢t+13⁢t−13⁢t−116+27⁢t+1⁢t−13⁢t−116+27⁢t+1⁢t+13⁢t−116+9⁢t+1⁢t+13⁢t−1316
normal⁡pinterpP:-Value⁡t1,1
1
Bernstein Basis: note that the zeros of p are the eigenvalues of the companion matrix pencil of p.
N≔4
p≔add⁡k3k+1⁢BernsteinBasis⁡k,N,0,1,x,k=0..N
p≔BernsteinBasis⁡1,4,0,1,x2+8⁢BernsteinBasis⁡2,4,0,1,x3+27⁢BernsteinBasis⁡3,4,0,1,x4+64⁢BernsteinBasis⁡4,4,0,1,x5
P≔Record⁡Value=Defaultvalue,Variable=x,Degree=4,Coefficient=coe,Dimension=1,1,Basis=BernsteinBasis,BasisParameters=4,0,1,IsMonic=mon,OutputOptions=shape=,storage=rectangular,order=Fortran_order,fill=0,attributes=
type⁡P,MatrixPolynomialObject
true
Digits≔trunc⁡evalhf⁡Digits
Digits≔15
1.52538000000000
C0,C1≔LinearAlgebraCompanionMatrix⁡P,x
C0,C1≔0000100−12010−83001−274,40001320−120123−83001−7120
E≔LinearAlgebraEigenvalues⁡evalf⁡C0,evalf⁡C1
E≔10.0659400730376+0.⁢I−4.86159366800337+0.⁢I−0.204346405034140+0.⁢I0.+0.⁢I
map⁡t→P:-Value⁡t1,1,E
−6.54979459837233×10−11−6.43295475392105×10−121.00075642936163×10−160.
A matrix polynomial example.
A0,A1,A2≔LinearAlgebraRandomMatrix⁡3,3,LinearAlgebraRandomMatrix⁡3,3,LinearAlgebraRandomMatrix⁡3,3
A0,A1,A2≔−74829−46944279992,−9827−72−77−93−257−76−32,−945−18−50−8187−22−3833
nodes≔−1,0,1
P≔convert⁡A0,A1,A2,MatrixPolynomialObject,nodes
P≔Record⁡Value=Defaultvalue,Variable=_X4,Degree=2,Coefficient=coe,Dimension=3,3,Basis=LagrangeBasis,BasisParameters=−1,0,1,IsMonic=mon,OutputOptions=shape=,storage=rectangular,order=Fortran_order,fill=0,attributes=
−83.164999999999932.5050000000000−72.0749999999999−79.3999999999999−107.67000000000010.525000000000044.7450000000000−86.9649999999999−32.3450000000000
C0,C1≔LinearAlgebraCompanionMatrix⁡P,dummy
See Also
LinearAlgebra[CompanionMatrix]
Matrix
OrthogonalSeries
Record
Download Help Document