Improve the program from Exericse 5.31.
Equip the program from Exericse 5.31 with tests on valid input on the command line. Also allow an optional fourth command-line argument for the number of points along the function curve. Set this number to 501 if it is not given. Name of program file: plotf.py.
Exericse 5.31
Plot functions from the command line.
For quickly getting a plot a function f(x) for x ∈ [xmin, xmax] it could be nice to a have a program that takes the minimum amount of information from the command line and produces a plot on the screen and a hardcopy tmp.eps. The usage of the program goes as follows:
Hint: Make x coordinates from the second and third command-line arguments and then use eval (or StringFunction from Chapters 4.1.4 and 5.4.3) on the first first argument. Try to write as short program as possible (we leave it to Exercise 5.32 to test for valid input). Name of program file: plotf_v1.py.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here