lecture 4: fitting straight lines by the least-squares methodbelz/phys3719/lecture04.pdf · 24...

21
Lecture 4: Fitting Straight Lines by the Least-Squares Method Physics 3719 Spring Semester 2011 M.Shattuck, CUNY, Ideal Particle Image

Upload: others

Post on 12-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

Lecture 4: Fitting Straight Lines by the Least-Squares Method

Physics 3719Spring Semester 2011

M.Shattuck,CUNY,

Ideal ParticleImage

Page 2: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 2

Problem of Straight-Line Fitting

● We have discussed and seen examples of linearization of data, in which we recast mathematical relations between variables in straight-line form– Easy to recognize by eye– Easy to fit

Page 3: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 3

Transform to Linear: Basic Idea

x = independent variabley = dependent variable

slope intercept

Page 4: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 4

Transform to Linear: Example

Page 5: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 5

Problem of Straight-Line Fitting● Remaining problem: I have a set of points

(x

i,y

i ±

i)

which I expect to follow a linear relationship y = A + Bx What is my best estimate for the coefficients A, B?

Page 6: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 6

1st: Mechanical Analog● Suppose we have a set of

points (xi,y

i).

Page 7: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 7

1st: Mechanical Analog● Suppose we have a set of

points (xi,y

i).

● To each point, connect a spring. (Imagine spring can only move in y direction.)

Page 8: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 8

1st: Mechanical Analog● Suppose we have a set of

points (xi,y

i).

● To each point, connect a spring. (Imagine spring can only move in y direction.)

● To the other end of the springs attach a rigid rod.

Page 9: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 9

1st: Mechanical Analog● Suppose we have a set of

points (xi,y

i).

● To each point, connect a spring. (Imagine spring can only move in y direction.)

● To the other end of the springs attach a rigid rod.

● What will determine where rod comes to rest?

Page 10: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 10

Equilibrium position of rod will minimize potential energy.

Page 11: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 11

where

define

In terms of stretch of string

then

Page 12: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 12

Discussion

● To what does the spring constant k correspond in our linear fitting problem?

● Must the ki all be the same?

Page 13: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 13

replace

With the “chi-squared” function:

thus replace

Page 14: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 14

Minimization of 2

Solve two equations in two unknownsSee handouts for results.

Page 15: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 15

Application left for homework

exercise!

Page 16: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 16

Accuracy and Precision/Statistical and Systematic

Page 17: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 17

Uncertainties in Experimental Physics

● Freshman physics:– 90% of time is spent measuring

central value– Compare to “accepted value”– Tack on experimental uncertainty as an

afterthought, if at all.

● Undergrad Lab (and the rest of your careers):– Spend most of your time understanding errors– Before you even touch equipment!– Is experiment worth doing? Will someone fund it?

Page 18: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 18

Terminology...

● Accuracy: How close to True value?

● Precision: What is the spread you'd see in repeated measurements?

Page 19: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 19

More terminology...

● Random or Statistical Error: Can be reduced by taking more measurements

● Systematic Error: Cannot be reduced by taking more measurements

● Q: When is an experiment “finished”?

Page 20: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 20

Page 21: Lecture 4: Fitting Straight Lines by the Least-Squares Methodbelz/phys3719/lecture04.pdf · 24 January 2011 Physics 3719, Lecture 04 17 Uncertainties in Experimental Physics Freshman

24 January 2011 Physics 3719, Lecture 04 21