In [16]:
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['figure.dpi'] = 120

(a)

In [31]:
n = 10000
s1 = np.random.uniform(0,1,n)
s2 = np.random.uniform(0,1,n)

fig, ax = plt.subplots()
ax.set(xlim=(0, 1), ylim=(0, 1))
ax.set_aspect('equal')
ax = plt.scatter(s1,s2,c='b',s=1,alpha=0.3)
[0.65716654 0.35953357 0.51927583 ... 0.35125969 0.29177942 0.24079213]

(b)

In [49]:
A =  np.matrix('1 2; 3 1')
s_vec = np.stack((s1,s2))
x = np.dot(A,s_vec)
x1 = x[0].tolist()
x2 = x[1].tolist()

fig, ax = plt.subplots()
ax.set_aspect('equal')
ax = plt.scatter(x1,x2,c='b',s=1,alpha=0.2)
In [ ]: