Re: [R] matrix exponential: M^0

2004-01-22 Thread Peter Dalgaard
Martin Maechler <[EMAIL PROTECTED]> writes: > The update is actually available online > from http://epubs.siam.org/sam-bin/dbq/article/41801 > with the extended title ", 25 Years Later" . To some, that is. I can download it to the work machine, but if I do it from home, all I get is a ...

Re: [R] matrix exponential: M^0

2004-01-22 Thread David Firth
Prompted by this thread, I have tidied up a Fortran program I wrote with Marina Shapira. We would be happy for this ("mexp") to become part of R, either as a contributed package or as part of the base distribution if it's good enough. I have packaged it and put it at http://www.warwick.ac.uk

Re: [R] matrix exponential: M^0

2004-01-22 Thread Martin Maechler
> "PD" == Peter Dalgaard <[EMAIL PROTECTED]> > on 21 Jan 2004 19:08:38 +0100 writes: PD> Martyn Plummer <[EMAIL PROTECTED]> writes: >> Calculating the matrix exponential is harder than it >> looks (I'm sure Peter knows this). In fact there is a >> classic paper by Moler

Re: [R] matrix exponential: M^0

2004-01-21 Thread Federico Calboli
Dear All, Thanks for all the help. I tried to implement Stephane Dray's suggestion and Erin Hodgess function with the following matrices: > A [,1] [,2] [1,]21 [2,]13 > P [,1] [,2] [,3] [1,]123 [2,]456 [3,]234 > D [,1] [,2] [,3] [1

Re: [R] matrix exponential: M^0

2004-01-21 Thread Peter Dalgaard
Martyn Plummer <[EMAIL PROTECTED]> writes: > Calculating the matrix exponential is harder than it looks (I'm sure > Peter knows this). In fact there is a classic paper by Moler and Van > Loan from the 1970s called "Nineteen dubious ways to calculate the > exponential of a matrix", which they updat

Re: [R] matrix exponential: M^0

2004-01-21 Thread Martyn Plummer
On Tue, 2004-01-20 at 16:58, Peter Dalgaard wrote: > Federico Calboli <[EMAIL PROTECTED]> writes: > > > Dear All, > > > > I would like to ask why the zeroeth power of a matrix gives me a matrix > > of ones rather than the identity matrix: > > Because arithmetic on a matrix works element-wise. M

Re: [R] matrix exponential: M^0

2004-01-20 Thread Duncan Murdoch
On 20 Jan 2004 16:40:07 +, Federico Calboli <[EMAIL PROTECTED]> wrote : >Dear All, > >I would like to ask why the zeroeth power of a matrix gives me a matrix >of ones rather than the identity matrix: R doesn't have a power operator that knows it's working on a matrix. M^x raises each entry o

Re: [R] matrix exponential: M^0

2004-01-20 Thread John Fox
Dear Federico, The common arithmetic operators such as ^ operate on the elements of matrices (or vectors or arrays). Similarly, * gives the element-wise product and not the matrix product. I hope that this helps, John At 04:40 PM 1/20/2004 +, Federico Calboli wrote: Dear All, I would like

RE: [R] matrix exponential: M^0

2004-01-20 Thread Trenkler, Dietrich
> -Original Message- > From: Federico Calboli > Sent: Tuesday, January 20, 2004 5:40 PM > To: r-help > Subject: [R] matrix exponential: M^0 > > I would like to ask why the zeroeth power of a matrix gives me a matrix > of ones rather than the identity matrix: > > > D<-rbind(c(0,0

Re: [R] matrix exponential: M^0

2004-01-20 Thread Stephane DRAY
Hello, be careful D^0 is not the zeroeth power of a matrix. It is a term power :D[i,j]^0=1 To obtain the power of a matrix, you can use a decomposition such as svd: X = U D V' the n-th power of X is X = U D^n V' svd1=svd(D) Apower0=svd1$u%*%diag(svd1$d^0)%*%t(svd1$v) At 11:40 20/01/2004, Federic

Re: [R] matrix exponential: M^0

2004-01-20 Thread Peter Dalgaard
Federico Calboli <[EMAIL PROTECTED]> writes: > Dear All, > > I would like to ask why the zeroeth power of a matrix gives me a matrix > of ones rather than the identity matrix: Because arithmetic on a matrix works element-wise. M^2 is not equal to M %*% M either (but is equal to M*M). (R doesn

Re: [R] matrix exponential: M^0

2004-01-20 Thread Barry Rowlingson
Federico Calboli wrote: Dear All, I would like to ask why the zeroeth power of a matrix gives me a matrix of ones rather than the identity matrix: Because ^0 gives you the zero-th power of the _elements_ of the matrix, not the matrix itself. A matrix of 0^0 is all 1s. Similary, '*' multiplies

Re: [R] matrix exponential: M^0

2004-01-20 Thread Giovanni Petris
elementary operations, like taking a power, act elementwise on vectors and matrices. You may use a spectral decomposition to compute powers of a matrix - or a for loop if you are interested in small integer powers. HTH Giovanni -- __ [

Re: [R] matrix exponential: M^0

2004-01-20 Thread Thomas Lumley
On Tue, 20 Jan 2004, Federico Calboli wrote: > Dear All, > > I would like to ask why the zeroeth power of a matrix gives me a matrix > of ones rather than the identity matrix: Because ^ is not the matrix power. It's the elementwise power. -thomas > > D<-rbind(c(0,0,0),c(0,0,0),c(0,0,0)