PHYS 233 Reference Manual Department of Physics Simon Fraser University Revised March 2014 2 Contents 1 General Information 1.1 Introduction . . . . . . . . . . 1.2 What is required? . . . . . . . 1.2.1 General . . . . . . . . 1.2.2 Experiments . . . . . . 1.2.3 Laboratory Notebooks 1.2.4 Formal Lab Report . . 1.3 Use of Computers . . . . . . . 1.4 Grading . . . . . . . . . . . . 1.5 Academic Honesty . . . . . . 1.6 Required Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 2 2 2 3 4 4 4 4 5 2 Laboratory Notebooks 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 What your lab notebook should contain . . . . . . . . . . . 2.2.1 Material entered before coming to the lab . . . . . 2.2.2 Material entered while doing the experiment . . . . 2.2.3 Material entered after the experiment is completed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 8 8 9 10 . . . . . . . 13 13 13 16 18 20 21 21 4 Data Analysis 4.1 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 The Importance of Errors . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Systematic and Random Errors . . . . . . . . . . . . . . . . . . . . . 23 23 23 24 . . . . . . . . . . 3 Formal Lab Report 3.1 Introduction . . . . . . . . . . . 3.2 The Standard Outline . . . . . 3.3 Some details . . . . . . . . . . . 3.3.1 Points of style . . . . . . 3.3.2 Formal Lab Report Tips 3.4 Use of LATEX . . . . . . . . . . . 3.5 Further Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 CONTENTS 4.1.3 4.2 Standard Deviation of the Distribution and Standard Deviation of the Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.4 Cases where the above treatment does not apply . . . . . . . . . . . . 4.1.5 Combination or Propagation of Errors . . . . . . . . . . . . . . . . . 4.1.6 Combining Experimental Measurements . . . . . . . . . . . . . . . . 4.1.7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Testing theoretical predictions . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Using graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 Least Squares Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 General Linear Least Squares . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Non-linear Model Functions . . . . . . . . . . . . . . . . . . . . . . . 25 26 26 27 28 28 28 30 32 33 Chapter 1 General Information 1.1 Introduction Physics 233 is the third physics laboratory course taken by physics students at SFU. Students entering this course will have had some experience with laboratory work at both the first and second year levels and they will have taken at least three semesters of university-level physics. Students are expected to be familiar with general experimental techniques, including the use of an oscilloscope and various simple electronic equipment, as well as with the use of computers for experimental modeling, data acquisition and analysis, error analysis, and curve fitting. This course is designed with several purposes in mind. The first and foremost is to further acquaint students with experimental work in physics and to help them develop the attitude and skills necessary to succeed in this aspect of their studies. A secondary purpose is to use experimental work to increase the depth of their physical understanding of a number of topics of relevance to physics as performing experiments successfully requires a thorough understanding of the topics being investigated. Last but not least, the course is designed to encourage and develop personal initiative, self-reliance and independence in the search for knowledge on the part of the student. It is this latter aspect of the course that gives rise to the greatest difficulties encountered by many students in Physics 233. Many students become accustomed to absorbing knowledge from easily available sources such as teachers and textbooks. In many cases, the problems presented to them have been clearly defined with unique solutions that can be easily determined using standardized procedures. The demands on students to think about a problem have often been limited to following and reproducing the mentor’s thought processes. In this laboratory many students will be faced with open ended problems for the first time in their lives. There will be no nice step-by-step instruction provided for which there is an a-priori “right” answer except the one extracted from nature. While the experiments that the students are tackling are comparatively simple and deal with essentially well-understood phenomena, because of their limited base of knowledge many students find themselves in 1 2 CHAPTER 1. GENERAL INFORMATION a position similar to that of the physicist doing research at the frontiers of present-day knowledge. They are confronted with a challenge that will tax their resources of patience, perseverance, imagination, knowledge and skill. Like all such challenges, if they are accepted with adequate motivation and the will to succeed, this can and should be an exhilarating experience. As everywhere in life, the road to success will be full of frustrations and disappointments: equipment will refuse to work as expected, it will break down, results will be unexpected, strange errors will appear in seemingly simple results, everything that can go wrong will go wrong and even what cannot go wrong seems to go wrong. There will be tedium, some boredom, and plenty of discouragement, just as there is in any research project. Diligence, hard work, great care and imagination will be expected of you. But if you persevere, you will gain self-confidence, new knowledge, and new skills. It’s up to you! 1.2 1.2.1 What is required? General • Attendance at all laboratory periods. Experiments will begin in the second laboratory period. • Completion of three problem sets dealing with errors. • Completion of 9 “regular” experiments. • Completion of a formal report. 1.2.2 Experiments Students will choose a lab partner and first lab during the first class. A schedule of all subsequent labs will be available online and in the lab. Students should come prepared, i.e. having informed themselves by studying for the experiment they are to perform. This includes consulting the library references mentioned in the handout for the experiment and preparing the lab notebook. Preparation is an essential part of the work in this course and its importance cannot be over-emphasized. The course instructors will check each student’s preparation at the start of the lab period. Ill-prepared students will be sent away and will not be allowed to proceed with their experiment until they are adequately prepared. The following experiments are required as part of this course: • Completion of nine “regular” experiments. These are designed so that a well-prepared student can complete an experiment in one lab period. This forms the main part of the course. Experiments are listed on the course web page. • Completion of a formal report on one of the experiments. 1.2. WHAT IS REQUIRED? 1.2.3 3 Laboratory Notebooks You will need at least two lab books for this course. These should have fixed pages and should include graph paper because you will be making graphs directly in your books. Loose pieces of paper are not allowed and will not be marked. You can continue in books that you used for other physics labs if they meet these criteria. Alternate between the lab books so that the completed one can be marked while you are working on a new one. Please read Chapter 2 by next week so that you are familiar with what is expected. Please follow these steps to prepare lab notebook material for marking (worth a total of 60% of your grade): • Prepare for the lab and record any pre-lab information in your lab book before coming in to start a new lab (titles, important formulae or constants, comments about what might be important to look at etc). Date every entry considering your lab book like a diary of events. • Answer the pre-lab questions directly into the lab book and expect to answer questions from the instructor at the beginning of each lab period. • Work on the lab during the lab period keeping track of your observations, all relevant data and calculations, including sketches of apparatus and preliminary graphs. • The instructor or TA will check your lab notebook before you leave at the end of the day. • Complete calculations, data analysis, error analysis etc. at home in the lab notebook. • Hand in your lab book by 5 pm on the Monday following the lab. • The instructor may collect all lab books for final marking at the end of the semester. Special attention will be paid to data analysis and error analysis. The marks awarded for lab notebooks will be roughly consistent with the following scheme (where each experiment is marked out of 10): Less than 5 for a student who has taken data but not made a reasonable analysis of the data 7 for an average write up; mainly correct but the odd mistake or omission 8 for a good, competent, intelligent write up with no mistakes of consequence, proper comparison of results with theory, including proper treatment of errors 9 same as 8 but with some additional, non-standard, work such as an optional experiment performed well 10 — reserved for rare and particularly insightful work. 4 CHAPTER 1. GENERAL INFORMATION 1.2.4 Formal Lab Report Students must write a formal lab report on one of the experiments. This should be a well researched and polished effort such as might be submitted for publication to a physics journal. More details can be found in Chapter 3. The report should be completed for submission following these steps: • Hand in a “skeleton draft” in Week 11. The skeleton draft should consist of a Latex file with figures, captions, tables, plus a sentence from each section, and a reference. • Hand in rough draft in Week 12. • Rough draft returned with comments in Week 13. • Hand in your final version on April 10, 2014. Late reports will be penalized at a rate of 10% per day. • The final mark on the reports will be the sum of 50% of the mark on the draft and 50% of the mark received on the final version. 1.3 Use of Computers Since you have all taken PHYS 231 or equivalent by now, you will be expected to use the computer to model the experiment and then acquire, analyze and plot data. In PHYS 231 you learned how to use Igor and Labview for these tasks. 1.4 Grading 15% Prelab questions and assignments 45% Laboratory notebooks 20% Formal Lab Report 20% Laboratory Skill (This includes preparation as well as technique) 1.5 Academic Honesty SFU’s policy on Academic Honesty is discussed in Policy T10.02. Penalties and methods of dealing with infringements of this policy are outlined in Policy T10.03. You should familiarize yourself with these policies. All SFU policies can be found at www.sfu.ca/policies. 1.6. REQUIRED TEXT 5 The work you hand in must be your own. It goes without saying that fabrication or falsification of data are serious forms of dishonesty. Furthermore, the rules for plagiarism are as applicable to laboratory reports as they are to essays and papers. We don’t mind if you talk to other members of the class about the labs or assignments that you are working on, but you may not copy material from other peoples’ assignments, lab reports or formal reports. After you discuss problems with your classmates or consult reference documents for information, you should sit down and write up what you have learned in your own words. All sources of material that you use to discuss your data and conclusions must be properly referenced, including web pages. The SFU Library offers excellent information about plagiarism including definitions and avoidance techniques: www.learningcommons.sfu.ca/strategies/academic-integrity. 1.6 Required Text John Taylor “Introduction to Error Analysis - the Study of Uncertainties in Physics Measurements, 2nd Edition” University Science Books. BJF/2007-1 KK/2014 6 CHAPTER 1. GENERAL INFORMATION Chapter 2 Laboratory Notebooks 2.1 Introduction The laboratory notebook is the permanent record of everything you do in connection with the laboratory course. Since you will not be asked to hand in a formal report for each experiment completed, the notebook remains your only record of the experiment. It must therefore contain all the details which are in any way relevant to the experiment so that, using the notebook, it would be possible to reconstruct a full account of an experiment that you have long since forgotten. Because it is meant to be the record of an experiment and not a formal report about it, no formal sentence structure is required as long as the meaning is clear. In these ways, the notebook is your equivalent to the notebook of a research scientist. Most likely, it will not be neat1 , but it must be legible and permanent (i.e., in ink). It will contain your mistakes along with your successes; if you discover any mistakes, then there should be an explanation of what went wrong. Since entries must always be made directly into the laboratory notebook, there is no need for a loose-leaf pad or odd scraps of paper on which to jot down random calculations, and no time is wasted in transferring such “data” to your book. One of the objectives of this course is for you to establish good habits in keeping a notebook, which you will continue throughout your scientific career. You will need two lab notebooks so that the TA can mark one while you are working with the others2 . The notebook should contain some pages that can be graphed on. The pages of the notebook should be non-removable and numbered. Computer printouts of graphs should be attached to the notebook using staples or tape; no other material should be added in this way. In some cases, you will have extensive computer data files that obviously cannot be recorded in your notebook. Make sure that you give these files unambiguous file names and record the names and directories in the notebook where appropriate. When you turn in your lab notebooks, you should also email the TA copies of your computer files for that lab (both data and programs). 1 It’s not illegal for it to be neat! We will make every effort to keep to a schedule where two notebooks is enough. It may turn out that you need a third notebook. 2 7 8 CHAPTER 2. LABORATORY NOTEBOOKS Lab notebooks will be checked at the end of each lab period to make sure that you have recorded the appropriate information during the lab period. We do not want you to go back and fill in details later – you should do this during the lab period. More complicated data analysis can be finished off at home. 2.2 What your lab notebook should contain Your notebook should contain: • Your name on the front cover. • A table of contents at the front of the book. This should list the experiments performed and the page on which each starts. Information such as date performed, grade awarded, remarks, etc. may also be included. • Page numbers on each page. Dates on each entry page. • Your record of each experiment should consist of three parts: material entered before coming to the lab, material entered while doing the lab, and material entered after the experimental work is completed. These are discussed in more detail below. 2.2.1 Material entered before coming to the lab • Date, title and number of the experiment. • A brief statement of what you are trying to measure. • A theory section that contains the theory relevant to the experiment. This should not be overly long, but all the equations used should be stated, and if they are non-trivial, they should be derived or a reference cited. (But don’t belabour the obvious: if an equation is derived in one of your references, just cite it, giving the paper and the relevant equation number(s). Only if you need a different form from what is standard should you put in your derivation. But in those cases, you do need to show your work.) • A list of references consulted should also be included. • Answers to the pre-lab questions. • A brief outline of your proposed approach to each experiment. This is a statement of intent – your actual method may differ from this proposed approach if you discover a better way of doing things once you are taking data. Your actual method should be documented as you work on the lab. Note: it is generally not a good idea to prepare elaborate tables for entering data since you will not know until you get into the lab exactly how much data you will need to collect. 2.2. WHAT YOUR LAB NOTEBOOK SHOULD CONTAIN 2.2.2 9 Material entered while doing the experiment • The date at the beginning of each day’s work. • A list of equipment used and how it was used. This may differ from the lab script. • Diagrams of the experimental setup. These are very important and should be sufficiently detailed that they would permit re-assembly of the apparatus at some time in the future. Indicate sizes, distances, amounts, model numbers of apparatus, etc.. • Be sure to think about other details that might be important. These may be details such as the barometric pressure, room temperature, the resistance of a meter, or the weight of some object. • An account of what you actually did – what worked and what didn’t; what are the limitations of various pieces of equipment. • Estimate and write down how accurate you think your measurements are, and indicate the major sources of error. Please refer to the textbook on error analysis (Taylor) for further information. In cases where the error can be minimized and/or estimated by repeated measurements, then make many measurements. One measurement of the diameter of a steel sphere may not be sufficient - you may need to make many measurements of different diameters to find the mean and the standard deviation of the mean. • Tables of data. When you are ready to take data, do so in an organized way. Label the columns clearly and write neatly. Don’t forget units! In cases where the data is acquired by computer (and is not too long), you can print out the data table to tape/paste into your lab book. • Samples of any calculations made including calculations to reduce data and to estimate errors. • Graphs of your raw data. Set up a graph for your results in your lab notebook or on the computer and add points representing your raw data on the graph as you take them. Don’t accumulate ten data points and then graph them. It is much easier to spot problems on a graph than from tables. Plotting data as you take it also lets you make better judgement about how many data points you need to take and how they should be spaced. Computer graphs should be printed out and taped or stapled into your lab notebook. Note that spreadsheet programs such as Igor make all of this easy, as you can simultaneously display on your monitor a table and graphs made from that table. As you enter the data, they will be updated live on the graph. • Comments regarding the measuring equipment used that will help you to interpret your results. Apparent anomalies in your results may sometimes be traced to a particular instrument. For example, consider the graph shown in Fig. 2.1. 10 CHAPTER 2. LABORATORY NOTEBOOKS 1 Current (A) 0.8 0.6 0.4 0.2 0 0 2 4 6 8 10 12 14 16 18 20 Voltage (V) Figure 2.1: Problem with measuring equipment This graph shows multimeter measurements of current and voltage. The relationship is obviously linear, but something interesting appears to happen when the current lies between 0.5 and 0.6 A. But note that in this current interval, the voltage increases beyond 10 V, so that the anomaly is likely due to a change in the voltage range on the multimeter at 10 V: the meter is reading 0.5 V high on the next range. A marginal note alongside the data, such as “0–0.5 A on 0–10 V range, 0.6 to 1.0 A on 0–50 V range” would strengthen this suspicion. This example also shows why it is a good idea to plot graphs while taking the data. In the above case, the voltage variation between 0.5 and 0.6 A could then have been checked. A graph will often show that you need more data in some region, or that some measurements should be repeated. If you plot your graphs after the laboratory period, there is no opportunity to make such checks. 2.2.3 Material entered after the experiment is completed • Date of entry into lab book. Final graphs and calculations necessary to extract information and final conclusions. Figure 2.2 shows an example of a good graph (measurement of the power dissipated by a (nominal) 100 Ω resistor as a function of the voltage across it). The experimental points are markers, with error bars. The best-fit theoretical curve (in this case a parabola, P = V 2 /R. line) is shown as a smooth curve. (Here, 200 points were used.) There is a legend to identify what’s plotted. (For the graph here, it’s pretty obvious what’s what.) The legend is more important when you have multiple data sets plotted and you need to show that the circles are X and the squares Y, etc. Also, instead of writing the equation you fit to in the legend, you might refer to it in your notebook – e.g., “fit to Eq. 1” – and also give the parameter values 2.2. WHAT YOUR LAB NOTEBOOK SHOULD CONTAIN 11 there. Some fine points are that the axis range, tick marks, minor ticks, etc. have all been tweaked to look better than the default values. It usually looks better to choose fewer labels than the default, but then to use minor ticks to get more precision. The font, font size, and graph size have been selected to look nice, too. If you do not know how to make your graphic software do all of this, please ask your instructor or TA! Note that while you are entering your data, you will be looking at a graph on screen that is less fancy (but still shows whether the points are good, etc.). 10 Experimental measurements Power (mW) 2 Fit to (V /R) * 1000 R = 99.0 ± 0.5 ! 5 0 0.0 0.5 Potential across resistor (V) 1.0 Figure 2.2: Example of a good graph. • A summary of what you did, what you discovered, and your conclusions. Also include a discussion of sources of error and suggestions for improvement. JB/2006-3,BJF/2007-1,KK/2014 12 CHAPTER 2. LABORATORY NOTEBOOKS Chapter 3 Formal Lab Report 3.1 Introduction When writing your formal lab report, imagine that you are writing a paper that you would be proud to have published in a scientific journal where it would be read, enjoyed, and understood by your fellow physicists. Make it as clear and interesting as you can. A glance at any scientific journal will convince you that there are no hard and fast rules that are followed when people report their findings in the literature. Nevertheless, a number of general comments can be made regarding the writing of a scientific paper. It will be a comprehensive account of an experiment that you have performed in the laboratory. Its completeness will depend, therefore, on the thoroughness with which your notebook is kept. It will be written with considerable care and the final presentation will be neat and legible so that nothing detracts from the scientific results that are being presented. It will be concise and well-organized. 3.2 The Standard Outline The first step is to organize your report according to the following standard outline. These are not absolute rules, but they are a good starting point and you should have good reasons for doing otherwise. (On occasion, you may want to add other sections or combine sections that might be very short, etc.) 1. Title: Choose a phrase that describes your work briefly but accurately. 2. Abstract: This is a self-contained summary of your work and results that should be less than 150 words. Most physicists read the abstract of any publication first. If the abstract contains nothing of interest to them, they will not read further. Be specific about what you found out (e.g., did the model you used to understand your experiment work? Under what conditions?). Include results of your measurements, especially if you have measured a number of universal significance (e.g. the speed of light, the charge 13 14 CHAPTER 3. FORMAL LAB REPORT of an electron, etc.), and experimental uncertainties. Note: While this is typically the first section read, this should probably be the last part of the formal lab report that you should write because you will use it to summarize what you did and learned. 3. Introduction: Begin the main body of your report with an introduction. The introduction usually has three parts, each taking a paragraph. (a) The first should state why your study is an interesting one to do and how it fits in with the body of knowledge that is already available on the subject; i.e., it provides a historical and a scientific perspective. Each connection you make should have at least one reference. References should be indicated by brackets (using the \cite{· · ·} LaTeX command) and the full reference given at the end of the paper. (b) The second part of the introduction should set up the rest of the paper. This can include discussions of the motivations for a particular choice of system – for example, why a light bulb seems to be a good choice for studying systems where Ohm’s Law breaks down. In addition, you can outline the types of experiments you will be doing – again, with some motivation as to why they seem to be interesting experiments. I use “seem” because it may turn out that your choices are not so good in the end. (c) Finally, you should outline briefly what is to follow in the rest of the report. This part of the introduction usually looks like “In Section II, we discuss the theoretical background of our experiment. In Section III, we describe our apparatus and our procedures for collecting and analyzing data. Etc.” In your LaTeX file, the “II” and “III”, etc. of your sections are provided by a \ref{· · ·} command, with the name of the reference being provided by a \label{· · ·} command within the section heading command. (See the sample formal report LaTeX source code for examples of this.) The actual sentences you use here should be a bit more specific than the generic text written here. 4. Theory: Present the simple theory necessary to understand the experiments. Assume the reader has some background, but refer to elementary texts in case he or she needs to brush up. You do not need to reproduce lengthy derivations of formulas that can be found in standard texts. Simply quote the results, being sure to define all the terms used in the formulas, and provide the reader with a suitable reference where the details can be found. A more complete treatment of the theory is justified only if the theory is new and your own. If your experiment requires some particular result in order to connect observations to the theories you are exploring, put more emphasis on that than on standard discussions that are in all the textbooks. Note on tense: since theoretical relationships are timeless, one generally uses the present tense. 5. Procedures: Here, you describe the apparatus as well as the method of measurement. Be careful not to use too much jargon. In particular, use generic descriptions in the 3.2. THE STANDARD OUTLINE 15 text. (For ex., “we used a digital multimeter to measure the capacitance.” Specify its capabilities (eg. the minimum or maximum capacitance that it can measure) such that someone could duplicate your experiment with a similar instrument. Add a reference where you identify the manufacturer, model number, and contact information (a web url is enough, for companies).) In the text, clearly describe your experimental procedures (what you did). Do not over-use the passive voice. Usually, you should include a diagram of the apparatus and/or circuit. Please note that a photograph of the apparatus is not a diagram. The point of a diagram is to show the important features and is best done as a simple graphic. You don’t need to do anything fancy – any drawing program that can make boxes and lines and add text is enough. (Some common programs that work fine are Powerpoint, Paint, Illustrator, and (for Mac) Intaglio. For the ambitious, there is an open-source program called Inkscape, which can do fancy things but has an initial learning curve.) For an example of a suitable sketch, see Fig. 1 of the sample formal lab report on the course website. Note on tense: since in this section you are describing what you did, you should generally use the past tense. 6. Results: Here, you present your main work. Graph your results when possible. A table of the raw data is usually neither necessary nor desirable, but do use tables to collect numerical results, particularly if there are several scattered results that need to be considered as a whole (for example to contrast numbers determined by different means that should be the same). Each table and figure should have a complete, descriptive caption and should be referred to by number in the text. If you calculate quantities, refer to the relevant equation in the theory section, but don’t show the detailed steps of the calculation. Uncertainties on both the raw data and calculated quantities should be indicated, but don’t show detailed error calculations or methods — these should be known by the reader. For curve fits, the caption should refer to an equation in the theory section that gives the precise functional form you are fitting to. Don’t forget to include all other details – the standard deviations of individual measurements, the χ2 statistic, number of degrees of freedom, and parameter values and their uncertainties. Often, it is convenient to put all of these in the caption and discuss the relevant ones more fully in the text. For example, some parameters may be important, others not. 7. Discussion: Here, you take stock of your results. Do the experimental results match your theoretical expectations? Do numbers agree with each other, within uncertainties? If they do, say so. If not, how do they differ? Can you come up with a physically plausible explanation for the discrepancy? Perhaps you can find a parameter regime where theory and experiment do agree and one where they don’t. Does this suggest a physical mechanism for the discrepancy? Try to be as quantitative as possible. In the sample formal lab report on Ohm’s Law supplied on the course website, the author tries to explain the change in resistance of a light bulb as a temperature effect (resistivity changes with temperature). But how hot is the light-bulb filament? From the observation that it glows red hot, one can deduce (citing references) that its tem- 16 CHAPTER 3. FORMAL LAB REPORT perature should be between 500 and 1000 ◦ C. This allows one to estimate the change of resistance expected, and that can be compared to experiment. Granted, the uncertainty is large because 750 ± 250 ◦ C is a large range. But a broad range is better than no discussion! 8. Conclusion: Summarize what you have learned, including the inferences made in the discussion section. Then consider whether there are there any unresolved points. Are there natural continuations of your work? Does the material in the discussion section point to a whole new inquiry that might be interesting to follow-up on? All of these points can be good things to include, as are brief words about the broader significance of the results. 9. Acknowledgments: In Science, almost no one goes it completely alone. In this section, you acknowledge those who have helped make the work possible. Perhaps someone has given you money. If so, it is common practice to acknowledge any funding. You may have done your work with the help of a partner. If so, name your partner. (Thanking them is optional!) If anyone helped you out with the analysis or any other point, it is both honest and common courtesy to thank them, too. 10. References: A list of works referred to in the text should be at the end. The references can also include parenthetical remarks and technical information. Be consistent in the style you use for your references. (Unlike some journals, you should include title and beginning and end page numbers in your references. See the examples in the sample formal report.) 3.3 Some details Here are some pointers regarding equations, figures, etc. You should look at the sample formal report (see course website) for examples of how the results should look, in practice. Equations: Very simple equations, such as V = IR, may be written in-line. Complex equations with lots of subscripts, superscripts, compound fractions, integrals, or summations look clumsy in-line and should be displayed centred with a blank line above and below. Any equation that is referred to elsewhere in the text should be displayed and numbered at the right margin. For example, V = IR , (3.1) where V is the voltage across a resistor, I the current through the resistor, and R the resistance. (Using the Revtex package, the numbering in Eq. 3.1 is the default behaviour.) Always define every symbol in all equations. Figures: All figures should be referred to somewhere in the text of your report. (In other words, don’t have a figure and a caption without discussing it somewhere.) Graphs 3.3. SOME DETAILS 17 should be easy to understand. You will almost always have to alter the automatically generated range, labels, etc. Do not put a title on the graph (that is what the caption is for). For the range, choose “nice” numbers for the labels. (For example, nice numbers for angles would often be multiples of 90, rather than 100.) Usually, two or three labels are enough. Use unlabeled minor ticks for showing more. By convention, experimental data should be individual markers, with error bars. (Occasionally, you can change this if the results do not look good. For example, if there are a huge number of experimental points, you may want to show them as lines connecting dots, with no error bars.) Any theoretical fits, etc., should be a smooth, connected line. Make sure the line is drawn with enough points. The theoretical plot will almost always use more points than the experimental marker. If you have two figures that are clearly related, combine them into a single, multi-part figure. An example would be graphs that are presented two different ways (e.g., a linear and a log plot, or a full range and a blow-up). Figure Captions: Figures should usually have a short caption beneath them. A caption makes it easier to understand for someone browsing through the pages. The guiding principle is that the caption should have enough detail so that someone can look at the figure and the caption and know what the figure is about. Discussion of the figure, though, goes in the main text. If there is more than one figure in the report, the captions should start with a figure number. (LaTeX will do this automatically for you.) The text of the paper should refer to every figure. For multi-part figures, captions should be done as follows: Label each sub-figure with a large “(a)”, “(b)”, etc. In the caption, there should be an initial sentence (or more) that describes the overall figure. (You should always do this, even for single-part figures.) Then, say (a) ... (b) ..., etc. For example: “Amplitude response of a driven oscillator. (a) Linear plot. (b) Logarithmic plot.” Figures 3 and 4 in the sample formal report show examples. Curve Fits: One of the goals of the second year physics lab courses is to teach you how to do curve fits. But how do you present the results? There is no general rule, but here is a good guideline. If you show a graph with a curve fit, give the details in the caption. (Sometimes, people will include them as annotation on the graph itself. This is a matter of aesthetics. If you can fit everything so it looks good, that’s fine. Otherwise, put them in the caption.) State which equation you fit to (e.g., “Solid line is a fit to Eq. (1)”). Then give the parameters that you fit to, with their uncertainties. Round the uncertainty to one significant figure and use that to set the number of significant figures in the parameters. (For example, a = 0.123 ± 0.002.) You should include the χ2 statistic and the number of degrees of freedom. (Be sure to normalize your χ2 by properly weighting the fit with a good estimate of the standard deviations!) All the above should be in the figure caption. Then, in the text, you may want to discuss particular results from the fit more. This can be done in the text itself. It can also be very helpful to collect the important results in a table. (For example, you can use a table to compare the important parameters of different fits with each other.) See below for an example of a figure, with curve fit and caption. CHAPTER 3. FORMAL LAB REPORT Res. (V) 18 20 0 -20 Voltage (V) 100 50 0 0.0 0.5 1.0 Current (Amps) Figure 3.1: Voltage drop across a resistor. Solid line is a fit to Ohm’s Law (Eq. 3.1), with R = 102 ± 5 Ω and χ2 = 5.4, for 9 degrees of freedom. Tables: As discussed above, these are good for collecting and comparing a small number of important parameters. Use LaTeX to make the table, using the example in the sample formal report as a guide. Sometimes, in listing lots of parameters, it helps to use a compressed notation for the errors. A common way is to write a = 1.0012(2) in place of a = 1.0012 ± 0.0002. But you should explain somewhere (probably just once in a paper will do it) that in this notation, the quantity within parentheses refers to the uncertainty in the least significant figure (regardless of where the decimal point lies). You can use this streamlined notation for errors in the captions, too. 3.3.1 Points of style 1. Difference between active and passive voice. In the active voice verb form, the subject performs the action. In the passive voice verb form, the subject is acted upon. Passive Control of the furnace is provided by a thermostat. Dolphins were taught by researchers in Hawaii to learn new behaviour. Active A thermostat controls the furnace. Researchers in Hawaii taught dolphins to learn new behaviour. Using the active voice adds energy to your writing. The passive voice can seem complicated and unnatural. Traditionally, scientific papers are written in the passive voice, but there is some debate about this. Sometimes the passive voice is used to avoid the use of the first person (“I” or “we”). The first person can be used occasionally as long as this does not place too much emphasis on you and not enough on what you did. 3.3. SOME DETAILS 19 Sometimes, the passive voice is used to avoid descriptions where inanimate objects perform actions; this problem can be avoided by allowing objects to do the things they are able to do. For example, “The oscilloscope measured the voltage” is clearly an odd concept, but “The oscilloscope displayed the voltage” is certainly a comfortable description. 2. Use simple rather than complex language. Complex Another very important consequence of Einstein’s theory of relativity that does not follow from classical mechanics is the prediction that even when a body having mass is at rest, and hence has no kinetic energy, there still remains a fixed and constant quantity of energy within this body. Simple According to the theory of special relativity, even a body at rest contains energy. 3. Delete words, sentences, and phrases that do not add to your meaning. Wordy Concise It is most useful to keep in mind that the term diabetes mellitus refers to a whole spectrum of disorders. Diabetes mellitus refers to a whole spectrum of disorders. In the majority of cases, the data provided by direct examination of fresh material under the lens of the microscope are insufficient for the proper identification of bacteria. Often, bacteria cannot be identified under the microscope. 4. Use specific, concrete terms rather than vague generalities. Vague Concrete Our new scrubber means big savings for Samson Power. Aircom’s scrubbing system saves Samson $7,000 every day. 20 CHAPTER 3. FORMAL LAB REPORT The sun is hot. The sun is hot — almost 10,000◦ F at its surface. The expedition was delayed for a time because of the unfavourable conditions. The expedition was delayed one week because of snowstorms. 5. Use the past tense to describe your experimental work and results. 6. In most other cases, use the present tense: hypotheses, principles, theories, facts and other general truths should be expressed in the present tense. 7. Avoid needlessly technical language. In particular, avoid jargon (e.g., the “Pasco driver”) that an average reader would not understand. You can use generic terms (“an electromagnetic driver”) and identify the maker, model, etc. in an end reference or footnote. Too technical Clearer The moon was in szyzgy. The moon was aligned with the sun and the earth. Maximize the decibel level. Turn up the sound. 8. Keep ideas in writing parallel. Not parallel Parallel The tube runs into the chest cavity, across the lungs and plunges down into the stomach. The tube runs into the chest cavity, across the lungs and down into the stomach. 3.3.2 Formal Lab Report Tips Here are some common omissions, mistakes, etc. in student formal lab reports: 1. No abstract. Abstract should be self-contained: don’t refer to figures, etc. in the abstract. 2. No references, or references not referred to in text. 3. Figures/tables not numbered. 4. No captions for figures, tables. 5. No reference to figures, tables in text. 3.4. USE OF LATEX 21 6. Equations not numbered. 7. Symbols in equations not defined. 8. Axes of graphs not labeled. 9. Data points on graphs not prominent. 10. No error bars on graphs. 11. No indication of how error estimates were obtained. No mention of the most important contributions to the error in a measurement. 12. No consideration of possible systematic errors. 13. Calling experimental quantities (such as g) the “theoretical” value. 14. Inclusion of tables of original data. 15. The report is not written in complete sentences. 3.4 Use of LATEX We have decided to make the text-processing language LaTeX mandatory for the reports. The LaTeX typesetting system is widely used, particularly in physics, and is free (open source). Although there is an initial learning curve, once learned, LaTeX is much faster for writing fully formatted reports that conform to a given set of style requirements than is a word processor. LaTeX is particularly good for typesetting equations and tables and for keeping track of the numbering in equations, tables, figures, and references. We have a separate resource document on all of this. You can compare its source file with the finished typeset version to see how to do various kinds of formatting. (The sample formal report is also available as a template. See below. Use the report as your basic template, and use the other source file as a source of examples for other typesetting problems.) Note: please use double-spacing for your lines, as in the sample formal report. We need the room to do the marking. Spelling: The editors for LaTeX on both PCs and Apple computers have built-in spell checkers. Use them! 3.5 Further Information 1. M. Alley, The Craft of Scientific Writing, 3rd ed., Springer Verlag, 1996. 2. R. W. Bly and G. Blake, Technical Writing (McGraw Hill, New York, 1982). Library Catalog number: T11 B63. 22 CHAPTER 3. FORMAL LAB REPORT 3. J. Bechhoefer, “On the limits of Ohm’s Law,” Report available on the PHYS 233 website. This is a sample report that tries to illustrate many of the points discussed here in the context of a report that is similar to the one you are asked to write this term. It is a good – but by no means perfect – report. At the end, there are comments on a number of aspects of the report itself. Please do use the report’s LATEXsource file as a template for your own. You may also want to consult the Physical Review Style Guide for further information on style and notation expected in physics papers. You can find this on the web at www.aip. org/pubservs/style/4thed/toc.html. There is also a copy available in the lab. JB/2006-3, BJF/2007-1. Chapter 4 Data Analysis This is not intended to be an alternative to reading a textbook on the treatment of errors and data analysis. More detail can be found in the following references: References: 1. ‘Introduction to Error Analysis - the Study of Uncertainties in Physics Measurements, 2nd Edition’ by J.R. Taylor, University Science Books 1997. 2. ‘Data Reduction and Error Analysis for the Physical Sciences’ by P.R. Bevington and D.K. Robinson, McGraw Hill, 1992. 3. ’Numerical Recipes: the Art of Scientific Computing’ by W.H. Press et al., Cambridge Press. 4.1 4.1.1 Errors The Importance of Errors If an experiment is repeated several times the same result will probably not be obtained on each occasion. These results will be distributed about the true value of the quantity to be measured, some on the high side, some on the low side, as shown in Fig. 4.1. The best estimate the experimenter can obtain for the true value of the quantity is the average of all the results. But this is not enough; if the distribution of the observations about the average value is very wide, it is likely that the average will be far from the true value (Fig. 4.2a), whereas if the distribution is very narrow (Fig. 4.2b) the experimenter may be reasonably confident that the average is fairly close to the true value. This confidence can be expressed in the experimenter’s report as, for example: ‘The focal length of the lens was measured to be 20.3 ± 0.7 cm’. This means that the experimenter is fairly confident that the actual value of the focal length lies between 19.6 and 21.0 cm. The term ±0.7 cm is referred to as the ‘error’ or the ‘experimental uncertainty’ of the results. 23 24 CHAPTER 4. DATA ANALYSIS f=20.3±0.7 cm Number of observations Average value value of x Figure 4.1: Histogram of experimental results It is important that the error be neither underestimated nor overestimated. The dangers of underestimation are obvious; overestimation of the error may result in little attention being paid to the result, or an important anomaly hidden inside the exaggerated error may be overlooked. 4.1.2 Systematic and Random Errors Only random errors contribute to the width of the distribution: these errors are as likely to lie on one side of the true value as on the other, and are the result of small random changes in the conditions of the experiment. Because these fluctuations are random, the errors produced can be treated by statistical theory. Figure 4.3 shows another type of error, the systematic error. If the period of a pendulum is measured with a stop-watch several times, random errors will produce a distribution of the readings about the true value. But if the watch runs slow all the readings will be too small. This is an example of a systematic error, and it occurs with the same sign in every observation. Thus it does not widen the distribution, it merely shifts the whole distribution. In this example if the stop-watch was running fast, the distribution would be shifted to higher values. The presence of the systematic error is not made apparent by repeated measurements: it cannot be treated by statistical theory, and is therefore potentially more dangerous than a random error. There can be no set rules for dealing with systematic errors. In the above example the systematic error should have been discovered, preferably before the experiment was performed, by checking the stop-watch against a clock of known accuracy. If the use of the slow watch was then unavoidable, a correction to the measurement of the period of the pendulum could be made. In general you should always suspect your apparatus. Try to think of every conceivable source of systematic error before you begin the experiment, and either eliminate the possible error, or at least estimate its effect. For example: • Check your instruments against similar instruments or, if possible, against a standard 4.1. ERRORS 25 f=20.3±1.1 cm f=20.3±0.3 cm Figure 4.2: (a) Wide distribution and (b) narrow distribution of experimental results. of known accuracy. • Carry out setting-up procedures as painstakingly as possible. • Ensure no friction where friction should not be: if there is, estimate its effect. • Look for zero errors in micrometers, backlash in a travelling microscope traverse, etc. • Systematic discrepancies may also arise from errors in the theory: ensure that any approximations made in the theory are valid for your experiment. The treatment of random errors is outlined below. 4.1.3 Standard Deviation of the Distribution and Standard Deviation of the Mean The ‘error’ in the result is obviously related to the width of the distribution of the observations. The way in which the error is derived from this distribution is a matter of convention, and there is more than one convention in use. The system given here is the one in most 26 CHAPTER 4. DATA ANALYSIS Random errors { time A systematic error = a displaced distribution Figure 4.3: Random and systematic errors general use. If the n readings we take in a particular sample are denoted by x1 , x2 , . . . xn , then the best estimate we can make of the quantity to be measured is the average or mean of these readings: 1 x = (x1 + x2 + · · · + xn ) . (4.1) n The width of the distribution is related to the deviations of the individual readings from the mean, i.e. (xi − x). We define the standard deviation of the sample, s, as: s= 1 [(x1 − x)2 + (x2 − x)2 + · · · + (xn − x)2 ] n−1 1 2 . (4.2) The larger the width of the distribution, the larger the value of s. The average value x¯ and the standard deviation of the sample s are estimates of the true mean µ and standard deviation σ of the “parent” distribution, or the distribution of all possible measurements. s s value of x x Suppose that this set of n observations is repeated many times. In general the mean of each set of n observations will be different: in fact these means will be distributed about the true value, and obviously the width of the distribution of the means will be much smaller 4.1. ERRORS 27 than the width of each sample. Since we express our result as the mean of our sample, it is the width of the distribution of the means which we wish to express as the error. The more observations there are in each sample (the larger n) the closer we expect the sample means to be to each other, and the narrower the distribution of the means. The standard deviation of the mean σm is related to the standard deviation of the distribution by σ . (4.3) σm = √ n But we don’t know σ, the standard deviation of the true distribution. The best we can do is to use the standard deviation s, calculated for our one small sample of n observations. The best estimate of σm we can make is s σm = √ n . (4.4) Then for our set of observations we quote the result as x = x±σm , using Eqs. 4.1, 4.2 and 4.4 above. If the distribution is Gaussian or Normal (and many experimental distributions approximate to this form) then approximately 2/3 of all the observations will lie within one standard deviation from the mean, approximately 95% within two standard deviations, and 99.7% within three standard deviations. 4.1.4 Cases where the above treatment does not apply We shall encounter experimental situations where the treatment described above cannot be used because of the ‘coarseness’ of the scale of our measuring apparatus. Suppose we measure a current on a meter that has scale divisions of 0.1 amp, and that no matter how many times we repeat the measurement the meter always reads between 7.3 and 7.4 amps. Obviously we cannot calculate a standard deviation as above. The best we can do is to express the result as 7.35 ± 0.05 amps. If the scale divisions are sufficiently large, we might try interpolation. If we can estimate the reading to approximately 1/5 of a division, we can obtain a set of observations like 7.32, 7.38, 7.36, 7.32, etc. We then calculate the mean and standard deviation. If the latter is less than 0.02 amps, however, the error should be quoted as ±0.02 amps. Similarly, for a stop-watch that moves in steps of 0.2 seconds, the error quoted can never be less than 0.2 seconds (although, of course, in many cases it will be greater than 0.2 seconds). 4.1.5 Combination or Propagation of Errors Most experiments are more complex than the observation of a single quantity. Often several different quantities are observed, and combined in some calculation to produce the final result. The error in the final result will be a combination of the errors in the individual quantities, which have been estimated either by Eq. 4.4 for a set of observations as in 28 CHAPTER 4. DATA ANALYSIS Section 4.1.3, or by an educated guess. Provided the various quantities are independent (i.e., a small change in one of the quantities does not affect the values of the others) the general rule for expressing the standard deviation ∆x of the result X in terms of the standard deviations ∆a, ∆b, ∆c, . . . in the quantities A, B, C, . . . where X = X(A, B, C, . . .), is as follows: 2 ∆x = ∂X ∂A !2 ∂X ∆a + ∂B 2 !2 ∆b2 + · · · . (4.5) From this general equation the following relationships for specific combinations of the variables A, B, C, . . . may be derived. (Prove them!) (i) (ii) X = A + B + C + ··· X = A − B ± C + ··· ∆x2 = ∆a2 + ∆b2 + ∆c2 + · · · ∆x2 = ∆a2 + ∆b2 + ∆c2 + · · · (iii) X = ABC · · · (iv) X = AB/C · · · (v) X = An 2 ∆x X 2 ∆x X 2 ∆x X = = = 2 2 ∆a + ∆b A 2 B 2 ∆a + ∆b A 2 B n2 ∆a . A + + 2 ∆c C 2 ∆c C + ··· + ··· (4.6) Great accuracy in the estimate of ∆x is not required: there is generally no point in expressing ∆x to more than two significant figures, and one is often sufficient. Therefore in such combinations of errors it often turns out that the error contribution from one variable may be neglected in comparison with that of another. If one variable has a fairly large error contribution which cannot be reduced by redesigning the experiment (say (∆a)2 in a sum or difference expression, or (∆a/A)2 in a product expression) then there is no point in taking great pains to reduce the error contributions in other variables to very small values; it is only necessary to take sufficient observations to make the error contributions of the other variables small (say ∼ 20%) compared with that of A. It is obviously worthwhile to devote your energies to reducing the errors in those quantities which make the largest contributions to the final error: obviously quantities raised to high powers are potential sources of trouble - see Eq. 4.6, relation (v). 4.1.6 Combining Experimental Measurements It may happen that you can measure a quantity in two ways, using completely different experiments. It might then be desirable to combine the two results to produce a better estimate of the quantity than is given by either of the individual methods. But if the error in one observation is larger than that in the other, the final result should obviously be closer to the second observation than to the first. This can be accomplished by taking a weighted average, the weight accorded to each observation being inversely proportional to the square 4.2. TESTING THEORETICAL PREDICTIONS 29 of the error: X1 ± ∆x1 and X2 ± ∆x2 combine to give X= 1 2 X2 ∆x2 1 2 1 2 + ∆x1 ∆x2 1 ∆x1 2 X1 + . (4.7) and the standard deviation of X is ( ∆x = 1 ∆x1 2 1 + ∆x2 2 )− 21 . In practice, if the ratio of the standard deviations is more than 2, the less precise result may be neglected. 4.1.7 Conclusions A measurement is never complete until an estimate of its possible error is obtained. You should acquire the habit of noting the possible error in each type of measurement along side the data in your notebook. Before measuring a quantity try to make a rough mental estimate of the probable error in it: if you conclude that the error is going to be large, try to think of ways of reducing the error. At the same time you must guard against the inclusion of systematic errors in your experiment. Only when you can give a full account of all the errors in your experiment can you conclude that the results do or do not agree with the theoretical predictions. 4.2 Testing theoretical predictions Measurements are often made of the variation of one quantity y with another quantity x, and the pairs of values plotted on a graph. After the values are plotted, it is usually necessary to compare the data to a model function so the data can be used to check some theoretical relationship. 4.2.1 Using graphs The simplest way to do this is to attempt to plot the data as a straight line by choosing plotting variables that are predicted by theory to have a linear relationship. In practice the points do not always lie exactly on a straight line, often because of experimental errors but sometimes because of the use of an inappropriate model. The final result of the experiment is usually obtained from the value of the slope or the intercept as estimated from the graph. It is then necessary to know the best values of these quantities and the errors in each. Choose your plotting variables Choose your variables to produce a linear graph. See examples in the following table. 30 CHAPTER 4. DATA ANALYSIS Function y = bx + a y = bx2 + a y = bxn y = a + exp(αx) x-variable x x2 log(x) x y-variable y y log(y) log(y − a) Slope b b n α Intercept a a log(b) — Plotting the graph It is customary for each pair of values (x, y) to be represented on the graph by a symbol that also indicates the errors in x and y. In general this symbol will consist of a cross centred on the point (x, y) and the length of the vertical arm will indicate the error in y, that of the horizontal arm the error in x. The arms on the cross are referred to as ‘error bars’. } 6y or } 6x (x,y) Frequently the error in the independent variable is negligible, in which case the symbol has a single error bar. In some cases the size of the point may be larger than the error; in this case there will be no error bar. Calculating the slope (or intercept) When the experimental points are displayed along with their error bars it is possible to judge whether or not the points are consistent with a linear relationship. One expects about 2/3 of the points to lie within one standard deviation of the theoretical plot, and nearly all the points should be within two standard deviations. Draw the best line through the data, making sure that the error bars of 2/3 of the points intersect the line. Are there points that are way off? Check your data! Or check your error calculation. If both of these are fine and your data still doesn’t look linear, then you have used the wrong model function to describe your data. Error in the slope and intercept There are proper statistical methods for determining the best straight line fit to the experimental points, and the error in the slope and intercept. These methods will be covered in a later section. For now, the following methods are adequate: 1. Suppose we have eight points which lie approximately on a straight line. Number the points from 1 to 8. Take points 1 and 5, and calculate the slope (or intercept) 4.2. TESTING THEORETICAL PREDICTIONS 31 of the line between the points. Repeat this for pairs 2 and 6, 3 and 7, 4 and 8. There are thus four values obtainable for the slope (or intercept) and these may be used to find the mean value and standard deviation. The best line to fit the points has this mean slope and passes through the ‘centre of gravity’ of all the points (x, y). Note that the points should be roughly equally spaced along the line, otherwise the four values of the slope do not have equal weight. y 7 8 5 6 2 4 (x,y) 3 1 x 2. If the above method is not applicable (the points may be far from equally spaced) the best straight line may be drawn through the points by eye. Draw the lines with maximum and minimum slope which might still reasonably be considered to represent the points. Report the result as the slope (or intercept) of the best straight line ± half the difference between the maximum and minimum slopes (or intercepts). 4.2.2 Least Squares Fitting Plotting your data as a straight line graph is good place to begin and will always be helpful for preliminary analysis of your data. In this section, we present a technique for calculating the slope and intercept for data with a linear relationship, and for finding the fitting parameters for more complicated, non-linear functions. Analysis using these methods is expected in the second year lab. Assume that we have made a measurement (either by experiment or by computer simulation) and we want to compare the measured data with a theory or model that depends on some parameters. We want to verify whether the theory applies to our experiment and, if this is the case, determine the parameters. Since the data are not exact because of “noise” 32 CHAPTER 4. DATA ANALYSIS they will never fit the theory exactly. Thus, we need some criteria for answering the question “How good is the fit?”. Hence, the fitting procedure should provide 1. the parameters 2. error estimates on the parameters 3. a statistical measure of the goodness of fit. We will use the Method of Least Squares to determine fits of model functions to our data. In this method, we minimize the sum of the squares of the difference between our data and the model function, weighted by the uncertainty of each data point. That is, we minimize the function χ2 (usually pronounced ‘Ki-squared’) n X 2 χ = i=1 yi − yf (xi ) σi !2 (4.8) where n is the number of data points {xi , yi }, σi is the uncertainty or error in ith data point, and yf (xi ) is the value of the model function calculated for the independent variable xi . χ2 is minimized by varying the parameters in the model function. In this way, we can find the best estimates of the parameters. Clearly the closer each of the data points is to the corresponding fit value, the smaller χ2 will be. Thus we are going to assess the goodness of fit for any particular model by how small χ2 is. Further analysis also allows us to estimate the uncertainties in the parameters, thus fulfilling the three requirements for a satisfactory fitting procedure outlined above. Linear Fits In many cases, the data can be expressed in terms of a linear function of the form y(x) = a + b x where a is the intercept of a straight line through the data with the x axis and b is the slope of the line. Minimizing Eq. 4.8 for this function leads to a coupled set of two equations. These can be solved for values of a and b 1 a = detX 1 b = detX X i y i X xi 2 X y i xi X xi − 2 2 σi 2 i σi 2 i σi i σi X y i xi X i σi 2 i X yi X xi 1 − 2 2 σi 2 i σi i σi where detX = X i X xi 1 X xi 2 − 2 2 2 σi i σi i σi !2 . ! ! 4.2. TESTING THEORETICAL PREDICTIONS 33 By using the techniques for propagation of errors outlined in Sec. 4.1.5, we can also derive expressions for the uncertainties in the parameters X xi 2 1 = detX i σi 2 1 X 1 . = detX i σi 2 ! σa 2 σb 2 Linear Correlation Coefficients We can derive a quantitative measure of how appropriate a linear relationship is for our data, i.e. whether y is actually correlated with x in a linear way. This is called the linear correlation coefficient. It is derived by considering the fits y(x) = a + b x x(y) = a0 + b0 y . Expressions for a0 and b0 can be derived by the method outlined above. It turns out that the relationship is linear if the product of the two slopes bb0 = 1. The linear correlation coefficient is defined in terms of this product √ r = ± bb0 = h N N P xi 2 − ( P P xi y i − xi )2 P i1/2 h N xi P P yi 2 − ( yi P yi )2 i1/2 and the magnitude of r will be an indication of how well a linear fit describes the data; r = ±1 indicates complete correlation, where r takes the sign of b, and r = 0 corresponds to no linear correlation whatsoever. χ2 Test For Goodness of Fit The method of least squares is based on the hypothesis that the optimum description of a set of data is the one that minimizes the weighted sum of the squares of the deviation of the data yi from the fit function yf (xi ) 2 χ = n X i=1 yi − yf (xi ) σi !2 . The quantity 1/σi 2 weights the data, making the terms known with smaller uncertainty count for more in the sum. The magnitude of χ2 depends on how big the deviations from the data are and also on the number of degrees of freedom, which is equal to the number of measurements minus the number of parameters or constraints. If the fit is good, we expect yi − yf (xi ) ' σi 34 CHAPTER 4. DATA ANALYSIS so that χ2 ' n . In fact, it can be shown that the mean value of χ2 (obtained as a result of fitting many sets of measurements) is given by hχ2 i = n − m = ν where n is the number of data points, m is the number of fitting parameters, and ν is the number of degrees of freedom. So it is convenient to define a reduced χν 2 , by dividing by the number of degrees of freedom, such that this expectation value is 1: χ2 ν hχν 2 i = 1 . χν 2 = Typically, χν 2 > 1 indicates a problem. However, χν 2 < 1 does not necessarily indicate a better fit, it could indicate that we have overestimated our σi ! In general, the above statement is not correct. The mean value of χν 2 depends on the number of degrees of freedom. So more accurate tests of χν 2 involve other considerations. There is a probability function that describes the distribution of χ2 values. This can be used to make more accurate predictions about the validity of χ2 obtained. Please see Lyons. 4.2.3 General Linear Least Squares Our data is not always going to be consistent with a straight line and it will be necessary to fit more complicated model functions to the data. There are two general classes of possible fitting functions: functions that depend linearly on the parameters and functions that depend non-linearly on the parameters. For functions that are linear in the parameters, we can generalize the treatment developed for fitting a straight line to the date. For example, a very useful function for such a fit is a power-series polynomial y(x) = a1 + a2 x + a3 x2 + a4 x3 + ... + am xm−1 (4.9) where the dependent variable y is expressed as a sum of power series of independent variable x with coefficients a1 , a2 , a3 , etc. A more general form of this kind of model is y(x) = m X ak Xk (x) (4.10) k=1 where Xk (x) are arbitrary fixed functions of x. For the case of our polynomial function, Xk (x) = xk−1 , but these could also be sine and cosine functions etc. Note that the functions Xk (x) can be wildly nonlinear functions of x. In this discussion, “linear” only refers to the model’s dependence on its parameters ak . 4.2. TESTING THEORETICAL PREDICTIONS 35 For these model functions, our figure of merit is still χ2 2 χ = n X " yi − Pm k=1 ak Xk (xi ) #2 (4.11) σi i=1 where we have n data points and m fitting parameters. Minimizing χ2 , our measure of the goodness of fit to the data, with respect to the coefficients a1 , a2 , a3 , etc. results in analytic expressions for the parameters in terms of the functions Xk (x), the data yi and the uncertainties in the data σi . In matrix notation, a = β α−1 (4.12) where a is the vector of parameters, the elements of the vector β are given by βk ≡ n X yi i=1 Xk (xi ) σi 2 (4.13) and those of the symmetric matrix α are given by αlk ≡ n X i=1 1 Xl (xi )Xk (xi ) σi 2 . (4.14) The symmetric matrix α is called the curvature matrix because of its relationship to the curvature of χ2 in parameter space. The solution for the parameters requires that the matrix α be inverted. Computer routines are available for this task. The parameter uncertainties can be calculated once the curvature matrix is available. σal 2 = αll −1 4.2.4 . (4.15) Non-linear Model Functions Analytical fits of functions that are not linear in the parameters (for example y = a sin(ωt) where a and ω are fitting paramters) are not possible. Instead, approximate methods are used that search parameter space for a minimum in our figure of merit, χ2 . • We can make a simple grid search of χ2 space. We simply calculate χ2 at trial values of the parameters and search for the lowest value. • We can use gradient methods that use the slope of χ2 with respect to different parameters to improve the efficiency of the search. In both cases, we generalize the method of least squares but treat χ2 as a continuous function of all of the parameters. The optimum values of all of the parameters is still obtained by minimizing χ2 simultaneously with respect to each parameter. Whether we can find this point in parameter space depends on several things: 36 CHAPTER 4. DATA ANALYSIS • One of these is the initial parameters that we choose - this becomes an important step in the fitting process. As you know, one good way of finding initial parameters is to graph data and fit function and vary the parameters by hand until the two curves are close. • There may be local minima that are not the true minimum in χ2 . How you vary the parameters can determine how sensitive you are to these local minimum. After your fitting program has produced a result, it is a good idea to check that your answer is not sensitive to the initial parameters - i.e. try the fit again with different initial values to make sure the program finds the same solution. • Parameter uncertainties can be estimated by finding the values of the parameters that change χ2 by 1 or by calculating the inverse of the curvature matrix α−1 . The actual search is done with a computer program. Numerical Recipes (Press et al.) has good descriptions of the basic requirements and sample code. There are graphing and analysis programs available that perform these types of fits, for example Graphical Analysis, Igor, or Matlab. Keep in mind that many simple programs do not perform weighted fits; if your data has uncertainties that differ between data points you should take care. Others do not provide parameter uncertainties.
© Copyright 2024