Professional Documents
Culture Documents
for
i = 1, . . . , n?
(1)
420
415
p(t)
410
405
400
395
390
10
Figure 1:
A set of discrete data marked by small circles is approximated with a linear function p = p(t) represented by the solid
line.
Lectures INF2320 p. 3/80
420
415
p(t)
410
405
400
395
390
10
Figure 2:
A set of discrete data marked by small circles is approximated with a quadratic function p = p(t) represented by the solid
curve.
Lectures INF2320 p. 4/80
Figure 3:
0.5
1.5
2.5
t
3.5
4.5
30
25
20
15
10
Figure 4:
0.5
1.5
2.5
t
3.5
4.5
p(t).
Lectures INF2320 p. 7/80
Computational year
Temperature deviation
ti
yi
1991
0.29
1992
0.14
1993
0.19
1994
0.26
1995
0.28
1996
0.22
1997
0.43
1998
0.59
1999
0.33
2000
10
0.29
Table 1:
0.7
0.6
0.5
0.4
0.3
0.2
0.1
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
Figure 5:
The global annual mean temperature deviation measurements for the period 1991-2000.
Lectures INF2320 p. 9/80
Approximating by a constant
10 i=1
(2)
Approximating by a constant
F() =
2
(
y
)
i
(3)
i=1
We have
10
F 0 () = 2 ( yi )
(4)
i=1
Approximating by a constant
This leads to
10
10
2 = 2 yi ,
i=1
(5)
i=1
or
1 10
=
yi ,
10 i=1
(6)
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0.1
0.2
Figure 6:
0.3
*=0.312
0.4
0.5
0.6
Approximating by a constant
Since
10
F 00 () = 2 1 = 20 > 0,
(7)
i=1
Approximating by a constant
Define
10
G() =
4
(
y
)
i
(8)
i=1
We have that
10
G0 () = 4 ( yi )3
(9)
i=1
Approximating by a constant
is a minimum of G since
10
G00 ( ) = 12 ( yi )2 > 0
i=1
0.15
0.1
0.05
0
0.1
0.2
0.3
0.4
0.5
0.6
*=0.345
Figure 7:
0.7
0.6
0.5
0.4
0.3
0.2
0.1
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
Figure 8:
(10)
Define
F(, ) =
10
2
(
+
t
y
)
i
i
(11)
i=1
(12)
i=1
10 +
ti
i=1
(13)
= 0 leads to
10
yi .
(14)
i=1
ti
= 1 + 2 + 3 + + 10 = 55,
i=1
and
10
yi
i=1
so we have
10 + 55 = 3.12.
(15)
i=1
ti +
i=1
10
= 0 gives
!
2
t
i =
i=1
10
yiti.
i=1
2
2
2
2
t
=
1
+
2
+
3
+
+
10
= 385,
i
i=1
and
10
tiyi
i=1
(16)
3.12
=
.
55 385
20
With our knowledge of linear algebra, we see that
10
55
55 385
1
=
825
!1
385 55
55
10
3.12
20
!
!
3.12
20
0.123
0.034
(17)
0.7
0.6
0.5
0.4
0.3
0.2
0.1
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
Figure 9:
(18)
Minimizing
F(, , ) =
10
2
2
(
+
t
+
t
y
)
i
i
(19)
i=1
requires
F
F
F
=
=
= 0
(20)
Lectures INF2320 p. 28/80
2 10
i=1
+ ti + ti2 yi
10
10 +
ti +
i=1
2 10
i=1
10
+ ti + ti2 yi
!
ti +
i=1
2 10
i=1
10
10
= 0 leads to
!
10
2
t
i =
i=1
i=1
10
yi
i=1
10
3
t
i =
i=1
ti2 = 0 leads to
!
3
t
i +
i=1
10
ti = 0 leads to
!
2
t
i +
+ ti + ti2 yi
2
t
i +
i=1
10
4
t
i =
i=1
10
yiti
i=1
10
2
y
t
i
i
i=1
ti = 55,
i=1
10
ti4 = 25330,
i=1
10
ti2 yi = 138.7,
i=1
10
2
t
i = 385,
10
3
t
i = 3025,
i=1
10
i=1
10
i=1
i=1
10
55
385
3.12
138.7
(22)
The constant
p0 (t) = 0.312
The linear
p1 (t) = 0.123 + 0.034t
The quadratic
p2 (t) = 0.4078 + 0.2997t 0.0241t 2
Lectures INF2320 p. 31/80
0.7
0.6
0.5
0.4
0.3
0.2
0.1
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
Figure 10:
Summary
Approximating a data set
(ti , yi ) i = 1, . . . , n,
with a constant function
p0 (t) = .
Using the method of least squares gives
1 n
=
yi ,
n i=1
(23)
Summary
Approximating the data set with a linear function
p1 (t) = + t
can be done by minimizing
n
, i=1
n
n
ti
n
yi
i=1
i=1
n
= n
n
ti ti
tiyi
i=1
i=1
i=1
(24)
Summary
A quadratic approximation on the form
p2 (t) = + t + t 2
can be done by minimizing
min,, F(, , ) = min,, ni=1 (p2 (ti ) yi )2 , which leads to
the following 3 3 linear system
n
n
ti
ti
i=1
n
2
t
i
i=1
n
i=1
n
i=1
i=1
2
t
i
3
t
i
2
t
i
i=1
3
ti =
i=1
4
ti
i=1
yi
i=1
yiti
.
i=1
n
2
yiti
(25)
i=1
0.4
0.2
0.2
0.4
0.6
1850
1900
1950
2000
Figure 11:
The global annual mean temperature deviation measurements from the year 1856 to 2000.
Lectures INF2320 p. 36/80
ti = 10585,
n = 145,
i=1
145
2
t
i = 1026745,
i=1
145
ti4 =
i=1
145
1.30415 1010,
tiyi = 502.43,
i=1
145
8
3
=
1.12042
10
,
t
i
i=1
145
yi = 21.82,
i=1
145
ti2 yi
i=1
(26)
= 19649.8,
(27)
21.82
=
.
10585 1026745
502.43
Consequently,
0.4638 and 0.0043,
so the linear model is given by
p1 (t) 0.4638 + 0.0043t.
21.82
145
10585
1026745 106
6
8
10585
1026745 10 1.12042 10 = 502.43 .
19649.8
1026745 106 1.12042 108 1.30415 1010
The solution of this system is given by
0.3136,
1.8404 103
0.6
0.4
0.2
0.2
0.4
0.6
1850
1900
1950
2000
Figure 12:
Constant, linear and quadratic least squares approximations of the global annual mean temperature deviation measurements; from 1856 to 2000.
Lectures INF2320 p. 40/80
Table 2:
Year
Population (billions)
1950
2.555
1951
2.593
1952
2.635
1953
2.680
1954
2.728
1955
2.780
Exponential growth
First we model the data in Table 2 using the exponential
growth model
p0 (t) = p(t),
p(0) = p0 ,
(29)
Exponential growth
p0 = 2.555
(30)
(31)
Exponential growth
By choosing t = 1, we estimate to be
n
p(n + 1) p(n)
=
p(n)
(32)
p(n + 1) p(n)
= 100
p(n)
(33)
Exponential growth
Table 3:
Year
p(n)
1950
2.555
p(n + 1) p(n)
p(n)
1.49
1951
2.593
1.62
1952
2.635
1.71
1953
2.680
1.79
1954
2.728
1.91
1955
2.780
bn = 100
p0 (t)
p(t)
Exponential growth
(34)
(35)
Exponential growth
(36)
(37)
6.5
x 10
5.5
4.5
3.5
2.5
1950
1955
1960
1965
1970
1975
1980
1985
1990
1995
2000
Figure 13:
The figure shows the graph of an exponential population model p(t) = 2.555 e0.01704t together with the actual measurements marked by o.
Lectures INF2320 p. 48/80
Exponential growth
bn = 100
p(n+1)p(n)
p(n)
Year
p(n)
1990
5.284
1.57
1991
5.367
1.55
1992
5.450
1.49
1993
5.531
1.46
1994
5.611
1.43
1995
5.691
1.37
1996
5.769
1.35
1997
5.847
1.33
1998
5.925
1.32
1999
6.003
1.28
2000
10
6.080
Table 4:
Exponential growth
10 n=0
Therefore =
b
100
= 0.0142
(38)
(39)
(40)
(41)
(42)
Logistic growth
As above we define
bn
p(n + 1) p(n)
= 100
p(n)
(43)
(44)
Logistic growth
p(n)
10
n=0
=
9
9
2
B
p(n) (p(n))
n=0
n=0
bn
n=0
9
p(n)bn
n=0
(45)
We have
9
p(n) = 56.5,
n=0
n=0
2
(p(n))
= 319.5,
n=0
bn
14.1,
p(n)bn
79.6
n=0
Logistic growth
14.1
79.6
we get
A = 2.7455 and B = 0.2364
(46)
Logistic growth
(47)
10
2.6
x 10
2.4
2.2
1.8
1.6
1.4
1.2
0.8
0.6
2000
2010
2020
2030
2040
2050
2060
2070
2080
2090
2100
Figure 14:
Approximations of Functions
1
y(t) = ln
sin(t) + et
10
(48)
1.2
0.8
0.6
0.4
0.2
Figure 15:
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
1
t
sin(t)
+
e
10
0.9
10
Figure 16:
1
t
sin(t)
+
e
10
10
Approximations by constants
(49)
(p(t) y(t)) dt =
a
( y(t))2 dt
Approximations by constants
( y(t))2 dt
(50)
F () = 2
( y(t)) dt
a
y(t)dt
(51)
Note that
n i=1
(52)
1
1
1
yi =
t y(ti )
n i=1
b a i=1
ba
ba
n ,
then
y(t) dt.
a
Note that
We used
d
d
( y(t)) dt =
a
b
a
( y(t))2dt
(51)
=
=
2
2 /2
/2
sin(t) dt =
[cos(t)]0
0
2
2
(0 1) = .
(51)
=
=
1
1
1 3 1
2
t + cos(t) dt =
t + sin(t)
10
3
10
0
0
1 1
+ sin(1) 0.417.
3 10
(53)
Define
F(, ) =
( + t y(t))2dt
(54)
We have
b
F
= 2 ( + t y(t)) dt
a
Z b
F
= 2 ( + t y(t))t dt
(55)
/2
sin(t) dt = 1
0
and
Z
/2
t sin(t) dt = 1.
0
The solution is
!
1 8 24
= 2
96
24
1
1
0.115
0.664
3 + 10 sin(1)
=
,
1 1
3
1
1
2 3
20 + 10 cos(1) + 10 sin(1)
with solution 0.059 and 0.953.
We conclude that the linear least squares approximation is
given by
p(t) 0.059 + 0.953t.
Lectures INF2320 p. 71/80
(56)
Let
F(, , ) =
( + t + t 2 y(t))2 dt
(57)
F
= 2
( + t + t 2 y(t)) dt
F
= 2
( + t + t 2 y(t))t dt
F
= 2
( + t + t 2 y(t))t 2 dt
0 t /2,
/2
2 /8 3 /24
1
2
3
4
/8 /24 /64 = 1 ,
3 /24 4 /64 5 /160
for 0 t 1.
1 1/2
1/2 1/3
1/3 1/4
1
1
+
1/3
3
10 sin(1)
3
1
1
1/4 = 20
+ 10
cos(1) + 10
sin(1)
1
1
1
1/5
+
cos(1)
5
5
10 sin(1)
0.8
0.6
0.4
0.2
0
0
0.5
1.5
Figure 17:
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure 18: The function y(t) = t 2 + 101 cos(t) (solid curve) and its
least squares approximations: constant (dashed line), linear (dotted
line) and quadratic (dashed-dotted curve).
Lectures INF2320 p. 78/80