lecture 06 solution of equations in one variable
TRANSCRIPT
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
1/67
the most basic problems of numericalapproximation,
the root-finding problems
Solutions of Equations in One Variable
Chapter 2
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
2/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
3/67
#onlinear '0uations in /ne ariable
• Examples of nonlinear equation in one variable
•
Given a function , we are looking for a value ,s t ! a root of the equation, or a "ero of the
function # $he problem is calle% the root fin%ing
problem or the "ero fin%ing problem
sin&2 = x x
+2112111 2"&+ = x x x x x
3 x
f
( ) f x =
x ( ) f x
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
4/67
'xamples
• &onlinear equations can have an' number of solutions
2
" 2
1 has no solution
has one solution
&sin has t$o solutions
11 has three solutionssin has infinitel man solutions
x
x
e
e x
x x
x x x x
−
+ =
− =
− =
+ + − ==
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
5/67
'xistence4uni0ueness
• Existence an% uniqueness of solutions are much more
complicate% for nonlinear equations than for linear
equations• (f is continuous an%
then the interme%iate value theorem implies
there exists such that
f ))(sgn())(sgn( b f a f ≠
5 x .)( 5 = x f
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
6/67
(nterme%iate Value $heorem) (f an% is an'
number between an% , then there exists a
number in for which
6,7 baC f
c
K
.)( K c f =
)(a f )(b f
6,7 ba
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
7/67
*ssumption) is a continuous function %efine% on
, with an% of opposite signs(%ea) $he metho% calls for a repeate% halving of
subintervals of an%, at each step, locating the half
containing
Bisection Method
)(a f
f
)(b f 6,7 ba
p
6,7 ba
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
8/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
9/67
+epeat until
Set an% , let
(f then set
(f then , %one
-isection .etho%) /roce%ure
(f then
&ote) $he metho% can pro%uce a false root if is
%iscontinuous on
or
else set
,288 toleranceab k k 2k k
ba p +=
k p p =
bb =1aa =12
111
ba p
+=
, ,122
pbaa =)()( 11
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
10/67
(&/0$ en%points a, b tolerance $O1 maximumnumber of iterations & 3
O0$/0$ approximate solution p or message of failure
Step 4 set i546*5f!a#
Step 2 while ( & 3 %o Steps 789Step 7 set p5a:!b8a#;2 !compute p i #
6/5f!p#
≤
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
11/67
Step 2 while ( & 3 %o Steps 789
Step 7 set p5a:!b8a#;2 !compute p i #6/5f!p#
Step < (f 6/53 or !b8a#;2=$O1 then
O0$/0$ !p#
!proce%ure complete% successfull' #
Stop
Step > Set i5i:4
≤
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
12/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
13/67
4 4 3 2 3 4 > 2 7A>2 4 3 4 > 4 2> 84 AD9 A7 4 2> 4 > 4 7A> 3 49244< 4 2> 4 7A> 4 742> 83 < 7D> 4 742> 4 7A> 4 7 83 7>3D9 4 7 4 7A> 4 7>D7A> 83 3D9D7A> 4 7A> 4 79A4 A> 3 37279 4 7>D7A> 4 79A4 A> 4 7972 42> 83 3724>
D 4 7972 42> 4 79A4 A> 4 79>27 3 3333A243 4 7972 42> 4 79>27 4 79A 47 83 3493>44 4 79A 47 4 79>27 4 79 83 334D<
'xample has a root in F4,2Correct value) 4 79>273347
k k a k pk b )( k p f
1& 2" = x x
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
14/67
$heorem Suppose that an%
$he bisection metho% generates a sequence
approximating a "ero of with
&ote) !4# gives a boun% for the approximating error
!2# the number of iterations obtaine% from this boun%,
in man' cases, is much larger than the actualnumber of iterations require%
!7# assumes infinite8%igit arithmetic
∞=19: k k p
f
)()(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
15/67
• Other stopping proce%ures can be applie%)
-isection .etho%) &otes
• Hifficulties can arise (t is possible that
converges to "ero, while %iverges (t is also
possible that is close to "ero while
%iffers significantl' from
best, if noa%%itional knowle%ge
9: 1 N N p p
9: N p)( N p f N p
p
1
1
,
4 8 8 ,
8 ( ) 8
N N
N N N N
N
p p
p p p p
f p
ε
ε
ε
− <
− < ≠
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
16/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
17/67
• $o %etermine which subintervals ofcontains a root of , it is better to make use of
the signum function, which is %efine% as
gives the same result but avoi%s the possibilit' of
overflow or un%erflow in
$he test
6,7 k k ba
>
=<
=if 1
if
if 1
)sgn(
x
x
x
x
f
sgn( ( )) sgn( ( ))
in stead of ( ) ( )
k k
k k
f a f b
f a f b
>
>
)( k b f ( )5k f a
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
18/67
• use no magnitu%es of function values, but signsBisection Method 3 ;ummar
• given error tolerance of , requires
iterations regar%less of the function involve%
• at each iteration, length of interval containing the
solution is re%uce% b' half, length of interval after
iterations is , convergence rate is linear• one bit of accurac' is gaine% in the approximate
solution for each iteration
• is certain to converge, but slowl'
−tol
ab2logtol
k ab 24)( −
k
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
19/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
20/67
'xample "2,2)( 2 ≤ x x x g
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
21/67
$heorem)
a (f an% for all
then has a fixe% point in
b (f, in a%%ition, exists on an% a positive
constant exists with
then the fixe% point in
is unique
6,7 baC g 6,,7 ba x
6,7 ba
6,7)( ba x g
g
6,7 ba
)(< x g
1
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
22/67
'xample
minimum atmaximum at
11,"4)1()( 2 ≤ x x x g
11
,"42)(<
≤
=
x
x x g
)1,1("428)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
23/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
24/67
'xample has a root in F4,2
x x x x
x x g x
x x g x
x x g x
x x
x g x
x x x x g x
="1&
)( (e)
&1
)( (d)
24)1()( (c)
&1
)( (b)
1&)( (a)
2
2"
+
241
&
241""
241
2
2"
1
+−−
+
−
−
+
1& 2" = x x
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
25/67
Correct value) 4 79>273347 choose
!a# !b# !e#!c# !%#
"-+2" 1".1""-+2" -.12+"-+2" 2"-.12
"-+2" 1".1"-+22"-=.11+ "-+2" 1&.1"-+&1 -2.11
"-+2" 12.1"-&=>=21>.1?"-+2" 22.1"-+?1->"&.1="-+22??&2.1"-"==> &.1>"-+2" +>-.1"->=&-?-=.1-"-+22++?&.1"- ?&1?".1+
"-+2" 1".1"-+2-&>&=.1">+1> +2".1=e".1&"-+2" 1&.1"-&?+> 1+.1"&+&+=">&.1)-+.=(>.&-?""-+2-2 1+.1"->">-">2.1& 2+& = &.1??-?.2>"2.-2">""""""".1"&="??>2+.12=-?+">-=.1=1-+.=>+.1+.1+.1+.1+.1+.1
241−
−
k
+.1 = p
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
26/67
'xample has a root in F4,2
most powerful an%well8known
numerical metho%
x x x x x x g x
x x g x
x x g x
x x
x g x
x x x x g x
="1&)( (e)
&
1)( (d)
24)1()( (c)
&1
)( (b)
1&)( (a)
2
2"
+
241
&
241""
241
2
2"1
+−−
+
−
−
+
1& 2" = x x
)2,1( 18)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
27/67
6ixe%8/oint $heorem)
1et be such that for all
Suppose, in a%%ition, that exists on an% thata constant exist with
$hen for an' the sequence %efine% b'
converges to the unique fixe% point with error
boun%s
,1),( 1 ≥− n p g p nn
6,7 baC g 6.,7 ba x
),( ba
6,7)( ba x g
< g
),,( allfor ,8)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
28/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
29/67
1
1
1
1
1
1
1
1
)(
)()(
)(<
)(<
)(
−
−
−
−
−
−
−−
−−
≈
−−
≈
−
nn
n
nn
nn
n
n
n
nn
p p p f
p p p f p f
p f
p f
p f p p
p g
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
30/67
•
choose an initial approximation• let , for each
$heorem) 1et (fthen there exists a
&ewton8+aphson .etho%
p
)(<)(
1
11
−
−− −
n
nnn p f
p f p p 1n
).,( δ+ p p p
,)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
31/67
&ewton8+aphson .etho%) &otes
•
&ewton s formula can generall' be use% for an' pol'nomial or non8pol'nomial function
• 6irst approximations can be obtaine% b'
%rawing the graph or examining the function
• (n general, the closer the first approximations is to thereal root the faster the sequence converges to the root
• Gives problem if)($hen)(< = p f p f
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
32/67
&ewton8+aphson .etho%) &otes
•
Converges provi%e% a sufficientl' accurate initialapproximation is chosen
• (n a practical application, an initial approximation
chosen, the metho% will generall' convergesquickl' to the root, or it will be clear thatconvergence is unlikel'
• Extremel' powerful, but has maKor weakness) thenee% to know the %erivative of the function ateach iteration
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
33/67
let for each
choose an initial approximation
•
let
for each
Secant .etho%
&ewton8+aphson .etho%
choose an initial approximation p
1, p p
)()()()(
2121
1
1 −−
−− −− nnnn
n
nn p p p f p f p f
p p
2n
)()()(
)(<
21
211
−
−− −
−≈nn
nnn p p
p f p f p f
11
1
( ) ,
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
34/67
starting with twoinitialapproximations
in stea% of one asin the &ewton s
metho%
alwa's uses the
two newest points
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
35/67
Method of False osition (@egula Falsi)• choose an initial approximation such that
let
let
or
Continue Similarl'
1, p p
)()()(
)(1
1
112 p p p f p f
p f p p −
−
)()(!f 12 < p f p f )()()()( 12
12
12" p p p f p f
p f p p −−
)()( 1 < p f p f
)()()()(
22
2" p p p f p f p f
p p −− )()(!f 2 > p f p f
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
36/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
37/67
Aefinition ;uppose is a se0uence no$nto con*erge to Cero, and con*erges to a num
ber . !f a positi*e constant exists $ith
then $e sa that con*erges to $ith
rate of
for large n
&ot obvious how to use this %efinition to tell the rate ofconvergence of the sequence obtaine% using an iterativetechniqueL
'rror nal sis for !terati*e Methods
∞
= 19: nn∞
= 19: nn
K
)( nO
n n K ≤
1n n ∞
=
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
38/67
'rror nal sis for !terati*e Methods• 6or general iterative metho%s, %efine error at iteration
b' where is the approximate solutionan% is the true solution
• * sequence converges with rate if
for some finite non"ero constant
• 6or metho%s that maintain interval known to contain
the solution, rather than the specific approximatevalue for the solution, take error to be the length of
the interval that contains the true solution
k
5 x x e k k −5 x
k x
r C e
er
k
k
k =
∞
1lim
C
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
39/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
40/67
"?"1?2
12
+2
"1
11
11
1211
1=>>+.+1=12+.>>1=&2.11+-2+.1-
1-+--.&112+."+1+1=."12+.-&1=12+.>12+.1" 12+.11+.22
1.+1.+1)+.()+.(
9D :se0uence9:se0uence
eon*ergencEuadraticeon*ergencFinear
−
−
−
−
−
−
−
−
∞=∞=
××××××
×
nnnnnn
n p p
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
41/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
42/67
Correct value) 4 79>273347 choose
!a# !b# !e#!c# !%#
"-+2" 1".1""-+2" -.12+"-+2" 2"-.12
"-+2" 1".1"-+22"-=.11+ "-+2" 1&.1"-+&1 -2.11
"-+2" 12.1"-&=>=21>.1?"-+2" 22.1"-+?1->"&.1="-+22??&2.1"-"==> &.1>"-+2" +>-.1"->=&-?-=.1- "-+22++?&.1"- ?&1?".1+
"-+2" 1".1"-+2-&>&=.1">+1> +2".1=e".1&"-+2" 1&.1"-&?+> 1+.1"&+&+=">&.1)-+.=(>.&-?""-+2-2 1+.1"->">-">2.1& 2+& = &.1??-?.2>"2.-2">""""""".1"&="??>2+.12=-?+">-=.1=1-+.=>+.1+.1+.1+.1+.1+.1
241−
−
k
+.1 = p
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
43/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
44/67
$heorem)
1et be the solution of the equation
Suppose that an% iscontinuous with
on an open interval containing
$hen there exists a numbersuch that, for , the sequence
%efine% b' converges at
least qua%raticall' to .oreover, for sufficientl' large values of ,
,
p
I
)( x g x =
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
45/67
&ewton s metho% is qua%raticall' convergent whenit converges
6ixe%8/oint metho% is generall' linear convergent
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
46/67
&ewton8+aphson .etho%
Secant .etho%
Generall', experience %ifficult' if
Secant metho% is superlinearl' convergent
)(<
)(
1
1
1 −
−
−−
n
n
nn p f
p f p p 1n
)()()()(
2121
11 −
−
−− −− nnnn
nnn p p p f p f
p f p p 2n
)($hen)(< = p f p f
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
47/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
48/67
'xample
1)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
49/67
then
also has a "ero at Jowever is a simple "ero
of
&ewton s metho% can then be applie% to
to give the mo%ifie% &ewton s metho%
(f is a "ero of of multiplicit' an%
)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
50/67
(n practice, multiple roots can cause serious roun%8off problems since the %enominator consists of the
%ifference of two numbers that are both close to 3
$heoreticall', the onl' %rawback is the a%%itional
calculation of an% the more laborious
proce%ure of calculating the iterates
)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
51/67
ccelerating on*ergence
• *itken s metho% can be use% to accelerate theconvergence of a sequence which is linearl'convergent , regar%less of its origin or application
•
*itken s metho% is base% on the assumption thatthe sequence %efine% b'
converges more rapi%l' to than %oes the originalsequence
• (t is rare to have qua%ratic convergence
2∆
nnn
nnnn
p p p
p p p p
+
−−+
+
12
21
2
)(G
2
∆
p
∞=19G: nn p
∞=19: nn p
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
52/67
$hen the sequence %efine% as
converges to faster than in the sense that
$heorem) Suppose that is a sequence that
converges linearl' to the limit an% that
1lim 1 <−−
∞ p p p p
n
n
n
∞=19G: nn p
p
∞=19: nn p
p
Glim =
−−
∞ p p p p
n
n
n
∞
=19: nn p
nnn
nnnn p p p
p p p p
+−−
+
+
12
21
2)(G
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
53/67
Hefinition) 6or a given sequence , the forwar%
%ifference is %efine% b'
Jigher powers of the operator are %efine%
recursivel' b'
(n particular,
for ,1 ≥+ n p p p nnn
∞=19: nn p
n p
2∆
2for ),( 1 ≥− k p p nk nk
21
1 2 1
( ) ( )
( ) ( ) 2n n n n
n n n n n
p p p p
p p p p p
∆ = ∆ ∆ = ∆ −
= ∆ − ∆ = − +
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
54/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
55/67
;teffensen%s method
n
nnnnn
nnnn p p p p p p p p p p 22
12
2
1 )(2 )(G ∆∆−+−− ++
2)2(
1)2(
2
)2()2(1
1)2(
1)1(
1)1(
2
)1()1(1
)1()(1
)(2
)()(1
)(
G)()(+
GG)(&)("
GG)(2)(1
p p g p p g p p p p p g p
p g p p p p p g p
p g p
p p
=
=
=
=
=
=
=
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
56/67
Correct value) 4 79>273347 choose
!a# !b# !e#!c# !%#
"-+2" 1".1""-+2" -.12+"-+2" 2"-.12
"-+2" 1".1"-+22"-=.11+"-+2" 1&.1"-+&1 -2.11"-+2" 12.1"-&=>=21>.1?"-+2" 22.1"-+?1->"&.1="-+22??&2.1"-"==> &.1>"-+2" +>-.1"->=&-?-=.1- "-+22++?&.1"- ?&1?".1+
"-+2" 1".1"-+2-&>&=.1">+1> +2".1=e".1&"-+2" 1&.1"-&?+> 1+.1"&+&+=">&.1)-+.=(>.&-?""-+2-2 1+.1"->">-">2.1& 2+& = &.1??-?.2>"2.-2">""""""".1"&="??>2+.12=-?+">-=.1=1-+.=>+.1+.1+.1+.1+.1+.1
241−
−
k
+.1 = p
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
57/67
Correct value) 4 79>273347 choose
!%# Steffensen s metho%
*bout the same accurac' as the
&ewton s metho%
"-+2" 1".1"-+2" 1&.1"-+2" 12.1"-+2" 22.1"-+22??&2.1"-+2" +>-.1"-+22++?&.1"-+2-&>&=.1
"-&?+> 1+.1"->">-">2.1"&="??>2+.1
+.1
+.1 = p
"->">-">2.1"&="??>2+.1
+.1
"-+2" +=".1"-+22++"&.1"-+2-+22&.1
"-+2" 1".1
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
58/67
orollar 3 (f is a pol'nomial of %egree
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
59/67
orollar 3 1et an% be pol'nomials of
%egree at most (f with , are
%istinct numbers with
then for all values of
with real or complex coefficients, then there exists
unique constants , possibl' complex, an%
unique positive integers such that
k x x x ,,,
21 n
)( x P )( x Q
nk >
,,,2,1 for ),()( k i x Q x P i i
)()( x Q x P = x
k x x x ,,, 21
1n)( x P
k mmm ,,, 21
1 2
1 2( ) ( ) ( ) ( ) .k mm m
n k P x a x x x x x x − − −L
1
1 andk
i i
m=
=
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
60/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
61/67
Ihen &ewton8+aphson metho% is use% to fin% an
approximate "ero of a pol'nomial, nee% to evaluate
an% at specifie% values
can be evalueate% in a similar manner
)( x P
)(< x P
)()(<
)(
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
62/67
$o overcome this %ifficult')
begin with a complex initial value or
.Mller s metho%
One problem with appl'ing the Secant , 6alse /osition , or
&ewton s metho% to pol'nomials is the possibilit' of the
pol'nomial having complex roots even when all thecoefficients are real numbers
$his is because, all subsequent approximations will also be
real numbers if the initial approximation is a real number
$h ) (f i l " f l i li i '
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
63/67
$heorem) (f is a complex "ero of multiplicit'
of the pol'nomial with real coefficients, then
is also a "ero of multiplicit' of the
pol'nomial , an% is a factor of
the pol'nomial
* secon% %egree pol'nomial is use% to fit three pointsin the vicinit' of the root instea% of two points as inthe Secant metho%
.uller s metho% is an interpolation metho% that usesqua%ratic interpolation rather than linear
m )( x P
).( x P
bi a z −
)( x P
m
mbaax x )2( 222 +
z a bi
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
64/67
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
65/67
2c−
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
66/67
Solving for the "eros of the qua%ratic allows the metho% tofin% complex pairs of roots -oth real "eros an% complex"eros can be foun%
Given three previous guesses for the root
" 2 "2
" 2 2
2
" 1 2 "
&
2I therefore , t$o possibilities of
&
2;eclect ,
sgn( ) &
$hich is the closest Cero of ( ) to .
/nce is determined, reinitialiCe using , ,
to obtain .
c p p p
b b ac
c p p
b b b ac
P x p
p p p p
p
− =± −
= −+ −
-
8/15/2019 Lecture 06 Solution of Equations in One Variable
67/67
Jome$or &•
#umerical nal sis, ?th edition• age 1 E. 11 use
Bisection Method, #e$ton%s Method
;ecant Method, Method of False osition
Muller%s Method
ompare the results, chec the rates of con*ergence
Aue on Monda , #o*ember ?, 2 1+ =3 am