Untitled
unknown
plain_text
a month ago
631 B
1
Indexable
Never
import matplotlib.pyplot as plt import numpy as np # Define the function def floor_function(x): return np.floor(x) # Generate x values x = np.linspace(-1, 5, 400) y = floor_function(x) # Plot plt.figure(figsize=(8, 6)) plt.step(x, y, where='post', linestyle='-', color='blue', label='$f(x) = \lfloor x \rfloor$') # Set labels and title plt.xlabel('$x$') plt.ylabel('$f(x)$') plt.title('Graph of the Floor Function $f(x) = \lfloor x \rfloor$') plt.grid(True) plt.xticks(np.arange(-1, 6, 1)) plt.yticks(np.arange(-2, 6, 1)) plt.axhline(0, color='black',linewidth=0.5) plt.axvline(0, color='black',linewidth=0.5) plt.legend()
Leave a Comment