Today we're going to play with gnuplot - a tool to make plots. (0) You can install this on pretty much any machine, it's free, and and powerful enough for "real" scientific papers. Installation instructions are beyond the scope of these notes. (1) To run it here on akbar, go up one directory and type ./run_gnuplot (That runs the copy I've installed in my home ~mahoney/local/gnuplot/ directory.) The "help" isn't installed yet. But the gnuplot_docs.html file in Fall01/courses/compuation/ is a good reference. Or type "gnuplot tutorial" into google. (2) Once it's running, try the following commands: gnuplot> a = 3.2 gnuplot> f(x,y) = 3*sin( x/a + y) gnuplot> print f(2,3) So you can define variables and constants. Now let's plot something. If you're on an xterminal or a machine running X-windows, gnuplot> set terminal x11 gnuplot> plot sin(x) If not, try gnuplot> set terminal png color # make a .png file (like .gif) gnuplot> set output "~/html/sample.png" # and put it in this file gnuplot> plot sin(x) gnuplot> set output # close output And then try to look at "sample.png" with a web browser. gnuplot has _lots_ of output formats; if you don't like those, create a .ps (postscript) file and send it to a printer... (3) Plotting data Now run the "sep25/run_example" program to create example.out, with lots of points. Then we can plot this datafile with, say gnuplot> plot [0:3] [-1:2] "example.out" with lines, 1/x The point of all this is * use C code to read from and write to text files of numbers * use gnuplot to make plots (with error bars) of data, in publishable form This of course is far from the only way it can work - but its a good example of the way things are done.