Physics 2660: Fundamentals of Scientific Computing Lecture 7 News and Announcements • Welcome back from Spring Break! • HW06 has been assigned and will be due Saturday 19 March at 6pm • Office hours reminder: – My office hours are in Room 022-­‐‑C (our computer lab) from 3:30-­‐‑4:30 on Tuesdays or by appointment – TA office hours, also in Room 022-­‐‑C • Mondays 5-­‐‑8pm • Tuesdays 5-­‐‑8pm 2 News and Announcements • Mid-­‐‑term exam has been rescheduled for Tuesday 22 March at 7pm • Inability to access the class wiki for the last 36 hours puts you at a disadvantage, especially coming off of Spring Break • Wiki access issue is at the level of UVa IT professionals who maintain the server on which our class wiki is hosted 3 Review and Today’s Outline • Last time: – – – – Pointers to functions Arrays in C Passing arguments to main(….) Making re-­‐‑usable code • Tonight! – Exam 1 • Today: – Histograms – Making nice plots of data – Statistics: Our first entrypoint 4 Data Visualization: Histograms 5 What is a Histogram? 6 Elements of a Histogram 7 Elements of a Histogram -­‐‑ range -­‐‑ number of bins -­‐‑ number of total entries -­‐‑ number of entries in each bin -­‐‑ number outside range 8 Why Are Histograms So Useful? 9 Histograms in C as a Structure 10 Operations With / On Histograms 11 Histogram Operations: Function Prototypes We will use these functions in lab this week! 12 Histogram Operations: Function Examples 13 Histogram Operations: Function Examples 14 How to Make a Histogram • Biggest mistake made by young scientists in my experience: – They have taken some nice data, they maybe have some model that they are testing, done a good job – They want to convey the message from their experiment through some visualization of their data, a plot – And then they make a plot like this: 15 How to Make a Histogram 16 How to Make a Histogram 17 How to Make a Histogram 18 How to Make a Histogram 19 How to Make a Histogram 20 How to Make a Histogram 21 How to Make a Histogram 22 How to Make a Histogram 23 Statistics: Our First Entrypoint 24 Making a Measurement: Truth • Let’s say I want to measure some physical observable. • Examples: – the acceleration due to gravity near the Earth’s surface – the speed of light – the mass of the Higgs boson N • Each such measureable has a single value – the truth: Make N repeated measurements of some quantity x. A perfect apparatus and data collection scheme would yield the true value every time! x [units] 25 Making A Measurement: Data Why do we see a range of measured values? • imperfections in our instruments • limitations in our measurements 26 GeWing to the Truth How do we go from to arrive at ? Use Statistics: The best we can achieve is the center distribution. Its shape depends on the measurement’s uncertainty. 27 The Story of Measurement • A measurement is not about the central value one finds • A measurement is truly about its uncertainty – The central value in fact is MEANINGLESS and OF NO USE without understanding and reporting the associated uncertainty • Two types of uncertainty: – Systematic uncertainty: Features of the measurement device or technique that shift (aka “bias”) the measured result away from the true value • Biases can often be corrected if discovered • Eg: Imagine you are measuring athletes running the 40-­‐‑yard dash. You discover however the length they run is in fact 42 yards long. This can in principle be corrected – Statistical or random uncertainty: Features of the measurement device or technique that shift the measured result by a different amount in each akempt (hence, random) 28 Statistical or Random Uncertainty “Uncertainty” and “error” are used interchangeably, often inappropriately. I will try to use “uncertainty” universally – and you should as well. If we try to measure the value many 2mes, and have only random uncertain2es in our measurement, we might see a distribu2on of results that follows this red curve. probability distribution 29 The Gaussian Distribution µμ = “mean”, average value of the distributions σ2 = “variance”, characterizes the width σ = “standard deviation” 30 We’ll pick up from here next time. See you then. 31