Department of Mechanical Engineering, University of Bath. Mathematics ME Problem sheet 11 Least Squares Fitting of data

Similar documents
Quiz: Experimental Physics Lab-I

DCDM BUSINESS SCHOOL NUMERICAL METHODS (COS 233-8) Solutions to Assignment 3. x f(x)

6 Roots of Equations: Open Methods

Rank One Update And the Google Matrix by Al Bernstein Signal Science, LLC

INTRODUCTION TO COMPLEX NUMBERS

CISE 301: Numerical Methods Lecture 5, Topic 4 Least Squares, Curve Fitting

Lecture 36. Finite Element Methods

UNIVERSITY OF IOANNINA DEPARTMENT OF ECONOMICS. M.Sc. in Economics MICROECONOMIC THEORY I. Problem Set II

Chapter 5 Supplemental Text Material R S T. ij i j ij ijk

Effects of polarization on the reflected wave

Jens Siebel (University of Applied Sciences Kaiserslautern) An Interactive Introduction to Complex Numbers

Definite Integrals. The area under a curve can be approximated by adding up the areas of rectangles = 1 1 +

Section 6: Area, Volume, and Average Value

7.2 Volume. A cross section is the shape we get when cutting straight through an object.

4. Eccentric axial loading, cross-section core

Review of linear algebra. Nuno Vasconcelos UCSD

10. AREAS BETWEEN CURVES

Two Coefficients of the Dyson Product

Principle Component Analysis

Applied Statistics Qualifier Examination

1B40 Practical Skills

Lecture 4: Piecewise Cubic Interpolation

In Calculus I you learned an approximation method using a Riemann sum. Recall that the Riemann sum is

MA123, Chapter 10: Formulas for integrals: integrals, antiderivatives, and the Fundamental Theorem of Calculus (pp.

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17

7.1 Integral as Net Change and 7.2 Areas in the Plane Calculus

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Chapter Newton-Raphson Method of Solving a Nonlinear Equation

Fall 2012 Analysis of Experimental Measurements B. Eisenstein/rev. S. Errede. with respect to λ. 1. χ λ χ λ ( ) λ, and thus:

p-adic Egyptian Fractions

The Schur-Cohn Algorithm

Chemical Reaction Engineering

Statistics 423 Midterm Examination Winter 2009

Least squares. Václav Hlaváč. Czech Technical University in Prague

Improper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:

MTH 146 Class 7 Notes

4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve

Quadratic Forms. Quadratic Forms

Bridging the gap: GCSE AS Level

International Journal of Pure and Applied Sciences and Technology

Electrochemical Thermodynamics. Interfaces and Energy Conversion

2 b. , a. area is S= 2π xds. Again, understand where these formulas came from (pages ).

Chapter 1: Logarithmic functions and indices

COMPLEX NUMBERS INDEX

Date Lesson Text TOPIC Homework. Solving for Obtuse Angles QUIZ ( ) More Trig Word Problems QUIZ ( )

10 Vector Integral Calculus

Read section 3.3, 3.4 Announcements:

Demand. Demand and Comparative Statics. Graphically. Marshallian Demand. ECON 370: Microeconomic Theory Summer 2004 Rice University Stanley Gilbert

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

COMPLEX NUMBER & QUADRATIC EQUATION

20 MATHEMATICS POLYNOMIALS

Online Appendix to. Mandating Behavioral Conformity in Social Groups with Conformist Members

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 17

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

ESCI 342 Atmospheric Dynamics I Lesson 1 Vectors and Vector Calculus

Chemical Reaction Engineering

6.6 The Marquardt Algorithm

2.4 Linear Inequalities and Interval Notation

Abhilasha Classes Class- XII Date: SOLUTION (Chap - 9,10,12) MM 50 Mob no

Chapters Five Notes SN AA U1C5

6. Chemical Potential and the Grand Partition Function

The area under the graph of f and above the x-axis between a and b is denoted by. f(x) dx. π O

A REVIEW OF CALCULUS CONCEPTS FOR JDEP 384H. Thomas Shores Department of Mathematics University of Nebraska Spring 2007

Chapter Newton-Raphson Method of Solving a Nonlinear Equation

Chapter 9 Definite Integrals

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

Introduction to Numerical Integration Part II

Name: SID: Discussion Session:

1 ELEMENTARY ALGEBRA and GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE

Review of Gaussian Quadrature method

Section 4: Integration ECO4112F 2011

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

2008 Mathematical Methods (CAS) GA 3: Examination 2

Lecture 2: January 27

Lecture 7 Circuits Ch. 27

Math 8 Winter 2015 Applications of Integration

Math 1B, lecture 4: Error bounds for numerical methods

Variable time amplitude amplification and quantum algorithms for linear algebra. Andris Ambainis University of Latvia

LINEAR ALGEBRA APPLIED

PART 1 MULTIPLE CHOICE Circle the appropriate response to each of the questions below. Each question has a value of 1 point.

This chapter will show you. What you should already know. 1 Write down the value of each of the following. a 5 2

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

CHM Physical Chemistry I Chapter 1 - Supplementary Material

Section 4.8. D v(t j 1 ) t. (4.8.1) j=1

Chapter 6 Continuous Random Variables and Distributions

Pyramid Algorithms for Barycentric Rational Interpolation

Chapter 0. What is the Lebesgue integral about?

( ) Same as above but m = f x = f x - symmetric to y-axis. find where f ( x) Relative: Find where f ( x) x a + lim exists ( lim f exists.

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Physics for Scientists and Engineers I

Special Relativity solved examples using an Electrical Analog Circuit

Partially Observable Systems. 1 Partially Observable Markov Decision Process (POMDP) Formalism

Physics 121 Sample Common Exam 2 Rev2 NOTE: ANSWERS ARE ON PAGE 7. Instructions:

The Regulated and Riemann Integrals

An Overview of Integration

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Designing Information Devices and Systems I Discussion 8B

Shape and measurement

Precalculus Spring 2017

Polynomials and Division Theory

Transcription:

Deprtment of Mechncl Engneerng, Unversty of Bth Mthemtcs ME10305 Prolem sheet 11 Lest Squres Fttng of dt NOTE: If you re gettng just lttle t concerned y the length of these questons, then do hve look t the exm ppers for the lst few yers to see clerly how much wll e expected n the exm n My If you cn tckle the followng questons well, then you wll no fers t ll wth the lest squres queston n the exm The chef prolem my well e gettng your clcultor technque to e completely relle Therefore, I would suggest tht you should ttempt very quck sketch of the dt n the exm Ths wll llow you to see clerly f your computed coeffcents re resonle 1 You re gven the followng dt: x : 0 1 2 3 4 5 6 7 1 y : 00761 011015 030136 037160 05320 045020 041131 04463 042693 () Assume tht ths dt should le on strght lne through the orgn Fnd tht lne () Now ssume tht the dt should le on the strght lne y mx+c Wht s the lne? () Extend () to qudrtc curve In ll the cses determne the RMS of the lne/curve otned Whch ft s est? [Note: the detled summtons requred for ths mght e done more esly usng pckge such s Excel] ANSWER: For ll three prts of the queston we need to evlute some sums These re gven n Fgure 1 n the ccompnyng document, together wth grphs of the dt ponts nd the three ftted curves The RMS vlues re lso stted wthn ech frme, nd some comments on wht s hppenng re gven there It s generlly true tht the RMS level drops s the degree of the polynoml ncreses Qute clerly the RMS wll drop to zero once n polynoml of degree n hs een ftted to n+1 ponts (smply ecuse such polynoml hs n+1 coeffcents) But t s not usully wse to try to ft very hgh order polynoml to nosy dt The process of fttng hgh order polynoml tends to e unstle n the sense tht the overll curve otned s qute senstvely dependent on the vlues of the coeffcents Generlly 1st, 2nd or possly 3rd order polynoml s suffcent for our needs I hve lso run nother two cses n order to gve some further understndng of how the degree of excellence of the ft vres wth the numer of ponts nd the nose level These re gven n Fgures 2 nd 3 In Fgure 2 101 pont verson of the tutorl queston s gven The reducton n the RMS s not so gret n ths cse, possly due to the fct tht the nose level s oscurng the overll shpe of the grph On Fgure 3 the nose level hs een reduced to 005 from 025 Now t s cler tht the prolc ft s much etter thn the lner fts Not only does the RMS vlue tell us ths, ut the eye does t well, too

2 In ths queston we re gong to ply dfferent gme n the sense tht the dt to e ftted hs dfferent type of rndomness I would lke to see how much ccurcy one cn gn from set of dt whch hs een rounded qute severely We ll use the converson from mles to klometres for ths purpose The followng s Tle of dt whch s suject to dfferent degrees of roundng off, nmely to zero, 1, 2 nd 3 decml plces; x denotes mles nd yn denotes klometres wth n decml plces For ech of these sets of dt, ft strght lne through the orgn to determne the lest squres verson of the converson fctor etween the unts How ccurte re they? You my compre wth the exct vlue, 1609344 x : 1 2 3 4 5 6 7 9 10 y0 : 2 3 5 6 10 11 13 14 16 y1 : 16 32 4 64 0 97 113 129 145 161 y2 : 161 322 43 644 05 966 1127 127 144 1609 y3 : 1609 3219 42 6437 047 9656 11265 1275 1444 16093 If ths hs pqued your nterest, then try the sme wth the converson etween ounces nd grms, for whch 1 ounce s equl to 2349523 grms Use 16 sets of dt from 1oz to 16oz, nd use the sme numer of decml plces s n the ove mles/klometres exmple The rw dt my e found t http://stffthcuk/ensdsr/me10305ho/ounces-to-grmstxt lthough there s lso lnk to t t the unt wepge Gven tht there re 16 dt ponts, you mght e le to coerce Excel nto dong your clcultons for you ANSWER: We re fttng the slope of the lne y mx, where x mles nd y klometres The formul s,n m y,n x It shouldn t tke too long to fnd y, whle x2 35 We get the followng results: DPs y m error 0 614000 159405 0014539 1 620000 1610390 0001046 2 61950 1609299 0000045 3 619591 1609327 0000017 Qute frnkly, I m mzed tht we should get n error s smll s 1% for the zero decml plces cse As the numer of decml plces n the rw dt ncreses, there s cler trend towrds hvng gretly mproved ccurcy However, I hve to wrn you tht ths s not t ll strghtforwrd: f the numer whch s eng sought hs only few decml plces tself, then t s qute possle for the round-off error n the rw dt to e sed towrds one sde of the correct vlue In other words, errors ncurred y the roundng off mght not hve zero men nd f tht s true, then the ccurcy of ths pproch s mpred Wth regrd to the ounces/grms exmple, we get the followng Tle of results: DPs m error 0 2350267 0000744 1 234195 000132 2 2349532 0000009 3 2349521 0000002 So gn we get some pretty spectculr ccurcy, lthough there s smll errton n tht the zero-dp cse s slghtly more ccurte thn the 1-DP cse

I hve to dmt tht ths queston ws motvted y queston I sked myself s chld wth nothng much to do on cold wnter s evenng, wthout ccess to wkped nd efore clcultors could e ought I hd notced tht the converson fctor correspondng to the numers of ounces nd numers of grms ws not the sme etween 4oz sl of utter nd 12oz jr of jm Both were quoted n whole numers nd the fctors re 225 nd 2333, respectvely By ssumng tht the ounces were precse nd tht the grms hd een rounded, I tred to work out from the vrous foodstuffs n the house the rnge of possle vlues tht the converson fctor could tke Ech quoted numer of grms s equvlent to rnge of vlues whch re rounded the sme the wy, nd therefore one s le to get rnge of possle converson fctors for ech cse I eventully settled on 235, whch wsn t too d, nd whch s why I hve lwys rememered the numer 3 Suppose tht you were gven set of expermentl dt where t s suspected tht the dt should stsfy n equton of the form y +/x How could the dt e mnpulted n order to use stndrd Lest Squres theory? [Note: I cn thnk of t lest two dfferent wys of dong ths] Wht out the equton, y x+? ANSWER: The frst wy would e to multply oth sdes of the gven equton y x to get xy x+ If now we defne, Y xy nd X x, we cn do stndrd lner Lest Squres ft to Y X + to fnd nd, from whch we cn then fnd y s functon of x The second wy would e to let X x 1 nd Y y, to otn Y +X, nd hence we would fnd nd usng stndrd Lest Squres theory I wll leve t to you to decde whether these two wys would yeld the sme coeffcents The equton, y /(x+) my e rerrnged nto the form, x y, nd then we my use one of the two methods ove to fnd nd 4 In mny expermentl stutons the oservle, y, s power lw functon of the prmeter, x In other words t tkes the form, y x, where nd need to e found [For exmple, the rte of het trnsfer from hot vertcl surfce s proportonl to the 1 4 power of the temperture dfference etween the heted surfce nd the ment condtons] How would you convert ths power-lw reltonshp nto strght lne reltonshp? ANSWER: If one tkes nturl logrthms of the gven equton, then t ecomes, lny ln+lnx

It s very very lkely tht oth x nd y wll e sngle-sgned for the type of experments whch stsfy such reltonshps, such s the quoted exmple where the oth the rte of het trnsfer nd the temperture dfference re postve However, should x e negtve, then we cn lwys replce t y x x, nd use x nsted Therefore we my defne Y lny, X lnx, A ln nd B, nd use stndrd Lest Squres theory to ft Y A+BX 5 Expermentl mesurements hve een tken of z, whch s functon of oth x nd y It s suspected tht z s lner functon of x nd y, nd therefore t represents plne n 3D spce Use lest squres theory to determne the three unknown coeffcents n the followng equton for the plne, z x+y +c ANSWER: The nswer for ths queston s no more dffcult thn the dervton for fttng qudrtc lne We need to mnmse the sum of the squres of the resduls for z x+y +c: S n (z y c) 2 We need to set to zero n turn ech of the three frst prtl dervtves of S wth respect to, nd c Ths gves the followng equton, x 2 y y N y 2 y N y z y z c z

6 An osessve cyclst hs comprehensve set of dt for hs/her rde-tmes over the sme route for perod of severl yers Nturlly the cyclst s journey tmes re slower when the wether s colder, nd fster when t s wrmer The cyclst wshes to determne () wht the long term generl trend s n terms of speed, () wht sesonl effect should e expected gven the tme of yer To ths end, the cyclst proposes lest squres ft of the form, T +t+ccos(2πt)+dsn(2πt) where T s the rde-tme nd t s tme mesured n yers Develop the lest squres theory whch wll llow the cyclst to cheve hs/her twn ojectves ANSWER: The pproprte equton to solve s N t cos2πt t t 2 t cos2πt cos2πt t cos2πt cos 2 2πt N N sn2πt t sn2πt sn2πt cos2πt sn2πt T t sn2πt T t sn2πt cos2πt c T cos2πt N sn 2 2πt d T sn2πt Clerly the cyclst wll wsh to see tht s negtve to ndcte tht the journey tme s decresng overll, nd hence tht the speed s mprovng The vlues of the coeffcents, c nd d, wll llow the cyclst to determne t whch pont of the yer tht one mght expect the journey tme to e t ts gretest Gven tht, where φ s phse whch stsfes oth ccos(2πt)+dsn(2πt) c 2 +d 2 cos(2πt φ), cosφ c c2 +d 2 nd snφ d c2 +d 2, t s cler tht c 2 +d 2 wll e the expected vrton n journey tme from the men durng the yer In ddton, the vlue of t whch stsfes, 2πt φ, wll gve tht pont n the yer when the journey tme s expected to e t ts mxmum I suspect tht tht mght very well e n Jnury or Ferury 7 Let us generlze thngs lttle Suppose tht we hve to ft the followng curve to mesured dt: y f(x)+g(x), where f(x) nd g(x) re chosen functons nd nd re to e found It my help you to thnk of f(x) nd g(x) s eng 1 nd x (Q1()), or 1 nd 1/x (Q3), or cos(2πx) nd sn(2πx) (lst two components n Q6) How does one modfy lest squres theory to ths generlzton? ANSWER: Dre I sy tht we proceed s usul! Let us wrte out the sums of the squres of the resdul: ( ) 2, S y f g

where I hve used f nd g s shorthnd notton for f( ) nd g( ), respectvely We need to mnmse S wth respect to oth nd Hence, S ( N 0 f 2 ) + ( ) S ( N 0 ( )+ Rerrngng nto mtrx/vector form, we get f 2 g 2 g 2 ) f y, g y f y g y It s cler from ths result tht there s defnte pttern out how lest squres works for generl cses So f we hd to ft the followng three functons: y f(x)+g(x)+ch(x), then the pproprte scheme would e, f 2 f h g 2 g h N f h f y g h g y h 2 c h y An experment hs two mesurles, y(x) nd z(x), s the control prmeter, x, s vred Both y nd z should e lner wth dfferent slopes, ut should hve the sme ntercept on the vertcl xs Tht s, we wsh to ft the followng to the dt, where there re three constnts to fnd: y x+c, z x+c How s ths done? [Ths s smplfed verson of prolem couple of thrd yer students rought to me where they hd to ft strght lne to fve mesureles ll of whch hd the sme ntercept So ths queston sn t product of my wld mgnngs! Wht ws the nswer for ther prolem?] ANSWER: The sums of the squres of the resduls my now e wrtten n the form, [ (y S c ) 2 ( + z c ) ] 2

There re three constnts to fnd,, nd c, nd therefore we wll need to set ll three frst prtl dervtves to zero Here s the fnl nswer: x 2 0 0 Note the presence of the 2N n the mtrx x 2 2N y z c (y +z ) Note: ths queston rose from couple of thrd yer Group Busness nd Desgn students need to ft fve lnes wth common ntercept I hdn t seen such type of lest squres nlyss efore, ut the extenson to the ove theory from two to fve lnes pprently worked perfectly for ther dt If we were to wrte ther fve equtons s y (1) m (1) x + c, y (2) m (2) x + c, nd so on, then the requred mtrx vector system for the sx constnts would e: x 2 0 0 0 0 0 x 2 0 0 0 0 0 x 2 0 0 0 0 0 x 2 0 0 0 0 0 x 2 5N m (1) m (2) m (3) m (4) m (5) c y (1) y (2) y (3) y (4) y (5) 5 j1[ y (j) ] DASR 02/02/2016