Академический Документы
Профессиональный Документы
Культура Документы
Engineering
Subject: Chemical (Part 2)
Engineering
Mathematics 2 THE SOLUTION
METHODS for
Author:
Andrew KUMORO SIMULTANEOUS
NON LINEAR
Dept. of Chemical EQUATIONS
Engineering
Diponegoro University
2013
Systems of Nonlinear Equations
Locate the roots of a set of simultaneous nonlinear
equations:
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 3 xy 2 57 f ( x, y ) y 3xy 2 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 )
Curves
Two roots: f (x ,x ) = 0 , f (x ,x ) = 0
1 1 2 2 1 2
f 1 , i f 1 , i f 1 , i f 1 , i
f 1, i 1 0 x x 1 , i 1 x x 2 , i 1 f 1 , i x 1 , i x x 2 , i x
1 2 1 2
f 2 ,i 1 0 f 2 , i f 2 , i f 2 , i f 2 , i
Alternatively x 1, i 1 x 2 , i 1 f 2 , i x 1, i x 2 ,i
x1 x 2 x 1 x 2
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
x1 x 2
Jacobian
[J]{x} = { f }
matrix
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
f1 f1 f1 f1 f1 f1
x x1 f1 ( x1 , x2 , x3 , , xn ) x1
x2 xn
x x2 xn
1 1
f 2 f 2 f 2 f 2 f 2 f 2
x2 f ( x , x , x , , xn ) x2
x1 x2 xn 2 1 2 3 x1 x2 xn
f f n f n f f n f n
n xn f n ( x1 , x2 , x3 , , xn ) n xn
x1 x2 xn i
i 1 i x1 x2 xn i
i
[ 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)
f1 f1 f1 x1
x x1 f1 ( x1 , x2 , x3 , , xn )
x2 xn
1
f 2 f 2 f 2
x2 x
2 2 1 2 3
f ( x , x , x , , xn )
x1 x2 xn
f f n f n
n
xn xn f n ( x1 , x2 , x3 , , xn )
x1 x2 xn i 1 i ii
i
[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 }
f1 f1 f1
x x1 f1 ( x1 , x2 , x3 , , xn )
x2 xn
1
f 2 f 2 f 2
x 2 f 2 ( x1 , x2 , x3 , , xn )
x1 x2 xn
f f n f n
n xn f n ( x1 , x2 , x3 , , xn )
x1 x2 xn i
i 1 ii
8
[J]{x} =
Example
SOLUTION PROCEDURES:
Example 1
Step Two. Using that initial guess, calculate the residual and the
Jacobian.
x(2) = x(1)+ x(1)
0.889
5
Example 2
Important Notes on the Solution of
Nonlinear Systems of Equations
n non-linear equations with n unknowns to be solved:
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 f 1 ( x 1 , x 2 ) x 12 x 22 1 0
or
g ( x, y) x y 0
2
f 2 ( x 1 , x 2 ) x 12 x 2 0
Intersection of Two Curves
f 1 f 1
f1 ( x 1 , x 2 ) x 12 x 22 1 x x 2 2 x1 2 x2
1
f 2 ( x 1 , x 2 ) x 12 x 2 f 2 f 2 2 x1 1
x 1 x 2
2 x 1, i 2 x 2 , i x 1, i f 1, i
[ J ]{ x }
2 x 1, i 1 x 2 , i f 2 ,i
Solve for xnew
x 1, i x 1, i 1 x 1, i
x x x
new old
x 2 , i y2 , i 1 x 2 , i
function [x,y,z]=ellipse(a,b,c,imax,jmax) a=3; b=2; c=1; imax=50; jmax=50;
for i=1:imax+1
theta=2*pi*(i-1)/imax; [x,y,z]=ellipse(a,b,c,imax,jmax);
for j=1:jmax+1 surf(x,y,z); axis equal;
phi=2*pi*(j-1)/jmax;
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 Parabolic or
for i=1:imax+1
xi=-2+4*(i-1)/imax; Hyperbolic
for j=1:jmax Surfaces
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
h( x , y, z ) x 3 y 2 z 2 0
f 3 ( x1, x 2 , x 3 ) x1 3 x 2 x 3 0
2 2
f 1 f 1 f 1
x x 2 x 3
Jacobian 1 2 x1 2 x2 2 x3
f 2 f 2 f 2
[J ] 2 x1 4 x2 0
x 1 x 2 x 3
f f 3 f 3 1 6 x2 2 x 3
3
x 1 x 2 x 3
Newton-Raphson Method
2 x1 2 x2 2 x3 x 1 f1
2x
4 x2 0 x 2 2f
1
1 6 x2 2 x 3 x f
3 3
x new x old x 1
y
new yold x 2
z z old x
new 3
f 1 ( x 1 , x 2 , x 3 ,...., x n ) 0 x 1 g 1 ( x 1 , x 2 , x 3 ,...., x n )
f 2 ( x 1 , x 2 , x 3 ,...., x n ) 0 x 2 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
f
2 1 2 3( x , x , x ) x 2
1 20 x 2 x 3 50 0
2
f 3 ( x 1 , x 2 , x 3 ) x 1 x 2 40 x 3 75 0
2 2
f 1 ( x1 , x 2 , x 3 ) x12 4 x 22 9 x 32 36 0
f ( x ,
2 1 2 3 x , x ) x 2
1 9 x 2 47 0
2
f ( x ,
3 1 2 3 x , x ) x 1 x 3 11 0
2