Nonlinear Equations Nonlinear Equations
The scientist described what is: the engineer creates what never was. Theodor von Karman
1
The father of supersonic flight Fall 2010
Nonlinear Equations Nonlinear Equations The scientist described - - PowerPoint PPT Presentation
Nonlinear Equations Nonlinear Equations The scientist described what is: the engineer creates what never was. Theodor von Karman The father of supersonic flight 1 Fall 2010 Problem Description Problem Description Given a non-linear
The scientist described what is: the engineer creates what never was. Theodor von Karman
1
The father of supersonic flight Fall 2010
2
3
f(a) y=f(x) f(b) a b x* X
4
f(b)
1 2 f(a) y=f(x) 3 4 f(a) a b x* X 4
5
f(b) x*
k
6
Fa = f(a)
Fa = f(a) Fb = f(b) ! F ! Fa* Fb * Fb must must be < 0 be < 0 DO IF (ABS(b-a) < ε) EXIT
IF (ABS(b-a) < ε) EXIT c = (a+b)/2 IF (c ==a .OR. c == b) EXIT Fc = f(c)
Fc f(c) IF (Fc == 0) EXIT IF (Fa*Fc < 0) THEN b = c
Fb = Fc ELSE a = c
Fa = Fc END IF END DO
7
8
9
2
10
2
11
[5 5 5 625] [5.5,5.5625] f x x ( ) sin( cos( )) +
[5,6] [5.5,6]
[5.5,5.75] [5.5,5.625] f x x ( ) ( ( )) = + 1
2
12
[4,6] [5,6]
'
y=f(x) (a,f(a)) y=f(x) a b x*
13
a b x* y - f(a) = f’(a)×(x-a)
'
(a f(a))
'
y=f(x) (a,f(a))
14
a b x*
i i i
+ =
1
'
i i i
+1
'
x*
15
y=f(x) x1 x0 x2 x3
* k
+ −
1
* k k k
→∞ +
1
1
16
*
* k k k p
→∞ + −
1
17
x = initial value Fx = f(x) Dx = f’(x)
f (x) DO IF (ABS(Fx) < ε) EXIT New_X = x – Fx/Dx
Fx = f(New_X) Dx = f’(New_X) x = New_X
END DO
18
1/(2 1) n
+
verify this fact yourself
x1 x2 x3 x4
19
20
21
x1 x2 x3 x4 x5 x*
f’(x) = 0 at this inflection point
f’(x )=0
f (x) = 0 at this inflection point
f (x2)=0
22
x1 x2 x*
f’(x) = 0 at a multiple root
x1 x2 x* x3 x4
1 3 4
23
This is what we want! But, we get this one
It ti 0 0 5 f( ) 0 99902343 Iteration 0 x = 0.5 f(x) = -0.99902343 Iteration 1 x = 51.65 f(x) = 1.3511494E+17 Iteration 2 x = 46.485 f(x) = 4.711166E+16 Iteration 3 x = 41.836502 f(x) = 1.6426823E+16 ( ) Iteration 4 x = 37.65285 f(x) = 5.727679E+15 ...... Other output ...... Iteration 10 x = 20.01027 f(x) = 1.0292698E+13 Oth t t ...... Other output ...... Iteration 20 x = 6.9771494 f(x) = 273388500.0 Iteration 30 x = 2.4328012 f(x) = 7261.167 Iteration 40 x = 1 002316 f(x) = 0 02340281
slow!
24
Iteration 40 x = 1.002316 f(x) = 0.02340281 Iteration 41 x = 1.000024 f(x) = 2.3961067E-4 Iteration 42 x = 1.0 f(x) = 0.0E+0
25
x
−
f x e x
x
( ) sin( cos( )) = +
−
26
f x e x
x
( ) sin( cos( )) = +
−
27
f x e x f x e x e x
x x x
( ) sin( cos( )) ( ) cos( cos( ))( sin( ))
'
= + = − + +
− − −
x f(x) f’(x)
4
0.5943911 1 4.998402 0.2848776 0.9131543
2 4.686432
0.99030494 3 4.703329 0.5750917×10-5 0.99089395 4 4.703324 0.8102506×10-7 0.99089384
28
k k k
+ =
1
29
(xk-1,f(xk-1)) (xk,f(xk))
30
x* xk-1 xk xk+1
Newton’s method
k k k
−
1
k k k
−1
1
k k
−
1 1
k k k k k
+ −
31
lim | |
* k
x x C
+ −
=
1
lim | |
* k k p
x x C
→∞
−
p = + = 1 5 2 1618 . .....
32
p 2
a = initial value #1
b = initial value #2 Fa = f(a) Fb = f(b)
DO c = b – Fb*(b-a)/(Fb-Fa) Fc = f(c)
IF (ABS(Fc) < ε) EXIT a = b Fa = Fb b
b = c Fb = Fc END DO
33
0 : 2.0 1023.0 1.5 56.66504
1 : 1.5 56.66504 1.4706805 46.33511 2 : 1.4706805 46.33511 1.3391671 17.550165 3 : 1.3391671 17.550165 1.2589835 9.004613 4 : 1 2589835 9 004613 1 1744925 3 994619 4 : 1.2589835 9.004613 1.1744925 3.994619 5 : 1.1744925 3.994619 1.1071253 1.7667356 6 : 1.1071253 1.7667356 1.0537024 0.68725025 7 : 1.0537024 0.68725025 1.0196909 0.21530557 8 : 1.0196909 0.21530557 1.0041745 0.04253745 9 : 1.0041745 0.04253745 1.0003542 3.5473108E-3 10 : 1.0003542 3.5473108E-3 1.0000066 6.556511E-5
34
Converged after 11 iterations x* = 1.0 f(x*) = 0.0E+0
l i h
Initially:
a = 0.0E+0 f(a) = -1.0 b = 1.5 f(b) = 56.66504
explain why
a 0.0E 0 f(a) 1.0 b 1.5 f(b) 56.66504 c = 0.026012301 f(c) = -1.0
Iteration 1 :
a = 1.5 f(a) = 56.66504 b = 0.026012301 f(b) = -1.0 c = 0.051573503 f(c) = -1.0
Iteration 2 :
a = 0.026012301 f(a) = -1.0 b = 0.051573503 f(b) = -1.0
Floa
ting exception ception (Oops!!!) (Oops!!!)
35
Fl Floating exception ception (Oops!!!) (Oops!!!)
k k 1
36
37
1 '
k k k k
+ =
k
1
k k k k
+ =
38
39
( f( ))
(a,f(a))
a b c (a+b)/2 x*
a b c
y f a x a f b f a b a − − = − − ( ) ( ) ( )
(b,f(b))
c a b a f b f a f a b b a f b f a f b = − − − × = − − − × ( ) ( ) ( ) ( ) ( ) ( )
40
( f( ))
Fa = f(a)
Fa = f(a) Fb = f(b) ! F ! Fa* Fb * Fb must must be < 0 be < 0 DO c = a-Fa*(b-a)/(Fb-Fa)
c = a-Fa*(b-a)/(Fb-Fa) Fc = f(c) IF (ABS(Fc) < ε) EXIT IF (Fa*Fc < 0) THEN
IF (Fa Fc < 0) THEN b = c Fb = Fc ELSE
a = c Fa = Fc END IF
END DO
41
x2 x3 x4 x5 x* x1 x0
42
1 0.0E+0 -1.0 1.3 12.785842 0.094299644 -1.0
a f(a) b c f(b) f(c)
2 0.094299644 -1.0 1.3 12.785842 0.18175896 -0.99999994 3 0.18175896 -0.99999994 1.3 12.785842 0.26287412 -0.99999845 4 0.26287412 -0.99999845 1.3 12.785842 0.33810526 -0.99998044 5 0.33810526 -0.99998044 1.3 12.785842 0.4078781 -0.99987256 10 0.6395442 -0.98855262 1.3 12.785842 0.6869434 -0.97660034 20 0.94343614 -0.44136887 1.3 12.785842 0.95533406 -0.36678296 30 0.99553364 -0.043776333 1.3 12.785842 0.9965725 -0.03375119 40 0.9996887 -3.1086206E-3 1.3 12.785842 0.9997617 -2.3804306E-3 50 0.99997854 -2.1457672E-4 1.3 12.785842 0.99998354 -1.6450882E-4 60 0.99999856 -1.4305115E-5 1.3 12.785842 0.9999989 -1.0728836E-5 43 60 0.99999856 1.4305115E 5 1.3 12.785842 0.9999989 1.0728836E 5 63 0.9999995 -4.7683715E-6
i+1
k+1 g( k)
44
y = x y = g(x) x* = g(x*)
45
k+1
x = y ( ) y = x Y
xk+1= y xk+2= y y = g(x)
y = g(xk) y = g(xk+1) X
xk xk+1 X
46
47
’( ) ∈ ( 1 0) ’( ) ∈ (0 1) g’(x) ∈ (-1,0) g’(x) ∈ (0,1)
x1 x2 x3 x1 x2 x3
48
x1 x2 x3 x1 x2 x3
asymptotic
g’(x) > 1 g’(x) < -1
49
x1 x2 x3 x4 x1 x2 x3
50
a root in the range of [0,2] f(x) = cos(x) – x1/2
51
2
y = cos2(x)
y = x
0 6 0 8
0.6 0.8
52
y = cos-1(x1/2)
y = x
0 6 0 8
0.6 0.8
53
2
54
55
2
2 1
x
+
2 1
x
+
1
x
+
1
x
+
56
This is the asymptotic case y = x
1
( ) 1
x
g x e
+
= −
57
2
2 2
2 2 2
2 2
58
This is also the asymptotic case
2
2 2
If the initial guess is larger than x* = 2.2513… the fixed-point iteration converges to 72.309…
59
This is the oscillatory case If th i iti l i l th * 2 2513 If the initial guess is less than x* = 2.2513… the fixed-point iteration converges to -0.7769…
2 2
60
2 2
no way to reach x* = 2.2513… converge to 72.309… converge to -0.7769…
61
62
x
−
f x e x
x
( ) sin( ) = − =
−
63
y = g(x) and and y=x ha have onl
y one
inter intersection point ection point ar around
0.5. As a r As a result, sult, onl
y the r the root in
[0,1] can be f can be found w ith
the [ , ] fix fixed-point iter d-point iteration. ion.
y g x e x = =
− −
( ) sin ( )
1 64
0.5885…
65
g x e x ( ) sin ( ) =
− −
1
x x (sin ( ))' = −
−1
2
1 1
g x e e
x x
( )
'
= − −
− −2
1
66
xi 0.5 1 0.6516896 2 0 5482148 2 0.5482148 3 0.616252 4 0 5703949 4 0.5703949 5 0.6007996
26 it ti 26 iterations x* ≈ 0.58853024
67
x0 x1 x2 x3 x4 x5
68
A plot shows y = g(x) and y = x at two points in (0,π). There are other roots not in (0,π).
Ob i l th d i ti Obviously, the derivative at this larger root is larger than 1. Hence, the fixed point iteration won’t
g x x ( ) ln(sin( )) = −
fixed-point iteration won’t be able to find it!
x = π x = 0
g( ) ( ( ))
Ex Exer ercis cise: Plot g(x) in [0 20] to see other part
69
[0,20] to see other part.
( ) g x x x x x
' '
( ) ( ln(sin( )) cos( ) sin( ) cot( ) = − = − = −
70
71
72