Mathematical Tools for Physics - Department of Physics - University

(nextflipdebug2) #1
11—Numerical Analysis 283

result — the solution is not unique. A further point: there is no requirement that all of thexiare


different; you may have repeated the measurements at some points.


Minimizing this is now a problem in ordinary calculus withMvariables.



∂αν


∑N

i=1


yi−


∑M

μ=1

αμfμ(xi)




2
=− 2


i

[

yi−



μ

αμfμ(xi)


]

fν(xi) = 0


rearrange:


μ

[


i

fν(xi)fμ(xi)


]

αμ=



i

yifν(xi) (11.50)


These linear equations are easily expressed in terms of matrices.


Ca=b,


where

Cνμ=


∑N

i=1

fν(xi)fμ(xi) (11.51)


ais the column matrix with componentsαμandbhas components



iyifν(xi).


The solution forais


a=C−^1 b. (11.52)


IfCturned out singular, so this inversion is impossible, the functionsfμwere not independent.


Example: Fit to a straight line

f 1 (x) = 1 f 2 (x) =x


ThenCa=bis (


N



∑ xi


xi



x^2 i


)(

α 1


α 2


)

=

( ∑

∑ yi


yixi


)

The inverse is


(

α 1


α 2


)

=

1

[

N



x^2 i−


(∑

xi


) 2 ]

( ∑

x^2 i −



xi




xi N


)( ∑

∑ yi


xiyi


)

(11.53)


and the best fit line is


y=α 1 +α 2 x


11.7 Euclidean Fit
In fitting data to a combination of functions, the least squares method used Eq. (11.49) as a measure
of how far the proposed function is from the data. If you’re fitting data to a straight line (or plane if
you have more variables) there’s another way to picture the distance. Instead of measuring the distance


from a point to the curveverticallyusing onlyy, measure it as theperpendiculardistance to the line.


Why should this be any better? It’s not, but it does have different uses, and a primary one is data
compression.

Free download pdf