Re: [R] How to define new matrix based on an elementary row oper

2010-09-12 Thread Cuckovic Paik
I appreciate all you help. This is only for instructional purpose: A = matrix(c(0,1,1,-2,-3,1,2,-1,0,2,2,4,1,-3,-2,1,-4,-7,-1,-19), ncol=5, byrow=T) B =matrix(sample(c(0,1,1,-2,-3,1,2,-1,0,2,2,4,1,-3,-2,1,-4,-7,-1,-19),), ncol=5, byrow=T) Which print func( A, B, A+B) can print the resulting

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Ted Harding
On 28-Aug-10 11:27:30, Gabor Grothendieck wrote: On Sat, Aug 28, 2010 at 1:32 AM, Cheng Peng cp...@usm.maine.edu wrote: Sorry for possible misunderstanding: I want to define a matrix (B) based on an existing matrix (A) in a single step and keep A unchanged: #Existing matrix

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Ted Harding
On 28-Aug-10 13:15:47, Cuckovic Paik wrote: Thank all help help. Ted's intuitive single step definition is what I want. I try to teach elementary Linear Algebra using R to manupilate matrices. Since my students have no programming experience at all, any fancy and muliple step definition in

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 10:12 AM, (Ted Harding) wrote: On 28-Aug-10 13:15:47, Cuckovic Paik wrote: Thank all help help. Ted's intuitive single step definition is what I want. I try to teach elementary Linear Algebra using R to manupilate matrices. Since my students have no programming experience

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Cuckovic Paik
Thank you very much, David; for row swapping: R2==R3 A=diag(1:4) A [,1] [,2] [,3] [,4] [1,]1000 [2,]0200 [3,]0030 [4,]0004 A1=A[c(1,3,2,4),] A1 [,1] [,2] [,3] [,4] [1,]1000 [2,]0030 [3,]

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 11:32 AM, Cuckovic Paik wrote: Thank you very much, David; for row swapping: R2==R3 A=diag(1:4) A [,1] [,2] [,3] [,4] [1,]1000 [2,]0200 [3,]0030 [4,]0004 A1=A[c(1,3,2,4),] A1 [,1] [,2] [,3] [,4]