Resumen de ejericios del taller
1.Graficar los puntos \((1,1),(2,4),(3,6),(4,8),(5,25),(6,36),(7,49),(8,61),(9,81),(10,100)\) en un plano utilizando RStudio.
x<-c(1,2,3,4,5,6,7,8,9,10)
y<-c(1,4,9,16,25,36,49,64,81,100)
plot(x,y)
\[A= \left( \begin{array}{ccc} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 3 & 6 & 9 \\ 4 & 8 & 12 \\ \end{array} \right)\]
A<-matrix(c(1,2,3,4,2,4,6,8,3,6,9,12), nrow = 4 , ncol = 3)
A
\[I= \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{array} \right)\]
I<- diag(3)
5.Programación para la matriz nula \[O= \left( \begin{array}{ccc} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \\ \end{array} \right)\]
MN<- function(n){ I<-diag(n);
for(i in 1:n){I[i,i]=0};
return(I)}
MN(4)
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
## [2,] 0 0 0 0
## [3,] 0 0 0 0
## [4,] 0 0 0 0
Otra forma es con la función \(rep()\).
o=rep(0,16)
MN=matrix(o,ncol = 4)
MN
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
## [2,] 0 0 0 0
## [3,] 0 0 0 0
## [4,] 0 0 0 0
B<-diag(4)
B[1,1]=0
B[2,2]=2
B[3,3]=3
B[4,4]=4
B
## [,1] [,2] [,3] [,4]
## [1,] 0 0 0 0
## [2,] 0 2 0 0
## [3,] 0 0 3 0
## [4,] 0 0 0 4
A<-matrix(c(1,2,3,4,2,4,6,8,3,6,9,12), nrow = 4 , ncol = 3)
t(A)
## [,1] [,2] [,3] [,4]
## [1,] 1 2 3 4
## [2,] 2 4 6 8
## [3,] 3 6 9 12
\[ \displaystyle A= \left( \begin{array}{cccc} 1 & 2 & 3& 0 \\ 2 & 4 & 6 &0 \\ 3 & 6 & 9 & 0 \\ 4 & 8 & 12 & 0 \\ \end{array} \right) \qquad B= \left( \begin{array}{cccc} 0 & 2 & 0 & 0 \\ 0 & 0 & 3 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 4 \\ \end{array} \right) \]
A<-matrix(c(1,2,3,4,2,4,6,8,3,6,9,12,0,0,0,0), nrow = 4 , ncol = 4)
B<-matrix(c(0,0,0,0,2,0,0,0,0,3,0,0,0,0,0,4),ncol=4)
(A+B)
## [,1] [,2] [,3] [,4]
## [1,] 1 4 3 0
## [2,] 2 4 9 0
## [3,] 3 6 9 0
## [4,] 4 8 12 4
(A-B)
## [,1] [,2] [,3] [,4]
## [1,] 1 0 3 0
## [2,] 2 4 3 0
## [3,] 3 6 9 0
## [4,] 4 8 12 -4
(3*B)
## [,1] [,2] [,3] [,4]
## [1,] 0 6 0 0
## [2,] 0 0 9 0
## [3,] 0 0 0 0
## [4,] 0 0 0 12
(A%*%B)
## [,1] [,2] [,3] [,4]
## [1,] 0 2 6 0
## [2,] 0 4 12 0
## [3,] 0 6 18 0
## [4,] 0 8 24 0
Nota: \(()\) nos permite visualizar los resultados.
PM<-function(M,n){S=M;
for(i in 2:n){S=S%*%M};
print(S)}
P<-matrix(c(1,-2,1,2,4,0,3,-2,1), ncol=3, nrow=3)
PM(P,6)
## [,1] [,2] [,3]
## [1,] -1792 24 -2824
## [2,] -464 -2416 -1344
## [3,] -648 440 -912
L<-matrix(c(1,-1,2,2,-1,7,-4,5,-3),ncol=3,nrow = 3)
N<-matrix(c(2,4,6,0,3,2,0,0,1),ncol=3,nrow = 3)
solve(L)
## [,1] [,2] [,3]
## [1,] -16.0 -11.0 3.0
## [2,] 3.5 2.5 -0.5
## [3,] -2.5 -1.5 0.5
solve(N)
## [,1] [,2] [,3]
## [1,] 0.5000000 1.850372e-17 0
## [2,] -0.6666667 3.333333e-01 0
## [3,] -1.6666667 -6.666667e-01 1
A=matrix(c(3,9,3,-1,-2,1,1,1,-2), ncol=3,nrow=3)
x<-c(-1,-9,-9)
solve(A,x)
## [1] -1 2 4
Ejercicios
1.) Utilizando la ayuda de R, investigue para que sirve las funciones \(eigen()\) y \(det()\).
2.) Considere las siguientes matrices \[ B= \left( \begin{array}{ccccc} 1 & 2 & 3 & 4 & 5 \\ 2 & 4 & 6 & 8 & 10\\ 3 & 6 & 8 & 12 & 15\\ 4 & 8 & 12 & 16 & 20\\ 5 & 10 & 15 & 20 & 25\\ 6 & 12 & 18 & 24 & 30 \\ 7 & 14 & 21 & 28 & 35\\ 8 & 16 & 24 & 32 & 40\\ 9 & 18 & 27 & 36 & 45\\ 10 & 20 & 30 & 40 & 50\\ \end{array} \right) \qquad \displaystyle A= \left( \begin{array}{ccccc} 0 & 1 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 1\\ 0 & 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 & 1\\ 1 & 0 & 1 & 1 & 0\\ \end{array} \right) \]
Utilice el procedimiento de importar base de datos en RStudio, para calcular \[A\cdot B - AB^t\].
3.)Considere \[\widehat{\beta}= (X^t \cdot X)^{-1} \cdot X^t \cdot Y \]. Determine la matriz \(\widehat{\beta}\)
\[ \displaystyle x= \left( \begin{array}{cc} 1 & -2 \\ 1 & -1 \\ 1 & 0 \\ 1 & 1 \\ 1 & 2 \\ \end{array} \right) \qquad \displaystyle y= \left( \begin{array}{c} 0 \\ 0 \\ 1 \\ 1 \\ 3 \\ \end{array} \right)\]
En la siguiente dirección Web, puedes encontrar el documento del taller https://www.uned.ac.cr/ecen/encuentros/2017/vencuentro/archivos/Talleres/5.%20Mediaci%C3%B3n%20pedag%C3%B3gica%20en%20la%20ense%C3%B1anza%20y%20el%20aprendizaje%20de%20la%20matem%C3%A1tica%20utilizando%20tecnolog%C3%ADa/Implementaci%C3%B3n%20software.pdf
Otro sitio: https://sites.google.com/view/talleresalr/p%C3%A1gina-principal
Hojsgaard, S. (2011). Introduction to linear algebra with R.
Mora, W. (2016). Cómo utilizar R en métodos numéricos. Revista Digital Matemática, 16(1), pp. 1-72.
Santana, J. y Farfán, E.(2014). El arte de programar en R: un lenguaje para la estadística.
Vinod, H. D. (2011). Hands-on matrix algebra using R: Active and motivated learning with applications.
Vinod, H. D. (2014). Matrix Algebra Topics in Statistics and Economics Using R. In Handbook of Statistics, Vol. 32, pp. 143-176.