Displaying 4 results from an estimated 4 matches for "malmig".

Did you mean:
malik

2005 Aug 17

2

power of a matrix

Dear all,
I have a population with three age-classes, at time t=0 the population
is:
n.zero <- c(1,0,0)
I have a transition matrix A which denotes "fertility" and "survival":
A <- matrix(c(0,1,5, 0.3,0,0, 0,0.5,0), ncol=3, byrow=TRUE)
To obtain the population at t=1, I calculate:
A %*% n.zero
To obtain the population t=2, I calculate:
A %*% (A %*% n.zero)
... and so

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

2005 Jun 08

2

CRAN task view for genetics

Hello to everyone!
I have built CRAN task view for genetics. For now I have not submit it
to CRAN yet and it can be accessible from:
http://www.bfro.uni-lj.si/MR/ggorjan/software/R/Genetics.html
http://www.bfro.uni-lj.si/MR/ggorjan/software/R/Genetics.ctv
I have not submitted it to CRAN, since I would like first some opinion
about it.

2005 Jun 29

6

x*x*x*... vs x^n

Hi
I have been wondering if there one can speed up calculating small powers
of numbers such as x^8 using multiplication.
In addition, one can be a bit clever and calculate x^8 using only 3
multiplies.
look at this:
> f1 <- function(x){x*x*x*x*x*x*x*x}
> f2 <- function(x){x^8}
> f3 <- function(x){x2 <- x*x;x4 <- x2*x2;return(x4*x4)}
[so f1() and f2() and f3() are