Вы находитесь на странице: 1из 14

Nonlinear Algebraic Systems

1. Iterative solution methods


2. Fixed-point iteration
3. Newton-Raphson method
4. Secant method
5. atla! tutorial
". atla! exercise

Single Nonlinear Equation

Nonlinear al#e!raic e$uation% f&x' = (


)
*nal+tical solution rarel+ possi!le
)
Need numerical techni$ues
)
ultiples solutions ma+ exist

Iterative solution
) Start with an initial #uess x
(
) *l#orithm #enerates x
1
,rom x
(
) Repeat to #enerate se$uence x
(
- x
1
- x
2
- .
)
*ssume se$uence conver#ences to solution
)
/erminate al#orithm at iteration N when%

an+ iterative al#orithms availa!le


)
Fixed-point iteration- Newton-Raphson method- secant
method
( ' &
N
x f

Fixed-Point Iteration

Formulation o, iterative e$uation


)
* solution o, x 0 g&x' is called a ,ixed point

1onver#ence
) /he iterative process is conver#ent i, the se$uence x
(
- x
1
- x
2
- .
conver#es%
)
2et x = g&x' have a solution x = s and assume that g&x' has a
continuous ,irst-order derivative on some interval J containin# s- then
the ,ixed-point iteration conver#es ,or an+ x
(
in J 3 the limit o, the
se$uence 4x
n
5 is s i,%
)
* ,unction satis,+in# the theorem is called a contraction mappin#%
)
K determines the rate o, conver#ence
' & ' & ' & ( ' &
1 n n
x g x x g x x f x x f = + = =
+
( ' & lim
1
=
+

n n
n
x x
J x K
x
g
<

1
v x K v g x g ' & ' &

Newton-Raphson ethod

Iterative e$uation derived ,rom ,irst-order /a+lor


series expansion

*l#orithm
) Input data% f&x', df&x'/dx- x
(
- tolerance &'- maximum
num!er o, iterations &N'
) 6iven x
n
- compute x
n+1
as%
) 1ontinue until 7 x
n+1
-x
n
7 8 7x
n
7 or n 0 N
dx x df
x f
x x
n
n
n n
' &
' &
1
=
+
( ' &
' &
' & ' & ' & ' & ' &
1 1
' &
= +

+
+ + n n
n
n n
x
x x
dx
x df
x f x f x x
dx
df
x f x f

!on"ergence o# the Newton-Raphson ethod

9rder
)
:rovides a measure o, conver#ence rate
)
Newton-Raphson method is second-order

*ssume f&x' is three times di,,erentia!le- its ,irst- and


second-order derivatives are non-;ero at the solution x = s
3 x
(
is su,,icientl+ close to s- then the Newton method is
second-order 3 exhi!it $uadratic conver#e to s

1aveats
) /he method can conver#e slowl+ or even diver#e ,or poorl+ chosen x
0
) /he solution o!tained can depend on x
0
)
/he method ,ails i, the ,irst-order derivative !ecomes ;ero
&sin#ularit+'
2
1 n n n n
c x s =
+

Secant ethod

otivation
)
<valuation o, df/dx ma+ !e computationall+ expensive
)
=ant e,,icient- derivative-,ree method

>erivative approximation

Secant al#orithm

1onver#ence
)
Superlinear%
)
Similar to Newton-Raphson &m 0 2'
1
1
' & ' & ' &

n n
n n n
x x
x f x f
dx
x df
' & ' &
' &
1
1
1

=
n n
n n
n n n
x f x f
x x
x f x x
2 1
1
< < =
+
m c
m
n n


atlab $utorial

Solution o, nonlinear al#e!raic e$uations with


atla!

F?<R9 @ scalar nonlinear ;ero ,indin#


)
atla! ,unction ,or solvin# a sin#le nonlinear al#e!raic
e$uation
)
Finds the root o, a continuous ,unction o, one varia!le
)
S+ntax% x 0 ,;ero&A,unB-xo'
@
A,unB is the name o, the user provided atla! m-,ile ,unction
&,un.m' that evaluates 3 returns the 2CS o, f&x' 0 (.
@
xo is an initial #uess ,or the solution o, f&x' 0 (.
)
*l#orithm uses a com!ination o, !isection- secant- and
inverse $uadratic interpolation methods.

Solution o, a sin#le nonlinear al#e!raic


e$uation%

=rite atla! m-,ile ,unction- ,un.m%

1all ,;ero ,rom the atla! command line to


,ind the solution%

>i,,erent initial #uesses- xo- can #ive di,,erent


solutions%
atlab $utorial cont%
( "
(4 . ( ' D . ( &
1
(1 . ( ' 3 &
1
' &
2 2
=
+
+
+
=
x x
x f
>> xo = 0;
>> fzero('fun',xo)
ans =
0.5376
>> fzero('fun',1)
ans =
1.2694
>> fzero('fun',4)
ans =
3.4015

Nonisothermal !hemical Reactor

Reaction% * E

*ssumptions
)
:ure * in ,eed
)
:er,ect mixin#
)
Ne#li#i!le heat losses
) 1onstant properties &- C
p
-
H- U'
)
1onstant coolin# FacGet
temperature &T
j
'

1onstitutive relations
)
Reaction rateHvolume% r 0 kc
A
0 k
(
exp&-EHRT'c
A
)
Ceat trans,er rate% Q 0 UA&T
j
-T'

odel Formulation

ass !alance

1omponent !alance

<ner#+ !alance
! !
d"
# d
$ $ $
= = = =

(
' &
A A A$
A
A A A A$ $ A
A A
C RT E #k C C
d"
dC
#
#r % C % C %
d"
#C % d
' H exp& ' &
' &
(
=
=
[ ]
' & ' H exp& ' & ' &
' & ' & ' & ' &
(
T T UA C RT E #k H T T C
d"
dT
#C
Q r# H T T !C T T C ! T T #C
d"
d
j A $ p p
r&f p r&f $ p $ r&f p
+ + =
+ + =


atlab Exercise

Stead+-state model

:arameter values
) k
0
0 3.4D3x1(
I
h
-1
- E 0 11J43 GcalHGmol
) &-H' 0 5D"( GcalHGmol, C
p
0 5(( GcalHm
3
HK
)
UA 0 15( GcalHhHK- R 0 1.DJI GcalHGmolHK
)
# 0 1 m
3
- 01 m
3
Hh-
) C
Af
0 1( GmolHm
3
- T
f
0 2DJ K- T
j
0 2DJ K.

:ro!lem
)
Find the three stead+-state points%
(
(
( & ' exp& H '
( & ' & ' exp& H ' & '
Af A A
p f A j
C C #k E RT C
C T T H #k E RT C UA T T
=
= + +
' - & T C
A

atlab $utorial cont%

FS92L< @ multivaria!le nonlinear ;ero ,indin#


)
atla! ,unction ,or solvin# a s+stem o, nonlinear al#e!raic
e$uations
)
S+ntax% x 0 ,solve&A,unB-xo'
@
Same s+ntax as ,;ero- !ut x is a vector o, varia!les and the ,unction-
A,unB- returns a vector o, e$uation values- #&x'.
)
:art o, the atla! 9ptimi;ation tool!ox
)
ultiple al#orithms availa!le in options settin#s &e.#. trust-
re#ion do#le#- 6auss-Newton- 2even!er#-ar$uardt'

S+ntax ,or ,solve


) x 0 ,solve&McstrM-xo-options'
) McstrM @ name o, the atla! m-,ile ,unction &cstr.m' ,or the 1S/R model
) xo @ initial #uess ,or the stead+ state- xo 0 N1
*
/O MP
) options @ atla! structure o, optimi;ation parameter values created with the
optimset ,unction

Solution ,or ,irst stead+ state- atla! command line input and output%
atlab Exercise& Solution with #sol"e
>> xo = [10 300]';
>> x = fsole('!s"r',xo,o#"$%se"('&$s#la'','$"er'))
(or% of )$rs"*or+er ,rus"*re-$on
."era"$on )un!*!oun" f(x) s"e# o#"$%al$"' ra+$us
0 3 1.29531e/007 1.76e/006 1
1 6 0.99169e/006 1 1.52e/006 1
2 9 1.91379e/006 2.5 7.71e/005 2.5
3 12 574729 6.25 6.2e/005 6.25
4 15 5605.19 2.90576 7.34e/004 6.25
5 10 0.602702 0.317716 776 7.26
6 21 7.59906e*009 0.00336439 0.0071 7.26
7 24 2.90612e*022 3.77060e*007 1.73e*000 7.26
1#"$%$za"$on "er%$na"e+2 f$rs"*or+er o#"$%al$"' $s less "3an o#"$ons.,ol)un.
x =
0.5637
311.1702

atlab Exercise& cstr%m
function f = cstr(x)
ko = 3.493e7;
E = 11843;
H = -5960;
rho! = 500;
"# = 150;
$ = 1.987;
% = 1;
& = 1;
'f = 10;
(f = )98;
(* = )98;
' = x(1);
( = x());
f(1) = &+('f - ') - %+ko+ex!(-E,$,()+';
f()) = rho!+&+((f - () - -H+%+ko+ex!(-E,$,()+' - "#+((*-();
f=f.;

Вам также может понравиться