79798358

Date: 2025-10-24 03:52:14
Score: 0.5
Natty:
Report link

import matplotlib.pyplot as plt

import numpy as np

# Define the x values

x = np.linspace(-10, 10, 400) # Adjust range as needed

# Define the functions

y1 = 2*x + 1

y2 = x - 4

y3 = -x + 3

y4 = x**2 - 4*x + 3

y5 = -x**2 + 2*x + 1

y6 = x**2 + x - 6

y7 = -2*x**2 - 3*x + 1

# Create subplots

fig, axs = plt.subplots(nrows=4, ncols=2, figsize=(12, 16)) # Adjust figsize as needed

fig.tight_layout(pad=3.0) # Prevents overlapping of titles

# Plot the functions

axs[0, 0].plot(x, y1)

axs[0, 0].set_title('y = 2x + 1')

axs[0, 0].grid(True)

axs[0, 1].plot(x, y2)

axs[0, 1].set_title('y = x - 4')

axs[0, 1].grid(True)

axs[1, 0].plot(x, y3)

axs[1, 0].set_title('y = -x + 3')

axs[1, 0].grid(True)

axs[1, 1].plot(x, y4)

axs[1, 1].set_title('y = x^2 - 4x + 3')

axs[1, 1].grid(True)

axs[2, 0].plot(x, y5)

axs[2, 0].set_title('y = -x^2 + 2x + 1')

axs[2, 0].grid(True)

axs[2, 1].plot(x, y6)

axs[2, 1].set_title('y = x^2 + x - 6')

axs[2, 1].grid(True)

axs[3, 0].plot(x, y7)

axs[3, 0].set_title('y = -2x^2 - 3x + 1')

axs[3, 0].grid(True)

# Remove the last empty subplot

fig.delaxes(axs[3,1])

# Show the plot

plt.show()

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Jemuel Mahasol