pltf provides a simple way to use bc(1) and plt(1) to generate plots of many common functions of a single variable. The command-line arguments are interpreted according to their position; pltf asks for values for any missing arguments.
The first argument, expression, can be any expression valid as input to bc(1), with the additional feature that the variable x may appear anywhere in the expression where a number would be allowed by bc. Some examples of valid expressions are:
The first two of these are equivalent; note that whitespace and parentheses are allowed in expressions, although it is necessary to enclose such expressions in double quotes (e.g., "(x + 1)*e(x)") when entering them as command-line arguments in order to protect them from the shell. The last expression is the sine of the square root of x squared; see bc(1) for a complete list of available special functions, or invoke pltf with no command-line arguments to obtain a list.
The second and third arguments specify the domain of the function (the values over which x should vary), and the fourth argument specifies the x-increment (the difference between consecutive values of x for which the expression is to be evaluated).
pltf is a shell script that uses a helper application, ftable, to prepare input for bc -l. Invoke ftable directly (using the same arguments as for pltf) if you need to change the format of the plot or make a printed version of it. See the source for pltf to see how to do this.