Matriz = read.csv("C:/Users/usuario/Music/2001394.csv")
MatrizExcel = as.matrix(Matriz)
library("MASS")
as.fractions(MatrizExcel)
## X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
## [1,] -5 2 3 1 -6 4 -5 -7 -2 -2
## [2,] 0 8 6 7 -8 -1 3 3 7 4
## [3,] -8 -6 0 -2 -3 -3 -6 7 -6 6
## [4,] 2 3 1 8 -1 2 -6 -4 -7 -2
## [5,] -6 3 5 4 5 8 -2 5 5 4
## [6,] -7 5 1 5 6 2 6 8 -7 -6
## [7,] -5 5 -4 -6 2 -8 8 4 -7 3
## [8,] 2 2 -2 -7 -1 -1 5 -7 6 6
## [9,] -3 1 -3 4 1 -7 -3 1 -2 7
## [10,] 8 -7 -8 4 8 6 -4 6 -2 -1
colnames(MatrizExcel) <- c("gas de refinería" , "éter de petroleo" , "gaslina" , "queroseno" , "gasóleo" , "aceite" , "lubricante" , "cera" , "fuel" , "asfalto")
rownames(MatrizExcel) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
library("MASS")
as.fractions(MatrizExcel)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 01/04 -5 2 3 1 -6 4
## 02/04 0 8 6 7 -8 -1
## 03/04 -8 -6 0 -2 -3 -3
## 04/04 2 3 1 8 -1 2
## 05/04 -6 3 5 4 5 8
## 06/04 -7 5 1 5 6 2
## 07/04 -5 5 -4 -6 2 -8
## 08/04 2 2 -2 -7 -1 -1
## 09/04 -3 1 -3 4 1 -7
## 10/04 8 -7 -8 4 8 6
## lubricante cera fuel asfalto
## 01/04 -5 -7 -2 -2
## 02/04 3 3 7 4
## 03/04 -6 7 -6 6
## 04/04 -6 -4 -7 -2
## 05/04 -2 5 5 4
## 06/04 6 8 -7 -6
## 07/04 8 4 -7 3
## 08/04 5 -7 6 6
## 09/04 -3 1 -2 7
## 10/04 -4 6 -2 -1
MatrizProducción= MatrizExcel + 7
library("MASS")
as.fractions(MatrizProducción)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 01/04 2 9 10 8 1 11
## 02/04 7 15 13 14 -1 6
## 03/04 -1 1 7 5 4 4
## 04/04 9 10 8 15 6 9
## 05/04 1 10 12 11 12 15
## 06/04 0 12 8 12 13 9
## 07/04 2 12 3 1 9 -1
## 08/04 9 9 5 0 6 6
## 09/04 4 8 4 11 8 0
## 10/04 15 0 -1 11 15 13
## lubricante cera fuel asfalto
## 01/04 2 0 5 5
## 02/04 10 10 14 11
## 03/04 1 14 1 13
## 04/04 1 3 0 5
## 05/04 5 12 12 11
## 06/04 13 15 0 1
## 07/04 15 11 0 10
## 08/04 12 0 13 13
## 09/04 4 8 5 14
## 10/04 3 13 5 6
rownames(MatrizProducción) <- c("11/04" , "12/04" , "13/04" , "14/04" , "15/04" , "16/04" , "17/04" , "18/04" , "19/04" , "20/04")
library("MASS")
as.fractions(MatrizProducción)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 11/04 2 9 10 8 1 11
## 12/04 7 15 13 14 -1 6
## 13/04 -1 1 7 5 4 4
## 14/04 9 10 8 15 6 9
## 15/04 1 10 12 11 12 15
## 16/04 0 12 8 12 13 9
## 17/04 2 12 3 1 9 -1
## 18/04 9 9 5 0 6 6
## 19/04 4 8 4 11 8 0
## 20/04 15 0 -1 11 15 13
## lubricante cera fuel asfalto
## 11/04 2 0 5 5
## 12/04 10 10 14 11
## 13/04 1 14 1 13
## 14/04 1 3 0 5
## 15/04 5 12 12 11
## 16/04 13 15 0 1
## 17/04 15 11 0 10
## 18/04 12 0 13 13
## 19/04 4 8 5 14
## 20/04 3 13 5 6
MatrizProductoA = MatrizProducción * 3/2
library("MASS")
as.fractions(MatrizProductoA)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 11/04 3 27/2 15 12 3/2 33/2
## 12/04 21/2 45/2 39/2 21 -3/2 9
## 13/04 -3/2 3/2 21/2 15/2 6 6
## 14/04 27/2 15 12 45/2 9 27/2
## 15/04 3/2 15 18 33/2 18 45/2
## 16/04 0 18 12 18 39/2 27/2
## 17/04 3 18 9/2 3/2 27/2 -3/2
## 18/04 27/2 27/2 15/2 0 9 9
## 19/04 6 12 6 33/2 12 0
## 20/04 45/2 0 -3/2 33/2 45/2 39/2
## lubricante cera fuel asfalto
## 11/04 3 0 15/2 15/2
## 12/04 15 15 21 33/2
## 13/04 3/2 21 3/2 39/2
## 14/04 3/2 9/2 0 15/2
## 15/04 15/2 18 18 33/2
## 16/04 39/2 45/2 0 3/2
## 17/04 45/2 33/2 0 15
## 18/04 18 0 39/2 39/2
## 19/04 6 12 15/2 21
## 20/04 9/2 39/2 15/2 9
MatrizProductoB = MatrizProductoA * 2/3
library("MASS")
as.fractions(MatrizProductoB)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 11/04 2 9 10 8 1 11
## 12/04 7 15 13 14 -1 6
## 13/04 -1 1 7 5 4 4
## 14/04 9 10 8 15 6 9
## 15/04 1 10 12 11 12 15
## 16/04 0 12 8 12 13 9
## 17/04 2 12 3 1 9 -1
## 18/04 9 9 5 0 6 6
## 19/04 4 8 4 11 8 0
## 20/04 15 0 -1 11 15 13
## lubricante cera fuel asfalto
## 11/04 2 0 5 5
## 12/04 10 10 14 11
## 13/04 1 14 1 13
## 14/04 1 3 0 5
## 15/04 5 12 12 11
## 16/04 13 15 0 1
## 17/04 15 11 0 10
## 18/04 12 0 13 13
## 19/04 4 8 5 14
## 20/04 3 13 5 6
MatrizSumaB = MatrizProductoB - 7
library("MASS")
as.fractions(MatrizSumaB)
## gas de refinería éter de petroleo gaslina queroseno gasóleo aceite
## 11/04 -5 2 3 1 -6 4
## 12/04 0 8 6 7 -8 -1
## 13/04 -8 -6 0 -2 -3 -3
## 14/04 2 3 1 8 -1 2
## 15/04 -6 3 5 4 5 8
## 16/04 -7 5 1 5 6 2
## 17/04 -5 5 -4 -6 2 -8
## 18/04 2 2 -2 -7 -1 -1
## 19/04 -3 1 -3 4 1 -7
## 20/04 8 -7 -8 4 8 6
## lubricante cera fuel asfalto
## 11/04 -5 -7 -2 -2
## 12/04 3 3 7 4
## 13/04 -6 7 -6 6
## 14/04 -6 -4 -7 -2
## 15/04 -2 5 5 4
## 16/04 6 8 -7 -6
## 17/04 8 4 -7 3
## 18/04 5 -7 6 6
## 19/04 -3 1 -2 7
## 20/04 -4 6 -2 -1
TMatriz = t(MatrizExcel)
library("MASS")
as.fractions(TMatriz)
## 01/04 02/04 03/04 04/04 05/04 06/04 07/04 08/04 09/04 10/04
## gas de refinería -5 0 -8 2 -6 -7 -5 2 -3 8
## éter de petroleo 2 8 -6 3 3 5 5 2 1 -7
## gaslina 3 6 0 1 5 1 -4 -2 -3 -8
## queroseno 1 7 -2 8 4 5 -6 -7 4 4
## gasóleo -6 -8 -3 -1 5 6 2 -1 1 8
## aceite 4 -1 -3 2 8 2 -8 -1 -7 6
## lubricante -5 3 -6 -6 -2 6 8 5 -3 -4
## cera -7 3 7 -4 5 8 4 -7 1 6
## fuel -2 7 -6 -7 5 -7 -7 6 -2 -2
## asfalto -2 4 6 -2 4 -6 3 6 7 -1
detMatrizOriginal = det(MatrizExcel)
library("MASS")
as.fractions(detMatrizOriginal)
## [1] 10948126412
detMatrizTraspuesta = det(TMatriz)
library("MASS")
as.fractions(detMatrizTraspuesta)
## [1] 10948126412
MatrizInversa = solve(MatrizExcel)
library("MASS")
as.fractions(MatrizInversa)
## 01/04 02/04 03/04
## gas de refinería -36967/437525 193737/13712119 -5211/2111311
## éter de petroleo 182662748/1827794661 2586/102241 -50741/393977
## gaslina -38911/213697 -5749/165151 1054/14595
## queroseno -2758/90103 1427029/61359657 244495/5645519
## gasóleo -857/11370 -105118/1488105 -24563/690286
## aceite 4309/108730 26279/1160254 1236/28615
## lubricante -4102/46183 5221/275854 111080/1091277
## cera 563/31405 2380/61477 -6581/345961
## fuel 1215215/17618237 953/86111 -9269/112896
## asfalto -340/4169 145/11402 871/9197
## 04/04 05/04 06/04
## gas de refinería 15629/186564 10894644/962137835 -809475/12305362
## éter de petroleo -1403/61394 1168919/12072562 -320318/1985585
## gaslina 1423/10893 36511/1245216 37355/2071884
## queroseno 631/29389 -22900/330997 47840/347641
## gasóleo 13488/436153 350341/5979368 -75/7994
## aceite 537/20026 10099/879130 1419/34264
## lubricante 1198/26913 -2708/28361 1283/6637
## cera -301/7136 627469/16308002 -1792/23241
## fuel -27078/219263 1185864/51990385 -1903/38224
## asfalto 9643/101398 33833/5338606 14183/306089
## 07/04 08/04 09/04
## gas de refinería 247224/6543779 -1733/112438 -1486/20647
## éter de petroleo 2024/9819 -8942/52209 -721/61441
## gaslina -111910/1481641 67569/1530419 -13113/161146
## queroseno -42369/300467 473/4365 115539/1607279
## gasóleo -35052347/6062804717 -33250/2196703 23483/914363
## aceite -3131/327042 76969/896473 -732/11489
## lubricante -43885/291396 22469/102813 -1196/72835
## cera 1231/12748 -6445/55567 -19396/522199
## fuel 504/38701 -406/4801 30019/482258
## asfalto -481/9935 210814/1415321 -309/22735
## 10/04
## gas de refinería 0
## éter de petroleo 23137/607385
## gaslina -408147/3258965
## queroseno -98/105027
## gasóleo -29958/667399
## aceite 30839/563048
## lubricante -2065/92858
## cera 25675/649378
## fuel 49645/2750566
## asfalto -487/66364
MatrizdeComprobación = MatrizExcel %*% MatrizInversa
library("MASS")
as.fractions(MatrizdeComprobación)
## 01/04 02/04 03/04 04/04 05/04 06/04 07/04 08/04 09/04 10/04
## 01/04 1 0 0 0 0 0 0 0 0 0
## 02/04 0 1 0 0 0 0 0 0 0 0
## 03/04 0 0 1 0 0 0 0 0 0 0
## 04/04 0 0 0 1 0 0 0 0 0 0
## 05/04 0 0 0 0 1 0 0 0 0 0
## 06/04 0 0 0 0 0 1 0 0 0 0
## 07/04 0 0 0 0 0 0 1 0 0 0
## 08/04 0 0 0 0 0 0 0 1 0 0
## 09/04 0 0 0 0 0 0 0 0 1 0
## 10/04 0 0 0 0 0 0 0 0 0 1
vectorcolumna = matrix(c(19,16,24,10,39,13,21,7,35,12), nrow = 10, ncol = 1)
library("MASS")
as.fractions(vectorcolumna)
## [,1]
## [1,] 19
## [2,] 16
## [3,] 24
## [4,] 10
## [5,] 39
## [6,] 13
## [7,] 21
## [8,] 7
## [9,] 35
## [10,] 12
colnames(vectorcolumna) <- c("Derivados")
rownames(vectorcolumna) <- c("gas de refinería" , "éter de petroleo" , "gaslina" , "queroseno" , "gasóleo" , "aceite" , "lubricante" , "cera" , "fuel" , "asfalto")
library("MASS")
as.fractions(vectorcolumna)
## Derivados
## gas de refinería 19
## éter de petroleo 16
## gaslina 24
## queroseno 10
## gasóleo 39
## aceite 13
## lubricante 21
## cera 7
## fuel 35
## asfalto 12
MatrizIngreso = MatrizExcel %*% vectorcolumna
library("MASS")
as.fractions(MatrizIngreso)
## Derivados
## 01/04 -411
## 02/04 394
## 03/04 -639
## 04/04 -246
## 05/04 609
## 06/04 146
## 07/04 -210
## 08/04 238
## 09/04 -167
## 10/04 154
gasrefinería = matrix(c(-5,0,-8,2,-6,-7,-5,2,-3,8), nrow = 10, ncol = 1)
rownames(gasrefinería) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
éter = matrix(c(2,8,-6,3,3,5,5,2,1,-7), nrow = 10, ncol = 1)
rownames(éter) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
gasolina = matrix(c(3,6,0,1,5,1,-4,-2,-3,-8), nrow = 10, ncol = 1)
rownames(gasolina) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
queroseno = matrix(c(1,7,-2,8,4,5,-6,-7,4,4), nrow = 10, ncol = 1)
rownames(queroseno) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
gasóleo = matrix(c(-6,-8,-3,-1,5,6,2,-1,1,8), nrow = 10, ncol = 1)
rownames(gasóleo) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
aceite = matrix(c(4,-18,-3,2,8,2,-8,-1,-7,6), nrow = 10, ncol = 1)
rownames(aceite) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
lubricante = matrix(c(-5,3,-6,-6,-2,6,8,5,-3,-4), nrow = 10, ncol = 1)
rownames(lubricante) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
cera = matrix(c(-7,3,7,-4,5,8,4,-7,1,6), nrow = 10, ncol = 1)
rownames(cera) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
fuel = matrix(c(-2,7,-6,-7,5,-7,-7,6,-2,-2), nrow = 10, ncol = 1)
rownames(fuel) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
asfalto = matrix(c(-2,4,6,-2,4,-6,3,6,7,-1), nrow = 10, ncol = 1)
rownames(asfalto) <- c("01/04" , "02/04" , "03/04" , "04/04" , "05/04" , "06/04" , "07/04" , "08/04" , "09/04" , "10/04")
Ingresogasrefinería = gasrefinería * 19
library("MASS")
as.fractions(Ingresogasrefinería)
## [,1]
## 01/04 -95
## 02/04 0
## 03/04 -152
## 04/04 38
## 05/04 -114
## 06/04 -133
## 07/04 -95
## 08/04 38
## 09/04 -57
## 10/04 152
Ingresoéter = éter * 16
library("MASS")
as.fractions(Ingresoéter)
## [,1]
## 01/04 32
## 02/04 128
## 03/04 -96
## 04/04 48
## 05/04 48
## 06/04 80
## 07/04 80
## 08/04 32
## 09/04 16
## 10/04 -112
Ingresogasolina = gasolina * 24
library("MASS")
as.fractions(Ingresogasolina )
## [,1]
## 01/04 72
## 02/04 144
## 03/04 0
## 04/04 24
## 05/04 120
## 06/04 24
## 07/04 -96
## 08/04 -48
## 09/04 -72
## 10/04 -192
Ingresoqueroseno = queroseno * 10
library("MASS")
as.fractions(Ingresoqueroseno )
## [,1]
## 01/04 10
## 02/04 70
## 03/04 -20
## 04/04 80
## 05/04 40
## 06/04 50
## 07/04 -60
## 08/04 -70
## 09/04 40
## 10/04 40
Ingresogasóleo = gasóleo * 39
library("MASS")
as.fractions(Ingresogasóleo)
## [,1]
## 01/04 -234
## 02/04 -312
## 03/04 -117
## 04/04 -39
## 05/04 195
## 06/04 234
## 07/04 78
## 08/04 -39
## 09/04 39
## 10/04 312
Ingresoaceite = aceite * 13
library("MASS")
as.fractions(Ingresoaceite)
## [,1]
## 01/04 52
## 02/04 -234
## 03/04 -39
## 04/04 26
## 05/04 104
## 06/04 26
## 07/04 -104
## 08/04 -13
## 09/04 -91
## 10/04 78
Ingresolubricante = lubricante *21
library("MASS")
as.fractions(Ingresolubricante)
## [,1]
## 01/04 -105
## 02/04 63
## 03/04 -126
## 04/04 -126
## 05/04 -42
## 06/04 126
## 07/04 168
## 08/04 105
## 09/04 -63
## 10/04 -84
Ingresocera = cera *7
library("MASS")
as.fractions(Ingresocera)
## [,1]
## 01/04 -49
## 02/04 21
## 03/04 49
## 04/04 -28
## 05/04 35
## 06/04 56
## 07/04 28
## 08/04 -49
## 09/04 7
## 10/04 42
Ingresofuel = fuel * 35
library("MASS")
as.fractions(Ingresofuel)
## [,1]
## 01/04 -70
## 02/04 245
## 03/04 -210
## 04/04 -245
## 05/04 175
## 06/04 -245
## 07/04 -245
## 08/04 210
## 09/04 -70
## 10/04 -70
Ingresoasfalto = asfalto *12
library("MASS")
as.fractions(Ingresoasfalto)
## [,1]
## 01/04 -24
## 02/04 48
## 03/04 72
## 04/04 -24
## 05/04 48
## 06/04 -72
## 07/04 36
## 08/04 72
## 09/04 84
## 10/04 -12