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, --- On Wed, 13/10/10, Ron_M <ron_michael70@yahoo.com> wrote: From: Ron_M <ron_michael70@yahoo.com> Subject: [R] Problem to create a matrix polynomial To: r-help@r-project.org Date: Wednesday, 13 October, 2010, 4:31 PM 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, -- View this message in context: http://r.789695.n4.nabble.com/Problem-to-create-a-matrix-polynomial-tp2993411p2993411.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
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?