Correction TP 2.2

    a=1:20
    x1=matrix(a,nrow=5)
    x2=matrix(a,nrow=5,byrow=T)
    x3=t(x2) Transpose matrix x2
    x1;x2;x3;x4
    b=x3%*%x2
    dim(x1) Display the dimension of matrix x1
    dim(x4)
    b[3,2]
    b[,2]
    b[c(3,4),]
    b[-2,]
    b[,-c(2,4)]
    rbind(x1,x2) Vertical concatenation of matrices x1 and x2
    cbind(x1,x3) Horizontal concatenation of matrices x1 and x3
    apply(x1,2,sum) Compute the sum of x1 column-wise
    apply(x1,1,sum) Compute the sum of x1 row-wise
    mat2=matrix(1:10,3,3,byrow=T)
         det(mat2)
    x=eigen(mat2)
    b=c(10,7,6)
    solve(mat2,b)
           

Modifié le: mardi 28 juin 2022, 23:22