When you activate physica a welcome message followed by the first PHYSICA: prompt is printed in the text window, and another window pops up, the one in which physica will display the graphics. Only one window can be active at any given time, so you may need to move the mouse inside the window that you want to ``connect'' your keyboard to. You may want to resize and/or move the text window around so that you can see both at the same time. Do not resize or close the graphics output window; it will get closed automatically when you exit physica.
Let's assume you have started physica successfully. At PHYSICA: prompt type the following:
PHYSICA: graph x,y
Your graphics window should be showing the graph of y vs. x! (You can jump ahead and take a peak at Figure 1 if you are not running physica, typing these commands as you go along).
The above data could have been something like time and distance from one of your air track experiments. In fact, we should have also entered the error bars at each data point, like this:
PHYSICA: graph x,y,dy
We have used clear to clear the graph and start a new one with the next graph command.
You can immediately see that the dependence is roughly linear. Let us investigate closer. First of all, the line connecting the points is really inappropriate, since we only made a discrete set of measurements and really know nothing about what y(x) is like in between our data points. To fix that, we will change one of the settings of physica, that of the plotting character, or pchar.
PHYSICA: set pchar -10
PHYSICA: graph x,y,dy
Now each data point is indicated by a triangle (the plotting character No. 10), and there is no line connecting the data points (the minus sign in front of 10).
Now we are free to use a line to indicate a theoretical model that fits this data. From the way we generated our data (air track) we expect a linear dependence. Let's fit the data to a linear expression:
PHYSICA: scalar\vary a
PHYSICA: fit y=a*x
The output generated by physica, among other things, tells us that the best value for the parameter a is 0.0493+/-0.0038. The error in the fit is given by the standard deviation (the E2 parameter), and there are some other useful numbers reported which we will ignore for now.
Armed with this best fit, we can add a ``theoretical'' line to our experimental plot. We can recalculate what the values should have been if the experiment yielded exactly the linear dependence we expect, by ``updating'' a new vector, f, to contain the values that the last fit command had calculated:
PHYSICA: fit\update f
PHYSICA: set pchar 0
PHYSICA: graph\noaxes x,f
Two points of interest here: we used set pchar 0 to turn the plotting character to none and the line through the points to on, and then we used a switch (\noaxes) on the graph command to add the second graph to the already existing one. Looks pretty cool.
To add the final touches, let's label things properly:
PHYSICA: label\xaxis `Time, s'
PHYSICA: label\yaxis `Distance, m'
PHYSICA: graph\axes x,f
Figure 1 shows what your plot should look like at this point.
Before we advance on to more elaborate things you must learn how to end your physica session. The magic word is
Try it now.
One remark: your graph may look slightly different. In creating Figure 1 I had doubled the size of the plotting character to 2% of the page width, up from the default 1%, using the command:
PHYSICA: set %charsz 2
before the graph command. It's one of those slightly more advanced commands that we will get to soon.