import numpy as np import matplotlib.pyplot as plt # f(x) = sqrt(2(x^2 - 8)) + x, for x < -4 # f(x) = 2^(x+4), for x >= -4 x1 = np.linspace(-12, -4, 500, endpoint=False) y1 = np.sqrt(2 * (x1**2 - 8)) + x1 x2 = np.linspace(-4, 4, 500) y2 = 2 ** (x2 + 4) plt.figure(figsize=(8, 5)) plt.plot(x1, y1, label=r"$f(x)=\sqrt{2(x^2-8)}+x$, $x<-4$", color="tab:blue") plt.plot(x2, y2, label=r"$f(x)=2^{x+4}$, $x\geq-4$", color="tab:orange") # Open circle at x = -4 for first branch y_left_limit = np.sqrt(2 * ((-4) ** 2 - 8)) - 4 plt.scatter(-4, y_left_limit, facecolors="white", edgecolors="tab:blue", s=80, zorder=5) # Closed circle at x = -4 for second branch y_at_minus4 = 2 ** (0) plt.scatter(-4, y_at_minus4, color="tab:orange", s=80, zorder=5) plt.axhline(0, color="black", linewidth=0.8) plt.axvline(0, color="black", linewidth=0.8) plt.grid(True, linestyle="--", alpha=0.5) plt.xlim(-12, 4) plt.ylim(-2, max(y2) * 1.1) plt.title("Gráfico de $f(x)$") plt.xlabel("x") plt.ylabel("f(x)") plt.legend() plt.tight_layout() plt.show()