You are on page 1of 8

Print["NOMBRE DEL ALGORITMO"]

Print"PASO 1: ASIGNACIN DE DIMENSIONES DE LAS MATRICES A, B, C, D y E"


Print["A(n x n)\nB(n x m)\nC(p x n)\nD(p x m)\nE(n x n)"]
Print["Asigne el valor numrico de n"]
With{rows = 1, cols = 1, fieldSize = 3}, Manipulate
Column[{TableForm @ mat}], {mat, None}, {initialized, None}, Dynamic[n = mat],
Evaluate @ With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex},
InputField[Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

Print["Asigne el valor numrico de m"]


With{rows = 1, cols = 1, fieldSize = 3}, Manipulate
Column[{TableForm @ mat}], {mat, None}, {initialized, None}, Dynamic[m = mat],
Evaluate @ With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex},
InputField[Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

Print["Asigne el valor numrico de p"]


With{rows = 1, cols = 1, fieldSize = 3}, Manipulate
Column[{TableForm @ mat}], {mat, None}, {initialized, None}, Dynamic[p = mat],
Evaluate @ With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex},
InputField[Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

NOMBRE DEL ALGORITMO

PASO 1: ASIGNACIN DE DIMENSIONES DE LAS MATRICES A, B, C, D y E

A(n x n)
B(n x m)
C(p x n)
D(p x m)
E(n x n)

Asigne el valor numrico de n


2 MolinariRetardadoV2.nb

{{1}}

Asigne el valor numrico de m

{{2}}

Asigne el valor numrico de p

{{3}}

Print"PASO 2: ASIGNACIN DE LOS ELEMENTOS DE LAS MATRICES A, B, C, D y E"


Print["Nota: la variacion del retardo se representa con la letra s (ese)"]
Print["MATRIZ A"]
With{rows = n[[1, 1]], cols = n[[1, 1]], fieldSize = 6}, Manipulate
Column[{TableForm @ mat}], {mat, None}, {initialized, None}, Dynamic[A = mat],
Evaluate @ With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex},
InputField[Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

Print["MATRIZ B"]
With{rows = n[[1, 1]], cols = m[[1, 1]], fieldSize = 6}, Manipulate
Column[{TableForm @ mat}], {mat, None}, {initialized, None}, Dynamic[B = mat],
Evaluate @ With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex},
InputField[Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
MolinariRetardadoV2.nb 3

initialized = True, SaveDefinitions True

Print["MATRIZ C"]
With{rows = p[[1, 1]], cols = n[[1, 1]], fieldSize = 6},
ManipulateColumn[{TableForm @ mat}], {mat, None},
{initialized, None}, Dynamic[G0 = mat], Evaluate @
With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex}, InputField[
Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

Print["MATRIZ D"]
With{rows = p[[1, 1]], cols = m[[1, 1]], fieldSize = 6},
ManipulateColumn[{TableForm @ mat}], {mat, None},
{initialized, None}, Dynamic[F0 = mat], Evaluate @
With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex}, InputField[
Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

Print["MATRIZ E"]
With{rows = n[[1, 1]], cols = n[[1, 1]], fieldSize = 6},
ManipulateColumn[{TableForm @ mat}], {mat, None},
{initialized, None}, Dynamic[EE = mat], Evaluate @
With[{makeRow = Function[{rowIndex}, Map[Function[{colIndex}, InputField[
Dynamic[mat[[rowIndex, colIndex]]], FieldSize fieldSize]],
Range[cols]], HoldAll]}, Grid[Map[makeRow, Range[rows]]]],
Initialization If[Not[initialized === True], mat = Table[0, {rows}, {cols}]];
initialized = True, SaveDefinitions True

PASO 2: ASIGNACIN DE LOS ELEMENTOS DE LAS MATRICES A, B, C, D y E

Nota: la variacion del retardo se representa con la letra s (ese)

MATRIZ A

{{0}}

MATRIZ B
4 MolinariRetardadoV2.nb

{{0, 0}}

0 0

0 0

MATRIZ C

{{0}, {0}, {0}}

0
0
0

MATRIZ D

{{0, 0}, {0, 0}, {0, 0}}

0 0

0 0

0 0

0 0
0 0
0 0

MATRIZ E

{{0}}

<< PolynomialMatrices`
Print"PASO 3: CLCULO Y RESULTADOS"
MolinariRetardadoV2.nb 5

MatrixForm /@ {GFDZd[1], T[1]} = ExtendedHermiteForm[F0]; (* Hermitiana a D,


obteniendo lado der. de matriz concatenada GFDZ y matriz T1 *)
F[1] = GFDZd[1][[1 ;; Rank[F0], 1 ;; All]];
(* Matriz F1 obtenida del lado der. de GFDZ,
con #filas dependiendo del rango de F0;
el #columnas es el mismo del lado derecho de GFDZ*)
ZGFDZ[1] = Drop[GFDZd[1], {1, Rank[F0]}];
(* Separa matriz de ceros del lado der. de GFZD,
eliminando el #filas correspondiente al rango de F0 *)

GFDZi[1] = T[1].G0;(* Genera lado izq. de matriz GFDZ *)


G[1] = GFDZi[1][[1 ;; Rank[F0], 1 ;; All]];
(* Matriz G1 obtenida del lado izq. de GFDZ,
con #filas dependiendo del rango de F0 o de filas de F1;
el #columnas es el mismo del lado izq. de GFDZ *)
De[1] = Drop[GFDZi[1], {1, Rank[F0]}];
(* Separa la matriz Delta1 del lado. izq. de GFZD
eliminando las primeras filas hasta el valor del rango de F0 *)

IN = - 1 * IdentityMatrix[Part[Dimensions[EE], 1]];
(* Genera matriz identidad negativa con las dimensiones de matriz E *)
ZIEZN[1] = ConstantArray[0, {Part[Dimensions[De[1]], 1], Part[Dimensions[IN], 2]}];
(* Genera matriz ceros con #filas de
Delta1 y #columnas matriz identidad negativa*)
MatrixForm /@ {JRHZd[1], S[1]} = ExtendedHermiteForm[Join[EE, De[1]]];
(*Hermitiana a la union de matriz E y Delta1,
obteniendo parte der. de matriz concatenada JRHZ y matriz S1 *)
R[1] = JRHZd[1][[1 ;; Rank[Join[EE, De[1]]], 1 ;; All]];
(* Matriz R1 a partir del lado der. de JRHZ, con #filas del rango de la
concatenacion de E y Delta1 y #columnas igual al lado der. de JRHZ *)
ZJRHZ[1] = Drop[JRHZd[1], {1, Rank[Join[EE, De[1]]]}];
(* Separa matriz ceros del lado derecho de JRHZ,
eliminando las primeras filas del lado der. de JRHZ hasta
el valor del rango de la union de las matrices E y Delta1 *)
JRHZi[1] = S[1].Join[IN, ZIEZN[1]]; (* Genera lado izq. de matriz JRHZ,
multiplicando matriz S1 por la union de las matrices identidad
negativa y la matriz de ceros de la matriz concatenada IEZN *)
J[1] = JRHZi[1][[1 ;; Rank[Join[EE, De[1]]], 1 ;; All]];
(* Genera matriz J1 a partir del lado izq. de matriz JRHZ,
con #filas del valor del rango de la union del lado derecho de la matriz IEZN *)
H[1] = Drop[JRHZi[1], {1, Rank[Join[EE, De[1]]]}];(* Genera H1,
eliminando las primeras filas del lado izq. de matriz JRHZ hasta
6 MolinariRetardadoV2.nb

el valor del rango de la union del lado der. de la matriz IEZN *)


Na[1] = De[1]; (* Se renombra a la matriz Delta1 como Na1 *)
SimplifyMatrixForm /@ {M[1], U[1], V[1]} = ExtendedSmithForm[Na[1], s];
(* Se aplica Matriz de Smith a Na1, obteniendo M1 *)
Print[1]; (* Imprime numero 1 *)
Print[De[1]]; (* Imprime matriz De1 *)
Print[Diagonal[M[1]]]; (* Imprime diagonal de M1 *)
Print[M[1]]; (*Imprime matriz M1 *)

HHGFd[2] = Join[H[1].B, F[1]];


MatrixForm /@ {GFDZd[2], T[2]} = ExtendedHermiteForm[HHGFd[2]];
F[2] = GFDZd[2][[1 ;; Rank[HHGFd[2]], 1 ;; All]];
ZGFDZ[2] = Simplify[Drop[GFDZd[2], {1, Rank[HHGFd[2]]}]];
GFDZi[2] = Simplify[T[2].Join[H[1].A, G[1]]];
G[2] = Simplify[GFDZi[2][[1 ;; Rank[HHGFd[2]], 1 ;; All]]];
De[2] = Simplify[Drop[GFDZi[2], {1, Rank[HHGFd[2]]}]];

ZIEZN[2] = ConstantArray[0, {Part[Dimensions[De[2]], 1], Part[Dimensions[IN], 2]}];


MatrixForm /@ {JRHZd[2], S[2]} = ExtendedHermiteForm[Join[EE, De[2]]];
R[2] = JRHZd[2][[1 ;; Rank[Join[EE, De[2]]], 1 ;; All]];
ZJRHZ[2] = Drop[JRHZd[2], {1, Rank[Join[EE, De[2]]]}];
JRHZi[2] = S[2].Join[IN, ZIEZN[2]];
J[2] = JRHZi[2][[1 ;; Rank[Join[EE, De[2]]], 1 ;; All]];
H[2] = Drop[JRHZi[2], {1, Rank[Join[EE, De[2]]]}];
Na[2] = Join[De[1], De[2]];
SimplifyMatrixForm /@ {M[2], U[2], V[2]} = ExtendedSmithForm[Na[2], s];
Print[2];
Print[De[2]];
Print[Diagonal[M[2]]];
Print[M[2]];

k = 3;
While[True, If[Diagonal[M[k - 1]] == Diagonal[M[k - 2]], Break[]];
Print[k];
HHGFd[k] = Join[H[k - 1].B, F[k - 1]];
MatrixForm /@ ({GFDZd[k], T[k]} = ExtendedHermiteForm[HHGFd[k]]);
F[k] = GFDZd[k][[1 ;; Rank[Join[H[k - 1].B, F[k - 1]]], 1 ;; All]];
ZGFDZ[k] = Simplify[Drop[GFDZd[k], {1, Rank[HHGFd[k]]}]];
GFDZi[k] = Simplify[T[k].Join[H[k - 1].A, G[k - 1]]];
G[k] = Simplify[GFDZi[k][[1 ;; Rank[HHGFd[k]], 1 ;; All]]];
De[k] = Simplify[Drop[GFDZi[k], {1, Rank[HHGFd[k]]}]];
MolinariRetardadoV2.nb 7

ZIEZN[k] =
ConstantArray[0, {Part[Dimensions[De[k]], 1], Part[Dimensions[IN], 2]}];
MatrixForm /@ ({JRHZd[k], S[k]} = ExtendedHermiteForm[Join[EE, De[k]]]);
R[k] = JRHZd[k][[1 ;; Rank[Join[EE, De[k]]], 1 ;; All]];
ZJRHZ[k] = Drop[JRHZd[k], {1, Rank[Join[EE, De[k]]]}];
JRHZi[k] = S[k].Join[IN, ZIEZN[k]];
J[k] = JRHZi[k][[1 ;; Rank[Join[EE, De[k]]], 1 ;; All]];
H[k] = Drop[JRHZi[k], {1, Rank[Join[EE, De[k]]]}];

For[i = 1, i k - 1, i ++, Arr = ArrayFlatten[Array[De, i], 1]];


Simplify[
MatrixForm /@ ({M[k], U[k], V[k]} = ExtendedSmithForm[Join[Arr, De[k]], s])];
Print[De[k]]; Print[Diagonal[M[k]]]; Print[M[k]]; k ++]
Print["RESULTADO"]
Print["k* = ", k - 2];
Print["Delta k* = ", TraditionalForm[De[k - 2]]];
Print["Matriz k* = ", TraditionalForm[M[k - 2]]];
Print["Diagonal M[k*] = " TraditionalForm[Diagonal[M[k - 2]]]];

Diagonal M[k*] = {0}


0
Matriz k* = 0
0
0
Delta k* = 0
0
k* = 1

RESULTADO

{{0}, {0}, {0}, {0}, {0}, {0}, {0}}

{0}

{{0}, {0}, {0}, {0}}

{{0}, {0}, {0}}

{0}

{{0}, {0}, {0}}

PASO 3: CLCULO Y RESULTADOS

PASO 3: CLCULO Y RESULTADOS

{{0, s, 0, 0}}

{s}

{{s, 0, 0, 0}}
8 MolinariRetardadoV2.nb

{{- 1, 0, 0, 0}, {- 1 + 2 s, s2 , s, 2 s}, {0, 0, 0, 0}}

{1, s, s, 0}

{{1, 0, 0, 0}, {0, s, 0, 0}, {0, 0, s, 0}, {0, 0, 0, 0}}

{{- 1 - 2 s - 2 s2 , - s2 (2 + s), - s (2 + s), - 2 s (2 + s)},


{- 1, 0, 0, 0}, {- 2 s (1 + s), - s (- 1 + 2 s + s2 ), 1 - 2 s - s2 , - 2 (- 1 + 2 s + s2 )},
{1 - 2 s - 2 s2 , - s (- 1 + 2 s + s2 ), 1 - 2 s - s2 , - 2 (- 1 + 2 s + s2 )}}

{1, 1, s, 0}

{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, s, 0},


{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}

{- 1, 0, 0, 0}, {- 1 + 2 s + 6 s2 + 2 s3 , s2 (2 + 4 s + s2 ), s (2 + 4 s + s2 ), 2 s (2 + 4 s + s2 )},
{- 2 - s2 , - s (1 + s2 ), - 1 - s2 , - 2 (1 + s2 )},
(1 + s)2 (1 + 2 s), s (2 + 3 s + 3 s2 + s3 ), 2 + 3 s + 3 s2 + s3 , 2 (2 + 3 s + 3 s2 + s3 ),
{1 + 2 s + 6 s2 + 2 s3 , s (1 + 2 s + 4 s2 + s3 ), 1 + 2 s + 4 s2 + s3 , 2 (1 + 2 s + 4 s2 + s3 )}

{1, 1, s, 0}

{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, s, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}

RESULTADO

k* = 3
- 2 s2 - 2 s - 1 - s2 (s + 2) - s (s + 2) - 2 s (s + 2)
-1 0 0 0
Delta k* =
- 2 s (s + 1) - s (s2 + 2 s - 1) - s2 - 2 s + 1 - 2 (s2 + 2 s - 1)
- 2 s2 - 2 s + 1 - s (s2 + 2 s - 1) - s2 - 2 s + 1 - 2 (s2 + 2 s - 1)
1 0 0 0
0 1 0 0
0 0 s 0
Matriz k* = 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
Diagonal M[k*] = {1, 1, s, 0}