Sec 4-7
Sec 4-7
Sec 4-7
e − e−1 .
α0 = = 1.1752
2
.
α1 = 3e−1 = 1.1036
Using these values for α0 and α1, we denote the re-
sulting linear approximation by
1(x) = α0 + α1x
It is called the best linear approximation to ex in the
sense of least squares. For the error,
.
max |ex − 1(x)| = 0.439
−1≤x≤1
Errors in linear approximations of ex:
x
y=e
y=l (x) 1
1
x
-1 1
Z1 " #2
f (x) − α0 − α1x
g(α0, α1, . . . , αn) ≡ dx
− · · · − αnxn
−1
Find coefficients α0, α1, . . . , αn to minimize this in-
tegral. The integral g(α0, α1, . . . , αn) is a quadratic
polynomial in the n + 1 variables α0, α1, . . . , αn.
P0(x) = 1
1 dn h³ 2 ´ni
Pn(x) = n
· n x −1 , n = 1, 2, . . .
n!2 dx
For example,
P1(x) = x
1³ 2 ´
P2(x) = 3x − 1
2
1³ 3 ´
P3(x) = 5x − 3x
2
1³ 4 2
´
P4(x) = 35x − 30x + 3
8
The Legendre polynomials have many special proper-
ties, and they are widely used in numerical analysis
and applied mathematics.
y
x
-1 1
P (x)
1
P (x)
2
P (x)
3
P (x)
4
-1
(f − p, f − p) (3)
We begin by writing p(x) in the form
n
X
p(x) = β j Pj (x)
j=0
n
X
p(x) = β j Pj (x)
j=0
Substitute into (3), obtaining
ge (β 0
, β 1, . . . , β n) ≡ (f − p, f − p)
n
X n
X
= f − β j Pj , f − β iPi
j=0 i=0
Expand this into the following:
n (f, P )2
X j
ge = (f, f ) −
j=0 (Pj , Pj )
n ³ " #2
X ´ (f, Pj )
+ Pj , Pj β j −
j=0 (Pj , Pj )
Looking at this carefully, we see that it is smallest
when
(f, Pj )
βj = , j = 0, 1, . . . , n
(Pj , Pj )
Looking at this carefully, we see that it is smallest
when
(f, Pj )
βj = , j = 0, 1, . . . , n
(Pj , Pj )
The minimum for this choice of coefficients is
n (f, P )2
X j
ge = (f, f ) −
j=0 (Pj , Pj )
We call
n (f, P )
X j
n(x) = Pj (x) (4)
j=0 (Pj , Pj )
the least squares approximation of degree n to f (x)
on [−1, 1].
j 0 1 2 3
βj 2.35040 0.73576 0.14313 0.02013
0.0112
x
-1 1
-0.00460