FPLOT(1)FPLOT(1)

NAME

fplot – plot elementary function

SYNOPSYS

fplot [ -c [ -s size ]] [ -r range ] functions ...

DESCRIPTION

Fplot plots elementary functions separated by spaces. The default output is the screen, but if the -c option is specified, the plot is written to the standard output as an r8g8b8 image(6). The latter image size is either 640x480 or the one specified by the -s option’s argument (in the WIDTHxHEIGHT format). The -r option accepts as argument the x and y ranges, in the format xmin:xmax ymin:ymax.

Each function to be plotted may be a combination of the independent variable x, the elementary operations (+, -, *, / and %), and the functions described in sin(2) and exp(2). The exception being that x^n raises x to the nth power, log is the base 10 logarithm, and ln is the natural logarithm.

EXAMPLES

Plot the absolute value and x^3 functions to a 400x400 image(6) on standard output and view with page(1).

 

fplot -c -s 400x400 'sqrt(x*x)' 'x^3' | page

SOURCE

/sys/src/cmd/fplot.c

SEE

exp(2), sin(2), image(6), plot(1).

DIAGNOSTICS

Fplot either exits with syntax error or an empty status.

BUGS

Parentheses after unary operators are not special, e.g. sin(x)/2 is parsed as sin x/2 = sin(x/2) and not (sin x)/2.

There is no unary plus or minus.

HISTORY

Fplot first appeared in 9front (July, 2011).