# Tarea 1

Daniela Paz Díaz Mora

201710003-6


```python
import numpy as np

from sympy import Matrix
from sympy.abc import x, y
from numpy import linalg
```

## (a)

Se tiene que el polinomio caracteristico quedra en función de la matriz A dada por


```python
A=Matrix([[0.7,0.1,0,-0.2,0,0],[0,0.4,0.1,0,0.1,0.1],[0.9,0,0.8,0,0,0],[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,1,0,0,0]])
A.charpoly(x).as_expr()
```




$\displaystyle 1.0 x^{6} - 1.9 x^{5} + 1.26 x^{4} - 0.323 x^{3} - 0.021 x^{2} + 0.016 x + 2.49366499671666 \cdot 10^{-18}$




```python
coeff=[1,-1.9,1.26,-0.323,-0.021,0.016,0]
coeff.reverse()
np.roots(coeff)
```




    array([-5.58083612+0.j        ,  2.89366753+0.j        ,
            1.45032672+1.19082258j,  1.45032672-1.19082258j,
            1.09901515+0.j        ])



## (b)


```python
Aux_matrix=np.matrix(np.eye(6)-np.array(A), dtype='float')
```


```python
inv=np.linalg.inv(Aux_matrix)
psi=np.matrix([[2],[1],[0],[0],[0],[0]],dtype='float')
factor=np.dot(inv,psi)
J=np.matrix([[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,1,0,0,0]],dtype='float')
vector_medias=np.dot(J,factor)
```


```python
Matrix(vector_medias)
```




$\displaystyle \left[\begin{matrix}6.875\\14.375\\30.9375\end{matrix}\right]$



## (d)


```python
def an(array,n):
    (f,c)=array.shape
    if n==0:
        return np.eye(f)
    elif n==1:
        return array
    else:
        matrix=np.dot(array,an(array,n-1))
        return matrix
```


```python
A=np.array(A,dtype='float')
A.shape
```




    (6, 6)




```python
i=1
while i != 6:
    print('phi_',i, '= \n', np.dot(np.dot(J,an(A,i)),np.transpose(J)))
    i+=1
```

    phi_ 1 = 
     [[0.7 0.1 0. ]
     [0.  0.4 0.1]
     [0.9 0.  0.8]]
    phi_ 2 = 
     [[0.29 0.11 0.01]
     [0.09 0.26 0.22]
     [1.35 0.09 0.64]]
    phi_ 3 = 
     [[0.072 0.083 0.029]
     [0.261 0.153 0.242]
     [1.341 0.171 0.521]]
    phi_ 4 = 
     [[0.0185 0.0514 0.0425]
     [0.3825 0.1133 0.2349]
     [1.1376 0.2115 0.4429]]
    phi_ 5 = 
     [[0.0368  0.03071 0.04744]
     [0.42696 0.09887 0.21455]
     [0.92673 0.21546 0.39257]]


469a099e254da10bafebaa06070e3a0b72a582f3
ipynb
Jupyter Notebook
Tareas/Tarea1.ipynb
pazDaniela/MAT287-Series-de-Tiempo-2020-2
e7ac2bf9b474311556d8a345d567c54aa55788fd
MIT
2020-10-30T00:47:43.000Z
2020-12-05T14:11:58.000Z
Tareas/Tarea1.ipynb
pazDaniela/MAT287-Series-de-Tiempo-2020-2
e7ac2bf9b474311556d8a345d567c54aa55788fd
MIT
Tareas/Tarea1.ipynb
pazDaniela/MAT287-Series-de-Tiempo-2020-2
e7ac2bf9b474311556d8a345d567c54aa55788fd
MIT
Qwen/Qwen-72B
1. YES
2. YES