[R] Questions about Matrix

Erich Neuwirth erich.neuwirth at univie.ac.at
Tue Feb 17 01:16:50 CET 2004


whatisit<-function(t,m,n) outer(0:t,1:m,function(x,y)(x-y)^n)

 > whatisit(3,2,4)
      [,1] [,2]
[1,]    1   16
[2,]    0    1
[3,]    1    0
[4,]   16    1



Yao, Minghua wrote:

> M <- matrix(0, t+1, m)
> for (i in 1:(t+1))
>   for(j in 1:m)
>     M[i,j] <- (i-1-j)^n
> 
> 
> ________________________________
> 
> From: r-help-bounces+myao=ou.edu at stat.math.ethz.ch on behalf of duoduo chen
> Sent: Mon 2/16/2004 2:41 PM
> To: R-help at stat.math.ethz.ch
> Subject: [R] Questions about Matrix
> 
> 
> 
> How to Generate the Matrix (t+1)*m ?
> 
> (0-1)^n   (0-2)^n  ,,,,    (0-m)^n
> (1-1)^n   (1-2)^n  ,,,,    (1-m)^n
> (2-1)^n   (2-2)^n  ,,,,    (2-m)^n
>    ..           ...     ,,,,     .......
> (t-1)^n    (t-2)^n   ,,,,    (t-m)^n 
> 
> 
> Appreciate your kindly help!
> 
> 
> 
> ---------------------------------
> 
> 
>         [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386




More information about the R-help mailing list