Mod 6 matrices pt. 2

Daniel Tafmizi

Dr. Friedman

Lis 4370

Module 6

Github: daniel.R/Work.R/LIS4370Rprog/math2.R at main · DanielDataGit/daniel.R (github.com)


> # 1)
> 
> A = matrix(c(2,0,1,3), ncol = 2 ) 
> 
> B = matrix(c(5,2,4,-1), ncol = 2 ) 
>          
> A + B
     [,1] [,2]
[1,]    7    5
[2,]    2    2
> 
> A - B
     [,1] [,2]
[1,]   -3   -3
[2,]   -2    4
> 
> # 2)
> 
> diag(c(4,1,2,3))
     [,1] [,2] [,3] [,4]
[1,]    4    0    0    0
[2,]    0    1    0    0
[3,]    0    0    2    0
[4,]    0    0    0    3
> 
> # 3)
> 
> x = diag(3,5)
> 
> x[1, 2:5] = 1
> 
> x[2:5, 1] = 2
> 
> x
     [,1] [,2] [,3] [,4] [,5]
[1,]    3    1    1    1    1
[2,]    2    3    0    0    0
[3,]    2    0    3    0    0
[4,]    2    0    0    3    0
[5,]    2    0    0    0    3

Comments

Popular posts from this blog

redditApiR

Mod 7 OOP

Description File