Learn R Programming

polyMatrix (version 0.3.1)

lead: The leading coefficient of a polynom or polynomial matrix

Description

Returns the leading coefficients of the input polynom or polynomial matrix.

Usage

lead(p,method=c("matrix","column","row","element"))

Arguments

p

a polynomial or polyMatrix-package class object

method

controls the interpretation of the word: "leading", see the details

Value

Returns a matrix by the same size as the polynomial matrix.

Details

The four possible interpretation of the lead for a polynomial matrix are:

  • matrix: the highest matrix coefficient of the polynomial matrix.

  • column: taken the polynomial matrix column-wise, the row vector of the highest coefficient of each column.

  • row: taken the polynomial matrix row-wise, the column vector of the highest coefficient of each row.

  • element: a matrix formed by the highest coefficients of the polynomial elements of the polynomial matrix.

See Also

coefs, degree, const

Examples

Run this code
# NOT RUN {
lead(polynom::polynomial(0:12))
pm <- polyMgen.a()
pa <- polyMconvert(pm,"polyMarray")
pb <- polyMconvert(pm,"polyMbroad")
pc <- polyMconvert(pm,"polyMcells")
pd <- polyMconvert(pm,"polyMdlist")
lead(pa)
lead(pb)
lead(pc)
lead(pd)

rawAdat <- ch2pn(c("-3 + x^2","2 + 4*x","-x^2","1","2","3 + x","2*x","0","2 - 3*x" ))
px <- polyMgen.d(3,3,rawData=rawAdat)

# clean up
# rm(rawAdat)

px

lead(px)
lead(px,method="matrix")
lead(px,method="row")
lead(px,method="column")
lead(px,method="element")

# clean up
# rm(pm, pa, pb, pc, pd, px)
# }

Run the code above in your browser using DataLab