[R] Fw: Problem to create a matrix polynomial

Ben Bolker bbolker at gmail.com
Thu Oct 14 23:39:39 CEST 2010


Ron Michael <ron_michael70 <at> yahoo.com> writes:

> 
> Awaiting some suggestion. Was my question not very understandable? 
> Please let me know how can I offer more
> elaborate clarification.
> Additionally, I would like to solve the determinant of "p1"
>  for the values of "z" (I am working with some
> multivariate time series modelling). When I use det()
>  function, it am getting error that, that function
> is not for objects with class polynomial.
> Any idea please?
> Thanks,

  Well, the description of the PolynomF package says
"Implements univariate polynomial operations in R", so I'm
not quite sure why you'd expect it to work for matrices ...
I'm also not sure what you're trying to do: find roots
of matrix equations? Is the expm package at all helpful?
What tools do other people in your field use to solve
similar problems?  R is not in general a great tool for
symbolic manipulations, even though there are little corners
where people have implemented such capabilities.  Have
you looked at symbolic toolboxes such as Sage, Maxima, PARI
(or commercial packages) ... ?


> 
> --- On Wed, 13/10/10, Ron_M <ron_michael70 <at> yahoo.com> wrote:
> 
> 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?



More information about the R-help mailing list