Title: 5. Nonlinear Functions of Several Variables
15. Nonlinear Functions of Several Variables
Jieun Yu (jieunyu_at_korea.ac.kr) Kyungsun Kwon
(sadokwon_at_korea.ac.kr) Kyunghwi Kim
(kyunghwi_at_korea.ac.kr) Sungjin Kim
(sungsink_at_korea.ac.kr) Computer Networks Research
Lab. Dept. of Computer Science and
Engineering Korea University
2Contents
- Introduction
- Newtons Method for Nonlinear Systems
- Fixed-Point Iteration for Nonlinear Systems
- Minimum of a Nonlinear Function of Several
Variables - MATLABs Methods
- Case Study
3Introduction
Chapter 2
Chapter 1
Chapter 3,4
Chapter 5
4Introduction
- A zero of a nonlinear function of a single
variable - Nonlinear functions of several variables
- The latter problem is much more difficult
- Newtons method is applicable to this problem as
well as that of a single variable
55.1 Newtons Method for Nonlinear Systems
6Newtons Method
- Tangent line function
- Iteration form
- Tangent plane function
- Iteration using r, s
7Newtons Method (cont)
85.1.1 Matrix-Vextor Notation
9Ex5.1 Intersection of a Circle and a Parabola
( Circle ) ( Parabola )
10Ex5.1 Intersection of a Circle and a Parabola
- Step1
- Partial derivative
- Initial estimate (x0,y0) (1/2, 1/2)
11Ex5.1 Intersection of a Circle and a Parabola
- Step2
- The second approximate solution (x1,y1)
12Ex5.1 Intersection of a Circle and a Parabola
- Initial estimate and 2 iterations of Newtons
method
iteration x y
0 0.5 0.5
1 0.875 0.625 0.39528
2 0.79067 0.61806 0.084611
The true solution is (x, y) (0.78615, 0.61803)
135.1.2 MATLAB Function for Newtons Method for
Nonlinear Systems
\ operation -gt 100p
14Example 5.2 a System of Three Equations
15Example 5.2 a System of Three Equations
16Example 5.3Intersection of a Circle and an
Ellipse
y
1
0.5
x
0
-0.5
-1
-1
-0.5
0
0.5
1
17Example 5.3Intersection of a Circle and an
Ellipse
18Example 5.4Positioning a Robot Arm
- the end of the first link(x1,y1)
- the end of the second link(x2,y2)
- We need to solve
10
(x2,y2)
8
6
ß
(10,4)
4
(x1,y1)
2
a
0
0
2
4
6
8
10
19Example 5.4Positioning a Robot Arm
- Find the angles so that the arm will move to the
point(10,4) - The length of link (d1,d2) (5, 6)
- initial angles(a , ß) (0.7,0.7)
- The system of equations
205.2 Fixed-Point Iteration For Nonlinear Systems
215.2 Fixed-Point Iteration For Nonlinear Systems
- Ex 5.5 Fixed-Point Iteration for a System of two
Nonlinear Function - Consider the problem of finding a zero of the
system
form
- The graph of the equations and
225.2 Fixed-Point Iteration For Nonlinear Systems
Iteration
0 0.60000 0.60000
1 0.53840 0.18160 0.42291
2 0.50255 0.15444 0.044975
3 0.50275 0.15062 0.0038204
4 0.50235 0.15062 0.00039661
5 0.50238 0.15058 4.9381e-05
235.2 Fixed-Point Iteration For Nonlinear Systems
245.2 Fixed-Point Iteration For Nonlinear Systems
function G ex5_5(x) G (-0.1x(1)3
0.1x(2) 0.5) (0.1x(1) 0.1x(2)3
0.1)
Actually using function Fixed_pt_sys gtgt
xFixed_pt_sys(_at_ex5_5, 0.6 0.6, 0.00001, 5)
255.2 Fixed-Point Iteration For Nonlinear Systems
265.2 Fixed-Point Iteration For Nonlinear Systems
- Ex 5.5 Fixed-Point Iteration for a System of
Three Nonlinear Function
- Coverting this system to a fixed point iteration
form
275.2 Fixed-Point Iteration For Nonlinear Systems
- Using the preceding MATLAB function and a
starting estimate of (2, 2, 2)
Iteration
0 2.0000 2.0000 2.0000
1 3.7600 2.1000 -1.6750 4.0759
2 3.5729 1.6528 -1.4113 0.5518
3 3.6502 1.7621 -1.4876 0.15403
4 3.6272 1.7232 -1.4643 0.050903
5 3.6346 1.7350 -1.4719 0.0115899
6 3.6323 1.7312 -1.4695 0.0050696
7 3.6330 1.7324 -1.4702 0.0016031
8 3.6328 1.7320 -1.4700 0.00050866
9 3.6328 1.7321 -1.4701 0.00016117
10 3.6328 1.7321 -1.4701 5.1098e-05
285.2 Fixed-Point Iteration For Nonlinear Systems
function G ex5_6(x) G (-0.02x(1)2 -
0.02x(2)2 - 0.02x(3)2 4) (-0.05x(1)2
- 0.05x(3)2 2.5) (0.025x(1)2
0.025x(2)2 - 1.875)
Actually using function Fixed_pt_sys gtgt
xFixed_pt_sys(_at_ex5_6, 2 2 2, 0.00001, 10)
295.2 Fixed-Point Iteration For Nonlinear Systems
305.2 Fixed-Point Iteration For Nonlinear Systems
- If g(x) maps D into D, then g has a fixed point
in D. In other words, if g(x) is in D whenever x
is in D, then there is some point p in D such
that pg(p) - If sequence of
approximations to the fixed point
intial point
is sufficiently close to the fixed point p
If there is a constant Klt1 such that for every x
in D
For each i 1,.,n and each j1,,n,
A bound on the error at the mth step is given by
315.2 Fixed-Point Iteration For Nonlinear Systems
First check to make sure that g(x) maps the
retangle
That is, for
we have
In fact
and
Which are all less than 0.5 (for
), as is required for the corollary
325.3 Minimum of a Nonlinear Function of Several
Variables
33Example 5.7
- and
, - we define
- The minimum value of h(x,y) is 0, which occurs
when f(x,y)0 and g(x,y)0. - The derivatives for the gradient are
34Table 5.8
- Result of ffminTable 5.8 Approximate zeros at
each step of iteration
Step x y Change
0 0.5 0.5
1 0.875 0.625 -0.26831
2 0.74512 0.61133 -0.035987
3 0.79251 0.61902 -0.0079939
4 0.78446 0.6178 -0.00019414
5 0.78657 0.6181 -1.3631e-05
355.3.1 MATLAB Function for Minimization by
Gradient Descent
365.3.1 MATLAB Function for Minimization by
Gradient Descent
function h ex_min(x) h (x(1)2 x(2)2 -
1)2 (x(1)2 - x(2) )2
function dh ex_min_g(x) dh -(4(x(1)2
x(2)2 - 1)x(1) 4(x(1)2 - x(2))x(1))
-(4(x(1)2 x(2)2 - 1)x(2) - 2(x(1)2 -
x(2)))'
xmin ffmin(_at_ex_min, _at_ex_min_g, 0.5 0.5, 0,
5) 0 0.5000 0.5000 1.0000
0.8750 0.6250 -0.2683 2.0000 0.7451
0.6113 -0.0360 3.0000 0.7925
0.6190 -0.0080 4.0000 0.7845 0.6178
-0.0002 5.0000 0.7866 0.6181 -0.0000
37Example 5.8
- Given three points in the plane, we wish to find
the location of the point P(x,y) sp that the sum
of the squares of the distances from P to the
three given points, is as small as possible.
38Figure 5.7
395.4 MATLABs Methods
40MATLABs METHODS
- FMINS
- finds the minimum of a scalar function of several
variables, starting at an initial estimate - Note
- The fmins function was replaced by fminsearch in
Release 11 (MATLAB 5.3). - In Release 12 (MATLAB 6.0), fmins displays a
warning message and calls fminsearch - Syntax
- x fmins('fun',x0)
- x fminsearch(fun,x0)
- starts at the point x0 and finds a local minimum
x of the function described in fun. - x0 can be a scalar, vector, or matrix.
41MATLABs METHODS
- Examples
- A classic test example for multidimensional
minimization is the Rosenbrock banana function - The traditional starting point is (-1.2,1). The
M-file banana.m defines the function. - The minimum is at (1,1) and has the value 0.
- a
425.5 Nonlinear system Case Study
43Nonlinear system Case Study
- The analytical model to compute the 802.11 DCF
throughput -
44Nonlinear system Case Study
- The stationary probability t
- The station transmits a packet in a generic slot
time - The conditional collision probability p
- aa
-
45Nonlinear system Case Study
- Two Equations represent a nonlinear system in the
two unknowns t and p -
- W Cwmin
- m Maximum backoff stage
- N The number of stations
46Nonlinear system Case Study
- Solve the nonlinear problem of two variables
- Assumptions
- W 32
- m 3
- N 3, 10, 50
- Newtons Method and fminsearch(fun,x0)
- Problem1 by Newtons Method (W32, m 3, N 3)
- 64t p4 34pt - 33t - 4p 2 0 (1)
-
- p 1-(1- t)2
(2) - Equations (1) and (2) is nonlinear system
-
47Nonlinear system Case Study
- function f newton_case1(x)
- f (64x(2)x(1)4 34x(1)x(2) -33x(2)
-4x(1) 2) - (x(2)2 - 2x(2) x(1))
- function df newton_case1_j(x)
- df (256x(2)x(1)3 34x(2) - 4)
(64x(1)4 34x(1)-33) - 1
( 2x(2) -2) - t 0.4165
-
p 0.6595
48Nonlinear system Case Study
- Problem1 by fminsearch(fun,x0) (W32, m 3, N
3) - function h fminsearch_case1(x)
- h (64x(2)x(1)4 34x(1)x(2) -33x(2)
-4x(1) 2)2 ((1-x(2))2 -1 x(1))2 -
49Nonlinear system Case Study
- Problem2 by Newtons Method (W32, m 3, N 10)
- 64t p4 34pt - 33t - 4p 2 0 (1)
- p 1-(1- t)9
(2) - Equations (1) and (2) is nonlinear system
- t 0.1259
-
p 0.7021
50Nonlinear system Case Study
- Problem2 by fminsearch(fun,x0) (W32, m 3, N
10) - function h fminsearch_case1(x)
- h (64x(2)x(1)4 34x(1)x(2) -33x(2)
-4x(1) 2)2 ((1-x(2))2 -1 x(1))9 -
51Nonlinear system Case Study
- Problem3 by Newtons Method (W32, m 3, N 50)
- 64t p4 34pt - 33t - 4p 2 0 (1)
- p 1-(1- t)49
(2) - Equations (1) and (2) is nonlinear system
-
t 0.0427 -
p 0.8823
52Nonlinear system Case Study
- Problem2 by fminsearch(fun,x0) (W32, m 3, N
50) - function h fminsearch_case1(x)
- h (64x(2)x(1)4 34x(1)x(2) -33x(2)
-4x(1) 2)2 ((1-x(2))2 -1 x(1))49 -