23 lines
462 B
Python
23 lines
462 B
Python
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
|
|
plt.rcParams['text.usetex'] = True
|
|
|
|
# x = np.linspace(0, 2 * np.pi, 100)
|
|
x = np.arange(-2, 2, 0.1)
|
|
|
|
f = np.exp(-x**2)
|
|
g = np.sin(x**2)
|
|
h = np.sin(1 / (x**3 + 9))
|
|
|
|
plt.plot(x, f, "purple", label=r"$f(x) = \exp(-x^2)$")
|
|
plt.plot(x, g, "red", label=r"$g(x) = \sin(x^2)$")
|
|
plt.plot(x, h, "green", label=r"$h(x) = \frac{1}{x^3 + 9}$")
|
|
|
|
plt.title("A2.b)")
|
|
plt.xlabel("x")
|
|
plt.ylabel("y")
|
|
plt.legend()
|
|
|
|
plt.show()
|