0% found this document useful (0 votes)
93 views

MA128ALectureWeek3 PDF

The bisection method is an algorithm for finding the roots or zeros of a continuous function. It works by repeatedly bisecting an interval and narrowing in on a root. The key steps are: (1) choose an initial interval [a,b] where the function changes sign, (2) calculate the midpoint p of the interval, (3) based on the sign of f(p), replace either [a,p] or [p,b] as the new interval, and (4) repeat until the interval is sufficiently narrow. The secant method is similar to Newton's method but replaces the derivative calculation with the slope between two previous points to approximate the derivative.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views

MA128ALectureWeek3 PDF

The bisection method is an algorithm for finding the roots or zeros of a continuous function. It works by repeatedly bisecting an interval and narrowing in on a root. The key steps are: (1) choose an initial interval [a,b] where the function changes sign, (2) calculate the midpoint p of the interval, (3) based on the sign of f(p), replace either [a,p] or [p,b] as the new interval, and (4) repeat until the interval is sufficiently narrow. The secant method is similar to Newton's method but replaces the derivative calculation with the slope between two previous points to approximate the derivative.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

Bisection Method

I Given continuous function f (x) on the interval [a, b] with


f (a) · f (b) < 0, there must be a root in (a, b).
I To find a root: set [a1 , b1 ] = [a, b].
a1 +b1
I set p1 = 2 and compute f (p1 ).
I if f (p1 ) = 0, then quit with root p1 (must be very lucky.)
I if f (a1 ) · f (p1 ) < 0, then set [a2 , b2 ] = [a1 , p1 ],
I otherwise (f (p1 ) · f (b1 ) < 0) set [a2 , b2 ] = [p1 , b1 ],
a2 +b2
I repeat with p2 = 2 .
Bisection Method
Naive Bisection Method
Proof of Thm 2.1
Assume that f (pn ) 6= 0 for all n.
I By construction

a1 ≤ a2 ≤ · · · ≤ an ≤ · · · ≤ · · · ≤ bn ≤ · · · ≤ b2 ≤ b1 .
Thus sequences {an } and {bn } monotonically converge to
limits a∞ ≤ b∞ , respectively.
I Since f (an ) · f (bn ) < 0 for all n, it follows that
f (a∞ ) · f (b∞ ) ≤ 0, and thus a root p ∈ [a∞ , b∞ ] ⊂ [an , bn ]
exists.
bn −an
I Since pn = an +b 2 , it follows that |pn − p| ≤
n
2 .
I By construction
bn−1 − an−1 bn−2 − an−2 b 1 − a1 b−a
bn −an = = 2
= · · · = n−1 = n−1 .
2 2 2 2
I Put together,
b−a
|pn − p| ≤ .
2n
I In fact, a∞ = b∞ = p.
Example Function with Root
x 2
function = $e − (2+2x )$
7

−1

−2

−3
2.5 2.6 2.7 2.8 2.9 3 3.1 3.2 3.3 3.4 3.5
Bisection Method with 52 Points
7

−1

−2

−3
2.5 2.6 2.7 2.8 2.9 3 3.1 3.2 3.3 3.4 3.5
Fixed Point Iteration

The number p is a fixed point for a given function g if g (p) = p.


Fixed Point Example
Fixed Point Theorem (I)
Proof of Thm 2.3
I If g (a) = a or g (b) = b,then g has a fixed point at an
endpoint.
I Otherwise, g (a) > a and g (b) < b. The function
h(x) = g (x) − x is continuous on [a, b], with
h(a) = g (a) − a > 0 and h(b) = g (b) − b < 0.
I This implies that there exists p ∈ (a, b), h(p) = 0.
I g (p) − p = 0, or p = g (p).
If |g 0 (x)| ≤ k < 1 for all x in (a, b), and p and q are two distinct
fixed points in [a, b]. Then a number ξ exists
g (p) − g (q)
= g 0 (ξ) < 1.
p−q
So
p−q g (p) − g (q)
1= = = g 0 (ξ) < 1.
p−q p−q
This contradiction implies uniqueness of fixed point.
Fixed Point Iteration

Given initial approximation p0 , define Fixed Point Iteration

pn = g (pn−1 ), n = 1, 2, · · · ,

If iteration converges to p, then

p = lim pn = lim g (pn−1 ) = g (p).


n→∞ n→∞
Fixed Point Theorem (II)
Fixed Point Example x − x 2 = 0: no convergence

g (x) = x 2 ∈ [1, ∞] for x ∈ [1, ∞],


0
|g (x)| unbounded in[1, ∞].
Fixed Point Example x − sin(x) = 0: slow convergence

g (x) = sin(x) ∈ [−1, 1] for x ∈ [−1, 1],


0
|g (x)| ≤ 1 ∈ [0, 1].
Fixed Point Example x − sin(x) = 0: slow convergence

g (x) = sin(x) ∈ [−1, 1] for x ∈ [−1, 1],


0
|g (x)| ≤ 1 ∈ [0, 1].
Fixed Point Example x − log(2 + 2x 2 ) = 0: normal
convergence

g (x) = log(2 + 2x 2 ) ∈ [2, 3] for x ∈ [2, 3],


4
|g 0 (x)| ≤ ∈ [2, 3].
5
FixedPoint Method with 66 Points
0

−0.5

−1

−1.5

−2

−2.5
2.5 2.55 2.6 2.65 2.7 2.75 2.8 2.85 2.9 2.95 3
Fixed Point: x − (1 − cos(x)) = 0: fast convergence

g (x) = 1 − cos(x) ∈ [−1, 1] for x ∈ [−1, 1],


x2 1
|g 0 (x)| ≤ ≤ .
2 2
Fixed Point: x − (1 − cos(x)) = 0: fast convergence

g (x) = 1 − cos(x) ∈ [−1, 1] for x ∈ [−1, 1],


x2 1
|g 0 (x)| ≤ ≤ ∈ [0, 1].
2 2
Fixed Point Theorem (II)
Proof of Thm 2.4

I A unique fixed point p ∈ [a, b] exists.


I

|pn − p| = |g (pn−1 ) − g (p)| = |g 0 (ξn )(pn−1 − p)| ≤ k|pn−1 − p|

|pn − p| ≤ k|pn−1 − p| ≤ k 2 |pn−2 − p| ≤ · · · ≤ k n |p0 − p|.

I Since
lim k n = 0,
n→∞

{pn }∞
n=0 converges to p.
Newton’s Method for solving f (p) = 0
I Suppose that f ∈ C 2 [a, b].
I Let p0 ∈ [a, b] be an approximation to p with

f 0 (p0 ) 6= 0, and |p − p0 | ”small”.

I Taylor expand f (x) at x = p:

(p − p0 )2 00
0 = f (p) = f (p0 ) + (p − p0 )f 0 (p0 ) + f (ξ(p)).
2
”Solve” for p:

f (p0 ) (p − p0 )2 00
p = p0 − − f (ξ(p))
f 0 (p0 ) 2f 0 (p0 )
f (p0 ) def
≈ p0 − 0 = p1 .
f (p0 )
f (pk )
Newton’s Method: pk+1 = pk − f 0 (pk ) , k = 0, 1, · · ·
Newton’s Method for solving f (p) = 0

f (p0 ) (p − p0 )2 00
p = p0 − − f (ξ(p))
f 0 (p0 ) 2f 0 (p0 )
f (p0 ) def
≈ p0 − 0 = p1 .
f (p0 )

I If p0 ”close to” p, we can expect fast convergence.


I Best hope in practice: p0 ”not too far from” p. Newton’s
method may or may not converge.
I If Newton’s method converges, it converges quickly.
Geometry of Newton’s Method

I Taylor expand f (x) at x = p:

(p − p0 )2 00
0 = f (p) = f (p0 ) + (p − p0 )f 0 (p0 ) + f (ξ(p)).
2
I Replace f (x) by a straight line:

f (p0 ) + (p − p0 )f 0 (p0 ) ≈ 0.

I
f (p0 )
p ≈ p0 −
f 0 (p0 )
is the horizontal intercept of straight line

y = f (p0 ) + (x − p0 )f 0 (p0 )
Newton Method
Newton Method for f (x) = e x − (2 + 2x 2 )
Newton Method with 8 Points
8

−2

−4
2.6 2.8 3 3.2 3.4 3.6 3.8
Computing square root with Newton’s Method

def √
I Given a > 0, p = a is positive root of equation
def
f (x) = x 2 − a = 0.

I Newton’s Method
p2 − a
 
1 a
pk+1 = pk − k = pk + , k = 0, 1, 2, · · · ,
2pk 2 pk
I Newton’s Method is well defined for any p0 > 0.
Newton Method for square root
Proof of Theorem 2.6
I Newton’s method is fixed point iteration
pn = g (pn−1 ), g (x) = x − ff 0(x)
(x) .
I 0
Since f (p) 6= 0, there exists an interval
[p − δ1 , p + δ1 ] ⊂ [a, b] on which f 0 (x) 6= 0. Thus, g (x) is
defined on [p − δ1 , p + δ1 ].
I

f 0 (x) f 0 (x) − f (x) f 00 (x) f (x) f 00 (x)


g 0 (x) = 1− = ∈ C [p−δ1 , p+δ1 ].
(f 0 (x))2 (f 0 (x))2
I Since g 0 (p) = 0, there exists 0 < δ < δ1 so that
1
|g 0 (x)| ≤ κ (= ), for all x ∈ [p − δ, p + δ].
2
I If x ∈ [p − δ, p + δ], then
|g (x)−p| = |g (x)−g (p)| = |g 0 (ξ)(x −p)| ≤ κ|x −p| ≤ |x −p|.
Therefore g (x) ∈ [p − δ, p + δ].
I {pn } converges to p by Fixed Point Theorem.
Newton Method Divergence Example: f (x) = x 1/3
Secant Method: Poor man’s Newton Method
Motivation

I Newton method style of fast convergence


I Avoid need for derivative calculations.

Approach

f (pn )
I Newton method: pn+1 = pn − f 0 (pn ) .
I Replace f 0 (pn ) by its cheap approximation
f (pn ) − f (x) f (pn ) − f (pn−1 )
f 0 (pn ) = lim ≈ .
x→ pn − x pn − pn−1
I Secant method
f (pn )(pn − pn−1 )
pn+1 = pn − , n = 1, 2, · · · .
f (pn ) − f (pn−1 )
Secant Method: Geometry

I ”Approximate” f (x) by a straight line

(x − p0 )f (p1 ) − (x − p1 )f (p0 )
f (x) ≈ .
p1 − p0

Both f (x) and straight line go through points


(p0 , f (p0 )), (p1 , f (p1 )).
I Let approximate root p2 be the x-intercept of the straight line

p0 f (p1 ) − p1 f (p0 ) f (p1 )(p1 − p0 )


p2 = = p1 − .
f (p1 ) − f (p0 ) f (p1 ) − f (p0 )
Secant Method: Illustration
Fixed point for g (x) = log (2 + 2x 2 )
SecantMethod with 11 Points
25

20

15

10

−5
2.5 3 3.5 4
Performance: number of iterations vs. error in the solution

I Function to be considered

g (x) = log (2 + 2x 2 ), f (x) = x − g (x) = x − log (2 + 2x 2 ).

I Root p of f (i.e., f (p) = 0)

p = 2.98930778246493e + 00.

I Bisection Method
I Fixed Point Iteration
I Newton’s Method
I Secant Method
Bisection Method Order of Convergence
Convergence Rate, Bisection Method
0
10

−2
10

−4
10

−6
10

−8
10

−10
10

−12
10

−14
10

−16
10
0 10 20 30 40 50 60
Fixed Point Iteration Order of Convergence
Convergence Rate, Fixed Point Method
0
10

−5
10

−10
10

−15
10
0 10 20 30 40 50 60 70
Secant Method Order of Convergence
Convergence Rate, Secant Method
2
10

0
10

−2
10

−4
10

−6
10

−8
10

−10
10

−12
10
1 2 3 4 5 6 7 8 9 10
Newton Method Order of Convergence
Convergence Rate, Newton Method
0
10

−2
10

−4
10

−6
10

−8
10

−10
10

−12
10

−14
10
1 2 3 4 5 6 7
Order of convergence
Linear and Quadratic Order of convergence
Recall rate of convergence: the Big O

the Big O() = rate of convergence


Recall rate of convergence: the Big O
Linear and Quadratic Order of convergence
I Suppose that {pn }∞
n=1 is linearly convergent to 0,
|pn+1 | |pn+1 |
lim = 0.5, or roughly ≈ 0.5,
n→∞ |pn | |pn |
hence pn ≈ (0.5)n |p0 |.
I Suppose that {p̃n }∞
n=1 is quadratically convergent to 0,
|p̃n+1 | |p̃n+1 |
lim = 0.5, or roughly ≈ 0.5.
n→∞ |p̃n |2 |p̃n |2
But now
Linear and Quadratic Order of convergence
Order of convergence
Linear and Quadratic Order of convergence
Computing square root with Newton’s Method

def √
I Given a > 0, p = a is positive root of equation
def
f (x) = x 2 − a = 0.

I Newton’s Method
p2 − a
 
1 a
pk+1 = pk − k = pk + , k = 0, 1, 2, · · · ,
2pk 2 pk
I Newton’s Method is well defined for any p0 > 0.

Newton’s Method for a converges quadratically if p0 > 0

I {pk }∞
k=1 bounded below by a:
√ 2
√ √ pk−1 − a
 
1 a
pk − a = pk−1 + − a= ≥ 0, k = 1, 2, · · · ,
2 pk−1 2pk−1
I {pk }∞
k=1 monotonically decreasing:

a − pk2
 
1 a
pk+1 − pk = pk + − pk = ≤ 0, k = 1, 2, · · · ,
2 pk 2pk
def
I limk→∞ pk = p exists and satisfies Newton Iteration:
√ √
 
1 a
p= p+ ≥ a, therefore p = a.
2 p
I Newton’s Method quadratically convergent

|pk − a| 1 1
lim √ 2 = lim = √ .
k→∞ p k→∞ 2pk−1 2 a
k−1 − a

Linear Convergence Theorem of Fixed Point Iteration

I Let g ∈ C [a, b] satisfy g (x) ∈ [a, b] for all x ∈ [a, b].


I Assume g 0 (x) continuous with |g 0 (x)| ≤ κ for all x ∈ (a, b)
and constant κ < 1.
I Then Fixed Point Iteration

pk = g (pk−1 ), k = 1, 2, · · · ,

for any p0 ∈ [a, b] converges to fixed point p ∈ [a, b] with

|pk+1 − p|
lim = |g 0 (p)| ≤ κ, if pk 6= p for all k.
k→∞ |pk − p|

(not linear convergence if g 0 (p) = 0)


Proof of Linear Convergence

I By Fixed Point Theorem, Fixed Point p ∈ [a, b] uniquely


exists, and FPI converges to p.
I By Mean Value Theorem, there exists a ξk in between pk and
p such that

g (pk ) − g (p) = g 0 (ξk )(pk − p), for all k.

I Therefore

lim g 0 (ξk ) = g 0 (p)


k→∞
|pk+1 − p| |g (pk ) − g (p)| |g 0 (ξk )(pk − p)|
lim = lim = lim
k→∞ |pk − p| k→∞ |pk − p| k→∞ |pk − p|
0
= |g (p)|
Quadratic Convergence of Fixed Point Iteration

I Assume FPI {pk }∞ 0


k=1 converges to p, with g (p) = 0, then

|pk+1 − p| 1
lim 2
= |g 00 (p)|, if pk 6= p for all k.
k→∞ |pk − p| 2

(not quadratic convergence if g 00 (p) = 0)


Proof of Quadratic Convergence

I Taylor expansion at p:

ξk between p, pk 1
g (pk ) ========== g (p) + g 0 (p)(pk − p) + g 00 (ξk )(pk − p)2
2
1 00
========== g (p) + g (ξk )(pk − p)2
2
I Therefore
|pk+1 − p| |g (pk ) − p| 1 |g 00 (ξk )(pk − p)2 |
lim = lim = lim
k→∞ |pk − p|2 k→∞ |pk − p|2 2 k→∞ |pk − p|2
1 00
= |g (p)|
2
Quadratic Convergence of Newton Iteration
I Newton Iteration is FPI with
f (x)
g (x) = x − ,
f 0 (x)
and with f (p) = 0.
I derivatives
f (x)f 00 (x)
g 0 (x) =
(f 0 (x))2
f 00 (x) f 0 (x) f 000 (x) − 2 (f 00 (x))2
g 00 (x) = + f (x)
f 0 (x) (f 0 (x))3
I therefore
f 00 (p)
g 0 (p) = 0, and g 00 (p) = 0 ,
f (p)
1 f 00 (p)

|pk+1 − p|
lim = , if f 0 (p) 6= 0.
k→∞ |pk − p|2 2 f 0 (p)
Multiple roots: f (p) = 0, f 0 (p) = 0

I Definition: A solution p of f (x) = 0 is a root of multiplicity


m of f if for x 6= p, we can write

f (x) = (x − p)m q(x), where lim q(x) 6= 0.


x→p

I Theorem: The function f ∈ C m [a, b] has a root of


multiplicity m at p in (a, b) if and only if

0 = f (p) = f 0 (p) = f 00 (p) = · · · = f (m−1) (p), but f (m) (p) 6= 0.

I simple root: f satisfies f (p) = 0, but f 0 (p) 6= 0.


Example: f (x) = e x − x − 1, f (0) = f 0 (0) = 0, f 00 (0) = 1

Function Newton’s Method


Modified Newton Method

m f (pk )
pk+1 = pk − , for k = 1, 2, · · · , (m = multiplicity of root p.)
f 0 (pk )

I m = 2 for function f (x) = e x − x − 1,


Modified Newton Method is Quadratically Convergent

m f (x)
pk+1 = g (pk ), g (x) = x − , for k = 1, 2, · · · ,
f 0 (x)

I Let f (x) = (x − p)m q(x), q(p) 6= 0.


I
m f (x) m (x − p)q(x)
g (x) = x − =x− .
f 0 (x) mq(x) + (x − p)q 0 (x)
I g 0 (p) = 0, hence quadratic convergence.
Accelerating Convergence: Aitken’s ∆2 Method
I Suppose {pk }∞
k=1 linearly converges to limit p,

pk+1 − p
lim = λ, |λ| < 1.
k→∞ pk − p
I Define
pk+1 − p def
= λk ,
pk − p
so that {λk }∞
k=1 converges to λ.
I It follows that
pk+2 − p pk+1 − p
0 ≈ λk+1 − λk = − .
pk+1 − p pk − p
I Solve for p:
2
pk+1 − pk pk+2 (λk+1 − λk )(pk+1 − p)(pk − p)
p= + .
2pk+1 − pk − pk+2 2(pk+1 − p) − (pk − p) − (pk+2 − p)
Accelerating Convergence: Aitken’s ∆2 Method

2
pk+1 − pk pk+2
def
pbk =
2pk+1 − pk − pk+2
(pk+1 − pk )2 def
= pk − = {∆2 }(pk ).
pk+2 − 2pk+1 + pk

Approximation Error

(λk+1 − λk )(pk+1 − p)(pk − p)
|b
pk − p| =

2(pk+1 − p) − (pk − p) − (pk+2 − p)


k+1 − λk )(pk − p)

=

 −1
p −p pk+2 −p
2 − pk+1 −

k −p pk+1 −p

(λk+1 − λk )(pk − p)

 O (|pk − p|) .
2 − λ−1 − λ
Accelerating Convergence: Aitken’s ∆2 Method

pn = cos(1/n) Error Plots


Accelerating Convergence: Steffensen’s Method

I Aitken’s Acceleration for a given {pk }∞


k=1 :

(pk+1 − pk )2
{∆2 }(pk ) = pk − .
pk+2 − 2pk+1 + pk
I Steffensen’s Method: use Aitken’s Acceleration as soon as
iterations are generated:
(0)
I Given p0
I for k = 0, 1, 2, · · · ,
(k) (k) (k) (k) (k+1) (k)
p1 = g (p0 ), p2 = g (p1 ), p0 = {∆2 }(p0 ).
Fixed point for g (x) = log (2 + 2x 2 )
FixedPoint Method with 66 Points
0

−0.5

−1

−1.5

−2

−2.5
2.5 2.55 2.6 2.65 2.7 2.75 2.8 2.85 2.9 2.95 3
Fixed Point Iteration: Linear Convergence
Convergence Rate, Fixed Point Method
0
10

−5
10

−10
10

−15
10
0 10 20 30 40 50 60 70
Aitken’s Method: Faster, but Linear Convergence

Convergence Rate, Aitken Method


0
10

−2
10

−4
10

−6
10

−8
10

−10
10

−12
10

−14
10

−16
10
0 10 20 30 40 50 60 70
Steffenson’s Method: Quadratic Convergence

Convergence Rate, Steffen Method


0
10

−1
10

−2
10

−3
10

−4
10

−5
10

−6
10

−7
10

−8
10

−9
10
1 1.5 2 2.5 3 3.5 4 4.5 5
Newton’s Method on Polynomial roots = Horner’s Method
Let
P(x) = an xn + an−1 xn−1 + · · · + a1 x + a0 .
Horner’s Method computes P(x0 ) and P 0 (x0 )
I define bn = an
I for k = n − 1, n − 2, · · · , 1, 0

bk = ak + bk+1 x0 ,
I then
b0 = P(x0 )
P(x) = (x − x0 ) Q(x) + b0
Q(x) = bn xn−1 + bn−1 xn−2 + · · · + b2 x + b1 .
I it follows
P 0 (x) = Q(x) + (x − x0 ) Q 0 (x)
P 0 (x0 ) = Q(x0 )
Horner’s Method
Muller’s Method: finding complex roots

I Given three points (p0 , f (p0 )), (p1 , f (p1 )), and (p2 , f (p2 )).
I Construct a parabola through them,
I p3 is the intersection of x-axis with parabola closer to p2 .
Secant Method vs. Muller’s Method
Muller’s Method: derivation
Choose parabola
P(x) = a(x − p2 )2 + b(x − p2 ) + c.
a, b, c satisfy
Muller’s Method: finding complex roots

I p3 is the intersection of x-axis with parabola closer to p2 .


Muller’s Method

Muler Method function f(p) = p4−3*p3+p2+p+1.


1
10

0
10

−1
10

−2
10

−3
10

−4
10

−5
10

−6
10

−7
10
1 2 3 4 5 6 7 8 9
Choices, and more Choices

I Bisection Method: slow (linearly convergent); reliable (always


finds a root given interval [a, b] with f (a) · f (b) < 0.)
I Fixed Point Iteration: slow (linearly convergent); no need for
interval [a, b] with f (a) · f (b) < 0.
I Newton’s Method: fast (quadratically convergent); could get
burnt (need not converge.)
I Secant Method: between Bisection and Newton in speed;
need not converge; no derivative needed.
I Steffensen’s Method: fast (quadratically convergent); no
derivative needed. not a method of choice in higher
dimensions.
I Muller’s Method: can handle complex roots; need not
converge.
Brent’s Method: Motivation

I (Mostly) speed of Steffensen’s Method


I Reliability of Bisection Method
Brent’s Method = Zeroin
Brent’s Method: Zeroin (Wikipedia)
Brent’s Method: Zeroin
Brent’s Method

I Worst case number of iterations = (n2 ), where n is number of


iterations of Bisection Method for a given tolerance.
Modified Brent’s Method
Modified Brent’s Method
Modified Brent’s Method
Modified Brent’s Method
Interpolation and Approximation (connecting the dots)
US population census data available every ten years.

I What was US population in year 1996?


I What will US population be in year 2017?
Connecting two dots

I Given two distinct dots, there is a unique line connecting


them.
Connecting two dots

I Given two distinct points (p0 , f (p0 )) and (p1 , f (p1 )), there is
a unique line connecting them
x − p1 x − p0
P(x) = f (p0 ) · + f (p1 ) ·
p0 − p1 p1 − p0
def
= f (p0 ) · L0 (x) + f (p1 ) · L1 (x),

with L0 (x), L1 (x) unrelated to f (p0 ), f (p1 ).

L0 (p0 ) = 1, L0 (p1 ) = 0,
L1 (p0 ) = 0, L1 (p1 ) = 1.
Connecting two dots
I Given two distinct points (p0 , f (p0 )) and (p1 , f (p1 )), there is
a unique line connecting them
x − p1 x − p0
P(x) = f (p0 ) · + f (p1 ) ·
p0 − p1 p1 − p0
Connecting n + 1 dots
I Given n + 1 distinct points
(x0 , f (x0 )), (x1 , f (x1 )), · · · , (xn , f (xn )),
I Find a degree ≤ n polynomial
P(x) = an x n + an−1 x n−1 + · · · + a1 x + a0 ,
so that P(x0 ) = f (x0 ), P(x1 ) = f (x1 ), · · · , P(xn ) = f (xn ).
Connecting n + 1 dots

I Would like to write P(x) as

P(x) = f (x0 )L0 (x) + f (x1 )L1 (x) + · · · + f (xn )Ln (x),

where L0 (x), L1 (x), · · · , Ln (x) are unrelated to


f (x0 ), f (x1 ), · · · , f (xn ).
I at each node xj , j = 0, 1, · · · , n,

f (xj ) = P(xj ) = f (x0 )L0 (xj ) + f (x1 )L1 (xj ) + · · · + f (xn )Ln (xj )

I This suggests for all i, j,



1, if i = j,
Li (xj ) =
0, if i 6= j,
Largrangian Polynomials

P(x) = f (x0 )L0 (x) + f (x1 )L1 (x) + · · · + f (xn )Ln (x),

1, if i = j,
Li (xj ) =
0, if i 6= j,

xj is a root of Li (x) for every j 6= i, so


Y x − xj
Li (x) = .
xi − xj
j6=i
Quadratic Interpolation
Quadratic Interpolation: Solution
Quadratic Interpolation: Solution
Quadratic Interpolation: Solution
Quadratic Interpolation: Solution

You might also like