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

CBE 250: Computer

Applications in Chemical
Engineering
Lecture 4
Sept 9, 2015
*first finish bracketing
example

f(x)=5x -5x +6x-2


3

Open Methods
Chapter 6

Open methods
require only a
single starting
value of x or two
starting values
that do not
necessarily
bracket the root.

Newton-Raphson Method
Most widely used open method.
Based on first order Taylor series expansion:
x 2
f ( xi 1 ) f ( xi ) f ( xi )x f ( xi )
Ox 3
2!
The root is the value of x i 1 when f(x i 1 ) 0
Rearrangin g,
0 f(xi ) f (xi )( xi 1 xi )
f ( xi )
xi 1 xi
f ( xi )

A convenient method
for functions whose
derivatives can be
evaluated analytically.

Newton-Raphson
Visual Example

http://en.wikipedia.org/wiki/File:NewtonIteration_Ani.gif

Newton Raphson Method


Goal: to find value of x where f(x) = 0

Start with initial guess for x (xn)


Function approximated with tangent line
(derivative)

Compute x-intercept of this tangent line: =0


Use this value as new approximation
Iterate as necessary

Newton-Raphson Example

Class Examples
1. Solve the following nonlinear equation f(x)=e -x-x=0
using Newton method in Excel.

2. Use Polymath to find real root of:


f(x)=-1+5.5x-4x2+0.5x3
a) Initial guess 4.52
b) Initial guess 4.54

Graphical
examples of
functions for
which the
NewtonRaphson
technique (as
formulated)
doesnt work.

Numerical Differentiation
Definition of derivative

Secant line approximation to


derivative
A secant line is a line that (locally)
intersects two points on a curve

Called a Newton difference


quotient

The Secant Method (6.3)


A variation of Newtons method for
derivatives that are difficult to evaluate. For
these cases the derivative can be approximated
by a backward finite divided difference.
f ( xi ) f ( xi 1 )
f ( xi )
xi xi 1
xi xi 1
xi 1 xi f ( xi )
f ( xi ) f ( xi 1 )

i 1,2,3,

Requires two initial x


values that DO NOT need
to bracket the root.
The secant method has the
same properties as
Newtons method.
Convergence is not
guaranteed for all xo, f(x).

Secant
Method

Secant example

Systems of NonLinear Equations


f1 ( x1 , x2 , x3 , , xn ) 0
f 2 ( x1 , x2 , x3 , , xn ) 0

f n ( x1 , x2 , x3 , , xn ) 0
More than one function with more than
one variable.

Taylor series expansion of a function of more


than one variable
ui 1 ui

ui
u
( x1,i 1 x1,i ) i ( x2 ,i 1 x2,i )
x1
x2

vi
vi
vi 1 vi
( x1,i 1 x1,i )
( x2,i 1 x2 ,i )
x1
x2

The root of the equation occurs at the


value of x1 and x2 where ui+1 and vi+1
equal to zero.

ui
ui
ui
ui
xi 1
yi 1 ui xi
yi
x
y
x
y
vi
vi
vi
vi
xi 1
yi 1 vi xi
yi
x
y
x
y

A set of two nonlinear equations


with two unknowns that can be
solved for.

vi
ui
ui
vi
y
y
xi 1 xi
ui vi ui vi

x y y x
vi
ui
ui
vi
x
x
yi 1 yi
ui vi ui vi

x y y x

Determinant
of the
Jacobian of
the system.

CLASS PROBLEM
Solve two simultaneous nonlinear equations:
x x x 10
2

x 3x x 57
2

Using Newton-Raphson technique programmed in Excel and Polymath.

The Wilson equations are used to correlate the activity coefficients of strongly non-ideal, but
miscible systems. These equations reads:

x2 (G12 2 G211 )
ln 1 ln(1 )
1 2
x1 (G12 2 G211 )
ln 2 ln( 2 )
1 2
where: 1=x1+x2G12 and 2=x2+x1G21,
x are expressed as mole fractions
At the azeotrope point both vapor and liquid compositions are identical and i = P/Pio
Determine constants G12 and G21 knowing that azeotrope point is at P=760 mm Hg located at T=58.7oC
and x1=33.21 mole% (1-is ethanol; 2 is n-hexane).
logP1o=8.04494 - 1554.3/(222.65 + T)
logP2o = 6.87776 1171.530/(224.366 + T)
where T is in oC and Pio in mm Hg. The molecular weights of ethanol and n-hexane are 46.07 and
86.18. respectively.

This is an example of a chemical engineering problem


when you solve a set of nonlinear equations by finding
their roots!! Set up in Polymath

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