## 5. Generating your own data

Instead of plotting experimental data, physicists often like to ``doodle'' with mathematical expressions. Sometimes it's an attempt to visualize a solution to some differential equation, to see if it makes sense; or it's a first step in finding the nulls of a complicated polynomial; possibly it's a quick way to look up a family of standard mathematical functions. Programs like maple or mathematica do these things extremely well, but in many cases plotdata has sufficient capabilities, and is much faster.

As an example, execute the following commands:

PLOTDATA: generate x 0,0.1,10
PLOTDATA: y=x**2*exp(-x)
PLOTDATA: graph x,y

and you can see right away that the function has a maximum value of about 0.55 near The vector x was generated from 0 to 10 in steps of 0.1, then we calculated y(x) using the standard Fortran syntax, and plotted y vs. x in the usual way. We can look for the zeroes of the first derivative, in this way:

PLOTDATA: set lintyp 9
PLOTDATA: derivative x y
PLOTDATA: replot

Both the function and its derivative show up on the same plot: PostScript file
Figure 2. A physicist's `doodle'. We plot here and its first derivative (the dotted line).
For the derivative, we set the line type (set lintyp) to something other than the default value of 0, the solid line type (use display lines to see what line types are available).

Numerical integration, differentiation, spline interpolation, a large library of special functions (would you like to know what the fourth-order Laguerre polynomial looks like? - try y=laguerre(4,x)) - these are all things that plotdata does with ease. It is pointless to try to provide you with a comprehensive list of its capabilities, this is what the manuals are for. Remember, you don't have to know all of plotdata's commands, just get the feel for where things are in the manual, to be able to look them up quickly when needed. For example, the special functions known to plotdata are listed in Appendix C of the User's Manual.

Up: Table of contents Next: 6. Changing the default settings Previous: 4.4 Hardcopy