In [2]:
import numpy as np
In [3]:
A = np.array([[0.9, 0.07, 0.02, 0.01],
[0, 0.03, 0.05, 0.02],
[0, 0, 0.85, 0.15],
[0, 0, 0, 1.0]])
x = np.array([[0.85, 0.1, 0.05, 0]])
A.T @ x.T
Out[3]:
In [4]:
P = np.array([[6, 5, 3, 1],
[3, 6, 2, 2,],
[3, 4, 3, 1]])
S = np.array([[1.5 , 1.0],
[2.0, 2.5],
[5.0, 4.5],
[16.0, 17.0]])
P @ S
Out[4]:
In [5]:
# Floating Point Arithmetic
In [6]:
def f(x):
if x <= 1/2:
return 2 * x
if x > 1/2:
return 2 * x - 1
In [7]:
x = 1/10
for i in range(80):
print(x)
x = f(x)
In [8]:
import scipy.linalg as la
A = np.array([[1., 1000], [0, 1]])
B = np.array([[1., 1000], [0.001, 1]])
print("A", A)
print("B", B)
In [9]:
np.set_printoptions(suppress=True, precision=4)
In [10]:
wA, vrA = la.eig(A)
wB, vrB = la.eig(B)
wA, wB
Out[10]:
In [ ]: