![](https://i-blog.csdnimg.cn/blog_migrate/f83afd37c1f988fceb0a649461096b61.png)
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
x = np.arange(0, 2.00,0.01)
y = np.sin((x-2) * np.exp(-x**2)) ** 2
plt.plot(x, y)
plt.title("f(x) = [(sin(x-2))^2]*e^(-x^2)")
plt.xlabel("X")
plt.ylabel("Y")
plt.axis([0, 2.2, 0, 1.2])
plt.show()
![](https://i-blog.csdnimg.cn/blog_migrate/d3e072ecf2ffe5e00ab6b43c3a9900c1.png)
![](https://i-blog.csdnimg.cn/blog_migrate/150dc36cf5e5b6f8641c7c26e6d55c3a.png)
import numpy as np
import matplotlib.pyplot as plt
from scipy import linalg
x = np.random.rand(20, 10)
b = np.random.rand(10)
z = np.random.normal(0, 0.06, 20)
y = x.dot(b) + z
apprx_b = np.dot(np.dot(np.linalg.inv(np.dot(x.T, x)), x.T), y)
plt.plot(b, 'ro', apprx_b, 'bx')
plt.legend(["Real", "estimate"])
plt.show()
![](https://i-blog.csdnimg.cn/blog_migrate/88e09d787ea5864c4c66b193d01604a1.png)
![](https://i-blog.csdnimg.cn/blog_migrate/c05dc3d84f4d9a5e275ade93b9094a7f.png)
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
z = np.random.normal(size = 12000)
n, bins, patches = plt.hist(z, bins = 25, edgecolor = 'blue', color = 'green', density = True)
plt.plot(bins, stats.norm.pdf(bins, loc = 0, scale = 1.0))
plt.text(-3, .25, r'$\mu=0.0,\ \sigma=1.0$')
plt.show()