Hello, I am new to R and I am having trouble adding an exponent to my problem. For instance, > mat5 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T)> mat6 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T) > mat5%^%2Error: could not find function "%^%" I unsure on weather I should square mat5 or use the two mats and square them both. I really need some help. Thanks, Abram Sent from Mail for Windows 10 [[alternative HTML version deleted]]
> On Dec 31, 2015, at 11:16 AM, Abram Wooten via R-help <r-help at r-project.org> wrote: > > Hello, > > I am new to R and I am having trouble adding an exponent to my problem. For instance, >> mat5 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T) >> mat6 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T) >> mat5%^%2 > Error: could not find function "%^%"The package expm provides matrix exponentials. I think that package Matrix has the same capability, although its help page says that expm::expm is likely to be faster. -- David> > I unsure on weather I should square mat5 or use the two mats and square them both. I really need some help. > > Thanks, > Abram > Sent from Mail for Windows 10 > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.David Winsemius Alameda, CA, USA
> On Dec 31, 2015, at 1:12 PM, David Winsemius <dwinsemius at comcast.net> wrote: > >> >> On Dec 31, 2015, at 11:16 AM, Abram Wooten via R-help <r-help at r-project.org> wrote: >> >> Hello, >> >> I am new to R and I am having trouble adding an exponent to my problem. For instance, >>> mat5 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T) >>> mat6 <-matrix(c(0.5,0.5,0.25,0.75),2,byrow=T) >>> mat5%^%2 >> Error: could not find function "%^%" > > The package expm provides matrix exponentials. I think that package Matrix has the same capability, although its help page says that expm::expm is likely to be faster.And I think I may have conflated matrix power function with matrix exponential. Nonetheless, one can also get a `matpow` function from the same package: ?expm::`%^%` # returns page for matpow {expm}> > -- > David >> >> I unsure on weather I should square mat5 or use the two mats and square them both. I really need some help. >> >> Thanks, >> Abram >> Sent from Mail for Windows 10 >>David Winsemius Alameda, CA, USA