In Python, Ask user to enter min, max and step values for the x-axis. Use the np.arange() function with the three values the user entered in order to create an array named x. For the y array use the eval() function and ask user to enter an expression,e.g., ’abs(x)’ or ’x**2’. Plot (x, y) and add label, xlabel, ylabel, title, legend to your plot
In Python,
Ask user to enter min, max and step values for the x-axis. Use the np.arange() function with
the three values the user entered in order to create an array named x. For the y array use the
eval() function and ask user to enter an expression,e.g., ’abs(x)’ or ’x**2’. Plot
(x, y) and add label, xlabel, ylabel, title, legend to your plot
arange function :
One of the array-creation methods in NumPy that uses numerical ranges is called arange(). It returns the reference to an instance of ndarray that has values that are uniformly spaced out.
syntax : numpyarnage(minvalue, maxvalue, step)
matplotlip :
For building static, animated, and interactive graphics in Python, consider Matplotlib. Matplotlib makes both easy and difficult things possible. Make plots of a publication quality. Create zoomable, movable, and updating interactive figures.
Step by step
Solved in 3 steps with 2 images