Notes on Numerical Analysis and Computing - Lecture notes 10 | MATH 541, Study notes of Mathematics

Material Type: Notes; Class: INTRO NUM ANALYS & COMPUT; Subject: Mathematics; University: San Diego State University; Term: Fall 2002;

Typology: Study notes

Pre 2010

Uploaded on 03/28/2010

koofers-user-7ft-1
koofers-user-7ft-1 🇺🇸

10 documents

1 / 54

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Numerical Analysis and Computing
Lecture Notes #10
Approximation Theory
Discrete Least Squares Approximation
Peter Blomgren,
Department of Mathematics and Statistics
Dynamical Systems Group
Computational Sciences Research Center
San Diego State University
San Diego, CA 92182-7720
http://terminus.sdsu.edu/
Fall 2009
Peter Blomgren, h[email protected]iDiscrete Least Squares Approximation (1/34)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36

Partial preview of the text

Download Notes on Numerical Analysis and Computing - Lecture notes 10 | MATH 541 and more Study notes Mathematics in PDF only on Docsity!

Numerical Analysis and Computing

Lecture Notes # — Approximation Theory — Discrete Least Squares Approximation

Peter Blomgren, 〈[email protected]

Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center San Diego State University San Diego, CA 92182- http://terminus.sdsu.edu/

Fall 2009

Outline

(^1) Approximation Theory: Discrete Least Squares Introduction Discrete Least Squares

(^2) Discrete Least Squares A Simple, Powerful Approach

3 Discrete Least Squares Application: Cricket Thermometer

Discrete Least Squares Discrete Least Squares

Introduction: Matching a Few Parameters to a Lot of Data.

Sometimes we get a lot of data, many observations, and want to fit it to a simple model.

0 1 2 3 4 5

0

2

4

6

8

Measured Data Average

Discrete Least Squares Discrete Least Squares

Introduction: Matching a Few Parameters to a Lot of Data.

Sometimes we get a lot of data, many observations, and want to fit it to a simple model.

0 1 2 3 4 5

0

2

4

6

8

Measured Data Linear Best Fit

Discrete Least Squares Discrete Least Squares

Introduction: Matching a Few Parameters to a Lot of Data.

Sometimes we get a lot of data, many observations, and want to fit it to a simple model.

0 1 2 3 4 5

0

2

4

6

8

Underlying function f(x) = 1 + x + x^2/ Measured Data

Discrete Least Squares Discrete Least Squares

Introduction: Matching a Few Parameters to a Lot of Data.

Sometimes we get a lot of data, many observations, and want to fit it to a simple model.

0 1 2 3 4 5

0

2

4

6

8

Underlying function f(x) = 1 + x + x^2/ Measured Data Average Linear Best Fit Quadratic Best Fit PDF-link: code.

Discrete Least Squares Discrete Least Squares

Interpolation: A Bad Idea?

We can probably agree that trying to interpolate this data set:

0 1 2 3 4 5

0

2

4

6

8

Measured Data with a 50th degree polynomial is not the best idea in the world... Even fitting a cubic spline to this data gives wild oscillations! [I tried, and it was not pretty!]

Discrete Least Squares Discrete Least Squares

Defining “Best Fit” — the Residual.

We are going to relax the requirement that the approximating function must pass through all the data points. Now we need a measurement of how well our approximation fits the data. — A definition of “best fit.”

Discrete Least Squares Discrete Least Squares

What is the Size of the Residual?

There are many possible choices, e.g.

  • The abs-sum of the deviations:

E 1 =

∑^ n

i=

|ri | ⇔ E 1 = ‖˜r‖ 1

  • The sum-of-the-squares of the deviations:

E 2 =

√√ √√ ∑n

i=

|ri |^2 ⇔ E 2 = ‖˜r‖ 2

  • The largest of the deviations:

E∞ = max 0 ≤i≤n |ri | ⇔ E∞ = ‖˜r‖∞

In most cases, the sum-of-the-squares version is the easiest to work with. (From now on we will focus on this choice...)

Discrete Least Squares Discrete Least Squares

Discrete Least Squares Approximation

We have chosen the sum-of-squares measurement for errors. Lets find the constant that best fits the data, minimize

E (C ) =

∑^ n

i=

(fi − C )^2.

If C ∗^ is a minimizer, then E ′(C ∗) = 0 [derivative at a max/min is zero]

Discrete Least Squares Discrete Least Squares

Discrete Least Squares Approximation

We have chosen the sum-of-squares measurement for errors. Lets find the constant that best fits the data, minimize

E (C ) =

∑^ n

i=

(fi − C )^2.

If C ∗^ is a minimizer, then E ′(C ∗) = 0 [derivative at a max/min is zero]

E ′(C ) = −

∑^ n

i=

2(fi − C ) = − 2

∑^ n

i=

fi + 2(n + 1)C , ︸ ︷︷ ︸ Set =0, and solve for C

E ′′(C ) = 2(n + 1) ︸ ︷︷ ︸ Positive

hence

C∗^ = 1 n + 1

∑^ n

i= 0

fi, it is a min since E ′′(C ∗) = 2(n + 1) > 0.

is the constant that best the fits the data. (Note: C ∗^ is the average.)

Discrete Least Squares Discrete Least Squares

Discrete Least Squares: Linear Approximation.

The form of Least Squares you are most likely to see: Find the Linear Function, p 1 (x) = a 0 + a 1 x, that best fits the data.

Discrete Least Squares Discrete Least Squares

Discrete Least Squares: Linear Approximation.

The form of Least Squares you are most likely to see: Find the Linear Function, p 1 (x) = a 0 + a 1 x, that best fits the data. The error E (a 0 , a 1 ) we need to minimize is:

E (a 0 , a 1 ) =

∑^ n

i=

[(a 0 + a 1 xi ) − fi ]^2.

The first partial derivatives with respect to a 0 and a 1 better be zero at the minimum:

∂ ∂a 0

E (a 0 , a 1 ) = 2

∑^ n

i=

[(a 0 + a 1 xi ) − fi ] = 0

∂ ∂a 1

E (a 0 , a 1 ) = 2

∑^ n

i=

xi [(a 0 + a 1 xi ) − fi ] = 0.

We “massage” these expressions to get the Normal Equations...

Discrete Least Squares Discrete Least Squares

Linear Approximation: The Normal Equations p 1 (x)

∑^ n

i=

[(a 0 + a 1 xi ) − fi ] = 0

∑^ n

i=

xi [(a 0 + a 1 xi ) − fi ] = 0.