diff options
| author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-11-06 17:21:15 +0100 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-11-06 17:21:15 +0100 |
| commit | eb96892d857355499a7400381e9186512a7d153f (patch) | |
| tree | 7b942975a2ec53a0d1aaa826653677d1589f89cf | |
| parent | 599dd1c34f1d4e62ee29b2de42eaba7143590347 (diff) | |
| parent | 2dbc08a8bc347e9cf9c9291b07b71cf9f00c4acf (diff) | |
| download | plan9front-eb96892d857355499a7400381e9186512a7d153f.tar.xz | |
merge
| -rw-r--r-- | sys/man/1/fplot | 57 | ||||
| -rw-r--r-- | sys/src/cmd/fplot.c | 2 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sys/man/1/fplot b/sys/man/1/fplot new file mode 100644 index 000000000..73791309c --- /dev/null +++ b/sys/man/1/fplot @@ -0,0 +1,57 @@ +.TH FPLOT 1 +.SH NAME +fplot \- plot elementary function +.SH SYNOPSYS +.B fplot +[ +.B -c +[ +.B -s +.I size +]] [ +.B -r +.I range +] +.I functions ... +.SH DESCRIPTION +.I Fplot +plots elementary +.I functions +separated by spaces. The default output is the screen, but if the +.B -c +option is specified, the plot is written to the standard output as an r8g8b8 +.IR image (6). +The latter image size is either 640x480 or the one specified by the +.B -s +option's argument (in the WIDTHxHEIGHT format). The +.B -r +option accepts as argument the x and y ranges, in the format +.LR "xmin:xmax ymin:ymax". +.PP +Each function to be plotted may be a combination of the independent variable x, +the elementary operations (+, -, *, and /), and the functions described in +.IR sin (2) +and +.IR 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. +.SH EXAMPLES +Plot the absolute value and x^3 functions to a 400x400 image(6) on standard output and view with +.IR page (1). +.IP +.EX +fplot -c -s 400x400 'sqrt(x*x)' 'x^3' | page +.EE +.SH SOURCE +.B /sys/src/cmd/fplot.c +.SH SEE ALSO +.IR exp (2), +.IR sin (2), +.IR image (6), +.IR plot (1). + +.SH DIAGNOSTICS +.I Fplot +either exits with +.LR "syntax error" +or an empty status. diff --git a/sys/src/cmd/fplot.c b/sys/src/cmd/fplot.c index 9d6dd5301..866901135 100644 --- a/sys/src/cmd/fplot.c +++ b/sys/src/cmd/fplot.c @@ -57,6 +57,7 @@ void oasin(void) { *sp = asin(*sp); } void oacos(void) { *sp = acos(*sp); } void oatan(void) { *sp = atan(*sp); } void osqrt(void) { *sp = sqrt(*sp); } +void oexp(void) { *sp = exp(*sp); } void olog(void) { *sp = log10(*sp); } void oln(void) { *sp = log(*sp); } @@ -79,6 +80,7 @@ struct Operator { "acos", OUNARY, 0, 50, oacos, "atan", OUNARY, 0, 50, oatan, "sqrt", OUNARY, 0, 50, osqrt, + "exp", OUNARY, 0, 50, oexp, "log", OUNARY, 0, 50, olog, "ln", OUNARY, 0, 50, oln, }; |
