Exercise 11.1: Plotting a function
比较简单,就不说了
import matplotlib.pyplot as plt
from math import *
import numpy as np
def function(x_list):
return [pow(sin(x-2), 2) * exp(-1 * pow(x, 2)) for x in x_list]
x = np.linspace(0, 2, 200)
y = function(x)
plt.title('f(x) = sin^2(x-2)e^(-x^2)')
plt.xlabel('x')
plt.ylabel('y')
plt.plot(x, y)
plt.show()
Exercise 11.2: Data
关于的求解详见