import numpy as np import matplotlib.pyplot as plt # Constants for the equation a = 100 # Example value for a b = 1 # Example value for b k = 2 # Example value for k # Generate a range of x values x_values = np.linspace(0, 10, 100) # x will range from 0 to 10 # Calculate y values using the equation y = a - b * x^k y_values = a - b * np.power(x_values, k) # Create the plot plt.figure(figsize=(8, 6)) plt.plot(x_values, y_values, label=f'y = {a} - {b} * x^{k}') # Label the axes plt.xlabel('x') plt.ylabel('y') # Add a title and legend plt.title('Plot of the equation y = a - b * x^k') plt.legend() # Show the plot plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter