The Importance of Graphs in Undergraduate Physics Christopher Deacon D Christopher Deacon received his Ph.D. from the University of Birmingham, England, in 1983 and is currently laboratory coordinator in the physics department at Memorial University of Newfoundland. When not supervising classes he likes to find new ways of doing experiments that are easy, fun to do, and help students learn that practical physics is not as difficult as they might have first thought. Dept. of Physics and Physical Oceanography Memorial University of Newfoundland St. John’s, NF Canada A1B 3X7 cdeacon@physics.mun.ca 270 THE PHYSICS TEACHER rawing a graph is a natural part of doing physics, with applications in all areas from a high-school physics class to the presentation of advanced theoretical or experimental research results. Modern computer packages are very good, but are of limited use unless the user is fully aware of their strengths and weaknesses. The student in a laboratory class still has to decide whether the results of a regression analysis are physically meaningful. This requires a thorough understanding of the experiment being performed and a full appreciation of the reasons for plotting a graph at all. No one underestimates the convenience of graphing software, but the ability to plot and meaningfully interpret a graph is an essential skill that physics students should learn first while using pencil and paper, and develop through the many experiments that involve plotting a graph of one form or another. Why plot graphs? Primarily, we plot a graph to obtain a picture of the data. A clear picture reveals several things that might not be obvious from a table of data alone and, in addition, provides answers to the following questions: 1. How does a change in one variable lead to a change in the other? Plainly, one variable will tend to either increase or decrease relative to the other, and will not necessarily show a straight-line trend. A graph can show that the variables change according to some physical law. Aberrant data in a sequence of measurements, whether they be single points or an entire set, will usually show up in a graph more readily than in a table of data. Thus if we perform an experiment to measure the magnetic field along the axis of a coil, we intuitively expect the field strength to decrease as we move away from the center of the coil. If the graph of field strength versus distance shows any other behavior, Vol. 37, May 1999 then a mistake has been made and should be corrected. This is a good reason for graphing as the data are being taken. To discover that there is no correlation between the plotted quantities may be an important result in a research project. At the introductory level, it might occur if a student plots the wrong variables or even performs the wrong experiment. 2. Do we have sufficient data? The graph should show enough data points over the range considered to obtain the complete picture. In the laboratory I never answer questions such as, “How many data points should I take?” because I believe that students should be able to decide for themselves when there is enough data. Clearly two points are not enough for most undergraduate experiments, a hundred is time consuming and unnecessary. 3. Is there a region of interest that suggests further analysis? If the shape of the graph changes, more data should be taken to confirm that the data are real, such as the region around the resonant frequency of an LCR circuit. This follows from point 2 above, since if there are too few data points or if the range of data considered is too small, there is a danger that students will fail to see a change in slope, for example, which might be the very reason for performing a particular experiment at all. A picture of the data can give a qualitative but concise description of the experiment without the need to perform any further calculations. If the data are uncorrelated there is clearly no relationship between the variables and no further analysis is necessary. For a more quantitative description we need to establish whether a mathematical relationship exists between the variables. Some functional The Importance of Graphs in Undergraduate Physics relationships can be identified straightaway. Equations of the kind y = kxn occur regularly in physics. The exact value of n may not be obvious from the data, but the student should be able to identify and draw graphs of the function for n > 1, n < 1 and n = 1. The most common functions encountered by students include y = kx2, y = k兹x苶, and y = 1/x, as well as the straight line. A mathematical relation may already be established by theory and we can use the underlying theory or the results of a curve-fitting procedure to extract some meaningful physics from the data. For example, the position of a body falling freely under gravity is described by the secondorder polynomial y = ax2 + bx + c, where the parameters a, b, and c represent acceleration (a = g/2), initial velocity (b = vo), and initial position (c = xo). The numbers obtained from the result of a quadratic-curve fit allow us to assign values to these parameters. Other functions can be similarly analyzed. Once we have an equation that fits the data, we can use it to predict how an experiment might behave, either by extrapolation or interpolation. Interpolating between points is relatively straightforward; however, the process of extrapolation is more risky because the regression result is valid only within the range of data considered. Furthermore, the predicted y-value may be completely wrong if the true mathematical relation is unknown. Regression analysis can only offer a mathematical description of the data; it is up to the student to explain its physical meaning. Caution should be exercised. Of course any curve can be described by a sum of polynomials in the form y = ao + alx + a2x2 + a3x3 + . . . , and even for somewhat erratic data it is possible to find a function that fits the original values very well indeed. HowExperiment Formula Simple pendulum T = 2 Thermal expansion of a rod Refractive index of glass Focal length of a thin lens Rydberg constant x-axis 冪莦莦 ᎏᎏ g = o(1+␣ ⌬t) n= sin ᎏi sinr 1 1 ᎏᎏ + ᎏᎏ = ᎏ1ᎏ s s⬘ f 冢 1 1 ᎏ1ᎏ = R ᎏᎏ – ᎏᎏ 2 2 n2 t sinr 1 ᎏᎏ s 冣 1 ᎏᎏ n2 ever, a function with no physical basis will have no physical interpretation and is meaningless, regardless of the numbers produced by computer output. Whatever mathematical functions are used, the analysis should be kept as simple as possible and we should not be fooled into making the problem more complicated y-axis Slope Intercept than it needs to be. Thus, if data appear to follow a 2 4ᎏ T2 ᎏ 0 straight line, nothing more g ambitious than a straight ␣ o line fit should be attempted. (Conversely, a straight-line fit should not be attempted sini n 0 if the data do not follow an 1 1 obvious straight line.) ᎏᎏ –1 ᎏᎏ s⬘ f R ᎏᎏ 4 ᎏ1ᎏ –R n Vo Discharge of capacitor V =Vo e–t/RC t n V 1 –ᎏᎏ RC Radioactive decay N = Noe–t t n N – n No oNI B=ᎏ ᎏ (x2+R2) 3/2 log(x2+R2) log B 3 –ᎏᎏ 2 log oNI magnetic-field measurement Table I. Common formulas from elementary physics, showing which quantities can be obtained from the slope and intercept of a straight-line graph. Symbols have their usual meanings. The Importance of Graphs in Undergraduate Physics The Straight-Line Graph The theory behind most experiments in the introductory laboratory is usually simple enough to be described by a straight-line graph. Thus, experiments with dynamics carts are set up so that if we plot distance versus time, the slope of the Vol. 37, May 1999 THE PHYSICS TEACHER 271 graph gives velocity, or a graph of velocity versus time will give acceleration. Despite its apparent simplicity, the applications of the straight-line graph are often underestimated. The equation of a straight line is well-known, y = mx + b, but when trying to interpret the meaning of “slope” many students tend to focus on the quantity y/x because that is what was plotted, rather than m, which leads to the desired result. By concentrating on the m term we can take any algebraic expression and replot the x and y values to give a straight line where the raw data alone would not. As an example, consider the distance traveled by a body in free fall as a function of time. Such an experiment allows for a determination of g. We know that theory predicts a t2 dependence, and so we plot distance versus t2 to obtain a straight line of slope ½g. Table I lists some common experiments, their relevant formulas, the quantities that should be plotted on the x- and y-axes and the information that can be obtained from the slope and intercept. Key points to note are: • • • The slope may be positive or negative. Useful information can be obtained from the xintercept too. For example, in the thin-lens experiment, both the x- and y-intercepts allow the focal length to be determined. Also, in an experiment to determine Planck’s constant, the x-intercept will give a value for threshold frequency. Power laws or exponential relationships can be plotted by calculating logarithms first. The use of logarithmic scales simplifies the process. A more complicated example from our laboratory concerns the determination of the ratio of the principle specific heats for air by Rüchardt’s method. In this experiment a metal ball is released at the top of a glass tube, which is connected to a large glass bottle, and undergoes damped harmonic oscillations. The period, T, of the oscillations is approximated by the expression T2 = 4 2mV/PoA2 ␥ (1) where Po is atmospheric pressure, m is the mass of the ball, A is the cross-sectional area of the tube, and V is the volume of air in the container.1 The volume of air is varied by adding water to the container. If we write the volume of air as V = Vo – Vw (2) where Vo is the volume of the container and V is the volume of water added, then Eq. (1) may be rewritten as 42m Vo Vw T 2 = ᎏᎏ ᎏᎏ – ᎏᎏ Po A 2 ␥ ␥ 冢 冣 (3) 42m PoA ␥ 42m V PoA ␥ o equal to – ᎏᎏ 2 ᎏᎏ. Some sample data 2 and intercept ᎏᎏ are plotted in Fig. 1. The slope gives an acceptable value for ␥ (␥ = 1.4 for a diatomic gas) and the y-intercept allows Vo to be determined, though we note that the volume of the container can be read directly from the xintercept without further calculation. Just because we have a numerical value for the y-intercept doesn’t mean we have to use it. General Presentation and Organization In addition to using the graph as a tool to extract information about an experiment, it is equally important to emphasize its presentation. In the student’s laboratory notebook, the graph is essentially an aid to calculation; in a more formal report the graph represents the conclusion of a project and needs to be presented in a neat, professional manner and should not be cluttered with calculations of slope and the like. Plotting the Data Raw data should be plotted using whatever numbers are easiest to visualize: it is far easier to picture a 20-g mass hanging from a spring than a 0.020-kg mass, even though the kilogram is the correct SI unit. Thus, in a Hooke’s law experiment, I can plot mass in grams versus extension in centimeters and obtain the spring constant from the slope, but need to perform one extra calculation to put the answer into the correct units. The process is even quicker if I plot the data without drawing an intermediate table first. Of course we should use the correct SI units throughout in a more formal presentation, but in a regular lab report we should try to keep everything as simple as possible, reducing the likelihood of making mistakes. Independent vs Dependent Variable (or is it the other way around)? A popular rule of thumb is to plot the independent variable along the x-axis, while the dependent variable is plotted along the y-axis. While this works well in many applications, there is potential for confusion. I prefer to say that the x-axis contains the quantity that I control and that the y-axis contains the quantity that varies as a result of x varying. Thus in an Ohm’s law experiment I vary current in a circuit and measure the voltage across a resistor. This does not mean that all current-voltage graphs have current plotted along the x-axis. In a Franck-Hertz experiment we vary voltage and measure the current.2 Why is there a difference? In the first case we use the slope of the graph to determine resistance. In the second case we are determining the excitation energy of the mercury atom—it’s a completely different experiment and there is no reason to expect the same shape of graph. Plotting T 2 versus Vw will yield a straight line of slope 272 THE PHYSICS TEACHER Vol. 37, May 1999 The Importance of Graphs in Undergraduate Physics How do I decide what to plot on each axis? The answer is it depends on what information I want to extract from the graph. Thus, I will normally plot the independent variable along the x-axis, except where the analysis would be simplified by switching the axes. For example, to determine refractive index by Snell’s law, I vary the angle of incidence, i, and measure the angle of the refracted beam, r. I could plot sin i along the x-axis and sin r along the y-axis because the angle of incidence is the quantity that I control. This would lead to a straight line of slope 1/n which, while not impossible to deal with, is not as simple as plotting sin i versus sin r and obtaining a straight line of slope n. To Title or Not to Title? Graphs published in professional journals (including The Physics Teacher) do not normally have titles. Instead, a descriptive figure caption is used. When graph-plotting software provides space for a title, what should we write in it? We don’t need to use it at all, but if we choose to give the graph a title, it should be clear and descriptive. “Graph of X versus Y” is not appropriate if the axes are already labeled X and Y. It gives the reader no more information about the graph. A graph that investigates Stefan’s law by looking at filament temperature as a function of electrical power supplied could have as its title, “Verification of Stefan’s Law.” Simply writing “Graph of power versus temperature” does not say what the experiment is about. Error Bars Fig. 1. Graph plotted to obtain Cp/Cv for air by Rüchardt’s method. A least-squares fit to the data gives = 1.42 0.01 and Vo = (10.10 0.16) liter. The Importance of Graphs in Undergraduate Physics No measurement has any physical meaning unless an estimate of the uncertainty is assigned to it. We use error bars on a graph to denote uncertainties, so that the true value of a measured quantity lies between some upper and lower limit as the data points in Fig. 1 show. Error bars may be omitted only if they are too small to be shown on the scale. Technically, a weighted fit should be used since we expect points with small error bars to be more reliable than data with large error bars. The regression line is expected to pass closest to the points with the smallest errors. The problem is that regression formulas are based on the statistics of random variables. Each point is assigned a weight according to its standard deviation. With the exception of experiments that involve the counting of radioactive decays, the standard deviation is unknown. Even multiple measurements of the same point can only provide an estimate of the variance and thus, in the majority of experiments that students encounter, the standard formulas for weighted regression cannot be applied. According to Myers,3 ignoring the weights may be Vol. 37, May 1999 THE PHYSICS TEACHER 273 the most effective course of action, though Lyons4 suggests that the observed experimental error (i.e., ␦yi ) associated with each data point can be used on the grounds that it makes the algebra of determining the best line very much simpler. In practice, the weighted and unweighted regression lines obtained from a set of experimental data have similar slopes and intercepts even if the points are widely scattered about the line.5 Miller further suggests that this may account for the widespread neglect of weighted regression in practice. In the introductory physics laboratory we should plot the points with all the error bars and draw the connecting curve by eye. If the relationship is a straight line, the slope and its error can be easily measured.6 Putting It All Together A good, well-drawn graph needs good data and good thought behind it. Irrespective of the quality of a leastsquares fit, insight is needed to translate the equation of a straight line or curve into a meaningful description of the behavior of a physical phenomenon. I suggest that the art of graph plotting requires five fundamental steps. Following this sequence will enable a student to get the most out of any experiment. These are listed below. 1. Before plotting, ask “What am I plotting and what do I want to find out?” The aim of the experiment should be set out clearly enough so that this can be answered. 2. Plot the data using units that are easy to visualize. Don’t perform unnecessary calculations before plotting. Choose axes that are long enough to accommodate the entire range of the data. 3. Find the line of best fit. If it’s a straight line, use the slope and intercept to obtain the quantities of interest; if it’s a polynomial, remember that each of the coefficients must have physical meaning. If the line does not behave as predicted, ask if some unexpected physical phenomenon is manifesting itself. 4. Determine if there is a better way of plotting the data. Does the underlying theory suggest an alternative? Would a logarithmic or semilogarithmic scale be more appropriate? 5. Show how the graph relates to the experiment performed. Can further predictions be made from the graph? When all is said and done, the graph is a tool for data analysis. Like many tools, its effectiveness is only as good as the proficiency of the user. A competent student should be able to draw and interpret a graph using the most basic computer software (or no computer at all if circumstances require). On the other hand, top-quality software and highspeed computers are no guarantee that a useful result will be obtained if the reasons for drawing the graph are not understood. In summary, the science of physics concerns the study of naturally occurring phenomena. The science of mathematics has allowed us to describe these phenomena in terms of equations that allow us to predict the behavior of physical systems as conditions change. A well-drawn graph provides a bridge between the two disciplines, since it provides a convenient way of visualizing the mathematics and the physics together. The challenge for the instructor is to make the graph-plotting and interpretation process as meaningful as possible so that students will develop these skills well, in preparation for more advanced courses later on. References 1. C. G. Deacon and J. P. Whitehead, “Determination of the ratio of the principal specific heats for air,” Am. J. Phys. 60 (9), 859 (1992). 2. The Franck-Hertz experiment is described in most modern physics texts; for example, A. Beiser, Concepts of Modern Physics, 4th ed. (McGraw-Hill, 1987), pp. 153-154. 3. R. H. Myers, Classical and Modern Regression with Applications, 2nd ed. (PWS-Kent Publishing, 1990), p. 280. 4. L. Lyons, A Practical Guide to Data Analysis for Physical Science Students (Cambridge University Press, 1991), pp. 46-47. 5. J. C. Miller and J. N. Miller, Statistics for Analytical Chemistry (Ellis Horwood Limited, 1984), pp. 109110. 6. C. E. Swartz, private communication. et cetera... Matter/Antimatter “One of the bearing walls of modern physics is that particles of antimatter and those of matter are perfect counterparts, down to their mass. That wall is standing strong, according to new results. The international team has caged a proton and an antiproton in a trap and deduced that they have the same mass to within one part in 10 billion.”1 1. A. Hellemans, Sci. 280, 1526 (June 5, 1998). et cetera... Column Editor: Albert A. Bartlett, Department of Physics, University of Colorado, Boulder, CO 80309-0390 274 THE PHYSICS TEACHER Vol. 37, May 1999 The Importance of Graphs in Undergraduate Physics