search for: exponentiation_by_squar

Displaying 3 results from an estimated 3 matches for "exponentiation_by_squar".

2011 Feb 01
2
better way to iterate matrix multiplication?
I'm simulating a Markov process using a vector of proportions. Each value in the vector represents the proportion of the population who are in a particular state (so the vector sums to 1). I have a square matrix of transition probabilities, and for each tick of the Markov clock the vector is multiplied by the transition matrix. To illustrate the sort of thing I mean: pm <-
2008 May 06
5
How do I write a sum of matrixes??
Hello best helpers, I am a new user and I have been struggling for hours. So finally I decide to ask you: If I have a matrix P, and P.2 = P%*%P, and P.3=P.2%*%P is there a function to calculate the power of a matrix?? if not how can i do: for (i in 1:10) {P.i=P^i} after this I need to sum them up and my problem is to combine P and i to P.i can anyone help me please??? Thanks and have a nice
2007 May 06
7
A function for raising a matrix to a power?
Hi, Is there a function for raising a matrix to a power? For example if you like to compute A%*%A%*%A, is there an abbreviation similar to A^3? Atte Tenkanen > A=rbind(c(1,1),c(-1,-2)) > A [,1] [,2] [1,] 1 1 [2,] -1 -2 > A^3 [,1] [,2] [1,] 1 1 [2,] -1 -8 But: > A%*%A%*%A [,1] [,2] [1,] 1 2 [2,] -2 -5