Untitled

 avatar
unknown
plain_text
5 months ago
879 B
2
Indexable
import numpy as np
import matplotlib.pyplot as plt

# Define the original line equation y = 2x - 24
x_values = np.linspace(-10, 10, 400)
y_values_original = 2 * x_values - 24

# Define the line y = -2x - 5 for comparison (from -2x + y = -5)
y_values_parallel = -2 * x_values - 5

# Plotting the original line
plt.figure(figsize=(10, 6))
plt.plot(x_values, y_values_original, label='y = 2x - 24', color='blue')

# Plotting the parallel line
plt.plot(x_values, y_values_parallel, label='y = -2x - 5', color='red')

# Marking the point (8, -8)
plt.scatter(8, -8, color='green', zorder=5)
plt.text(8, -8, '  (8, -8)', fontsize=12, color='green')

plt.axhline(0, color='black',linewidth=0.5)
plt.axvline(0, color='black',linewidth=0.5)
plt.xlabel('x')
plt.ylabel('y')
plt.title('Graph of y = 2x - 24 and y = -2x - 5')
plt.legend()
plt.grid(True)
plt.show()
Editor is loading...
Leave a Comment