Skip to content

Problem to create a matrix polynomial

1 message · Ron Michael

#
Dear all R users, I was trying to create a polymonial using the polynom() of
"PolynomF" package. My problem is, if I pass coefficients as simple
numerical values, it is working, but for matrix coefficient it is not. Here
is my try:

library(PolynomF)
z <- polynom()

## following is working
p1 <- 1- 4.5*z

## However following is not giving results as intended
p1 <- diag(3)- matrix(1:9, 3,3)*z

In the 2nd example, I was expecting a matrix polynomial in "z" upto degree
1, which I did not get. Can anyone please correct me how to address this
problem?

Thanks,