# -*- coding: utf-8 -*-

import numpy as np
import matplotlib.pyplot as plt

x1 = [1, 3, 2, 1]
y1 = [1, 1, 3, 1]

plt.figure(figsize=(8, 4))
plt.plot(x1, y1)
plt.grid()

T = np.mat([[2, 0], [0, 4]])

x2 = []
y2 = []
for i in range(len(x1)):
    # print("%d:%d", i, x[i])
    a = np.mat([[x1[i]], [y1[i]]])
    # print(a)
    a = T * a
    # print(a)
    b = a.tolist()
    x2.append(b[0])
    y2.append(b[1])

plt.plot(x2, y2)

plt.show()

A = np.mat([[2, 1, 3], [-2, 5, 3], [0, 0, 2]])
s, v = np.linalg.eig(A)
print(s)
print(v)

#x = A * np.mat([[1], [2], [0]])
#print(x)

P = np.mat([[-3, 1, 1], [-3, 1, 2], [1, 0, 0]])
T = np.mat([[0, 0, 1], [2, -1, 3], [-1, 1, 0]])
print(T)
B = np.mat([[2, 0, 0], [0, 3, 0], [0, 0, 4]])

R = P * B * T
print(R)

C = T * A * P
print(C)

