Example 1: Quadratic dataset¶
In [4]:
import matplotlib.pyplot as plt
# Example: Quadratic dataset
x = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
y = [66, 41, 22, 9, 2, 1, 0, 5, 16, 33, 56]
plt.plot(x, y, marker='o')
plt.xlabel("x")
plt.ylabel("y")
plt.title("Quadratic Function Plot")
plt.grid(True)
plt.show()
In [6]:
import matplotlib.pyplot as plt
x = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
y = [-113, -50, -19, -2, 5, 2, -1, 6, 23, 50, 97]
plt.plot(x, y, marker='o')
plt.xlabel("x")
plt.ylabel("y")
plt.title("Cubic Function: y = x³ - 4x + 2")
plt.grid(True)
plt.show()