NLE Solution
NLE Solution
NLE Solution
f1 ( x1 , x2 , x3 , , xn ) 0
f 2 ( x1 , x2 , x3 , , xn ) 0
f n ( x1 , x2 , x3 , , xn ) 0
Example :
x 2 xy 10 f ( x, y ) x 2 xy 10 0
y 3xy2 57 f ( x, y ) y 3 xy2 57 0
2
Newton-Raphson Method
• One nonlinear equation (Ch.3)
f ( x i 1 ) f ( x i ) ( x i 1 x i ) f ( x i )
f ( xi )
xi1 xi
f ( x i )
f 1 , i f 1 , i
x x 2 x 1 , i 1 x 1 , i f 1, i
1
f 2 , i f 2 , i x 2 , i 1 x 2 , i f 2. i
x 1 x 2
Jacobian matrix
[J]{x} = { f }
NONLINEAR SYSTEMS
• Simultaneous nonlinear equations
f1 ( x1 , x 2 , x 3 , , xn ) 0
f 2 ( x1 , x 2 , x 3 , , xn ) 0
f 3 ( x1 , x 2 , x 3 , , xn ) 0
• Example fn ( x1 , x 2 , x 3 , , xn ) 0
[ J i ]{ X i 1} {Fi } [ J i ]{ X i }
6
Solve this set of linear equations at each iteration
Three or more nonlinear equations (Taylor-series)
[J] {x} { f }
Jacobian matrix
[J] {x} = { f }
7
Solution of Nonlinear Systems of Equations
Rearrange: [ J i ]{ X i 1 X i } {Fi }
[ J i ]{X i 1} {Fi }
[J]{x} = { f }
8
Example
SOLUTION PROCEDURES:
Example 1
Step Two. Using that initial guess, calculate the residual and the
Jacobian.
0.8895
Example 2
Important Notes on the Solution of
Nonlinear Systems of Equations
• n non-linear equations with n unknowns to be solved:
•
• Need to solve this set of Linear Equations [ J i ]{X i 1} {Fi }
• For n unknowns, the size of the Jacobian matrix is n2 and the time it
takes to solve the linear system of equations (one iteration of the
non-linear system) is proportional to O(n3)
Circle x2 + y2 = r2
f(x,y)=0
g(x,y)=0 Solution
depends on
initial
guesses
f ( x, y) x 2 y 2 1 0 f1 ( x1 , x 2 ) x12 x 22 1 0
or
g ( x , y ) x 2
y 0
2 1 2
f ( x , x ) x 1 x2 0
2
Intersection of Two Curves
f1 f1
f1 ( x1 , x 2 ) x12 x 22 1 x x 2 2 x1 2 x2
1
f 2 ( x1 , x 2 ) x12 x 2 f 2 f 2 2 x1 1
x1 x 2
2 x 1, i 2 x2 ,i x1,i f1,i
[ J ]{ x}
2 x 1, i 1 x2 ,i f 2 ,i
Solve for xnew
x1,i x 1 , i 1 x 1, i
x x x
new old
x2 ,i y2 , i 1 x 2 , i
function [x,y,z]=ellipse(a,b,c,imax,jmax)
for i=1:imax+1 » a=3; b=2; c=1; imax=50; jmax=50;
theta=2*pi*(i-1)/imax; » [x,y,z]=ellipse(a,b,c,imax,jmax);
for j=1:jmax+1
phi=2*pi*(j-1)/jmax; » surf(x,y,z); axis equal;
x(i,j)=a*cos(theta); » print -djpeg100 ellipse.jpg
y(i,j)=b*sin(theta)*cos(phi);
z(i,j)=c*sin(theta)*sin(phi);
end
end
function
[x,y,z]=parabola(a,b,c,imax,jmax)
% z=a*x^2+b*y^2+c
for i=1:imax+1 Parabolic or
xi=-2+4*(i-1)/imax; Hyperbolic Surfaces
for j=1:jmax
eta=-2+4*(j-1)/jmax;
x(i,j)=xi;
y(i,j)=eta;
z(i,j)=a*x(i,j)^2+b*y(i,j)^2+c;
end
end
Infinite many
solutions
Intersection of three nonlinear surfaces
» [x1,y1,z1]=ellipse(2,2,2,50,50);
» [x2,y2,z2]=ellipse(3,2,1,50,50);
» [x3,y3,z3]=parabola(-0.5,0.5,-0.5,30,30);
» surf(x1,y1,z1); hold on; surf(x2,y2,z2); surf(x3,y3,z3);
» axis equal; view (-30,60);
» print -djpeg100 surf3.jpg
function x = Newton_sys(F, JF, x0, tol, maxit)
xold = x0;
disp([0 xold ]);
iter = 1;
while (iter <= maxit)
y= - feval(JF, xold) \ feval(F, xold);
xnew = xold + y';
dif = norm(xnew - xold);
disp([iter xnew dif]);
if dif <= tol
x = xnew;
disp('Newton method has converged')
return;
else
xold = xnew;
end
iter = iter + 1;
end
disp('Newton method did not converge')
x=xnew;
Intersection of Circle and Parabola
function f = ex11_1(x) function df = ex11_1_j(x)
0 0.5000 0.5000
1.0000 0.8750 0.6250 0.3953
2.0000 0.7907 0.6181 0.0846
3.0000 0.7862 0.6180 0.0045
4.0000 0.7862 0.6180 0.0000
5.0000 0.7862 0.6180 0.0000
Newton method has converged
Intersection of Three Surfaces
f ( x , y, z ) x 2 y 2 z 2 14 0 f 1 ( x1, x 2 , x 3 ) x 12 x 22 x 32 14 0
g ( x , y , z ) x 2
2 y 2
9 0 or 2 1, 2 3
f ( x x , x ) x 2
1 2 x 2 9 0
2
h( x , y, z ) x 3 y 2 z 2 0
f 3 ( x 1 , x 2 , x 3 ) x 1 3 x 2
2 x 2
3 0
f 1 f 1 f 1
• Jacobian x x 2 x 3
1 2 x1 2 x2 2 x3
f 2 f 2 f 2 2 x
[J ] 4 x2 0
x 1 x 2 x 3 1
f f 3 f 3 1 6 x 2 2 x 3
3
x 1 x 2 x 3
Newton-Raphson Method
2 x1 2 x2 2 x 3 x 1 f1
2 x
4 x2 0 x 2 f 2
1
1 6 x 2 2 x 3 x 3 f
3
x new x old x 1
new
y
old 2
y x
z z x
new old 3
• MATLAB function ( y = J-1F )
f 1 ( x 1 , x 2 , x 3 ,...., x n ) 0 x1 g 1 ( x 1 , x 2 , x 3 ,...., x n )
f (
2 1 2 3x , x , x ,...., x n ) 0 x2 g 2 ( x 1 , x 2 , x 3 ,...., x n )
f 3 ( x 1 , x 2 , x 3 ,...., x n ) 0 x 3 g 3 ( x 1 , x 2 , x 3 ,...., x n )
f n ( x 1 , x 2 , x 3 ,...., x n ) 0 x n g n ( x 1 , x 2 , x 3 ,...., x n )
Convergence g i K
Theorem ; K 1
x j n
Example1: Fixed-Point
f 1 ( x 1 , x 2 , x 3 ) x 12 50 x 1 x 22 x 32 200 0
2 1 2 3
f ( x , x , x ) x 2
1 20 x 2 x 3 50 0
2
f ( x
3 1 2 3 , x , x ) x 2
1 x 2 40 x 3 75 0
2
f1 ( x1 , x 2 , x 3 ) x12 4 x 22 9 x 32 36 0
2 1 2 3
f ( x , x , x ) x 2
1 9 x 2 47 0
2
3 1 2 3
f ( x , x , x ) x 1 x 3 11 0
2