Untitled
unknown
plain_text
a year ago
650 B
14
Indexable
import matplotlib.pyplot as plt
import numpy as np
# Define the function y = 2(x - 4)^2 + 5
def parabola(x):
return 2 * (x - 4)**2 + 5
# Generate x values
x = np.linspace(0, 8, 400)
y = parabola(x)
# Plot the parabola
plt.figure(figsize=(6, 6))
plt.plot(x, y, label=r'$y = 2(x - 4)^2 + 5$', color='blue')
plt.axhline(0, color='black', linewidth=0.5)
plt.axvline(0, color='black', linewidth=0.5)
plt.scatter(4, 5, color='red', label='Vertex (4, 5)') # Vertex
plt.title('Graph of y = 2(x - 4)^2 + 5')
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.legend()
plt.axis([0, 8, 0, 20])
plt.gca().set_aspect('equal', adjustable='box')
plt.show()
Editor is loading...
Leave a Comment