4 Engineering Example 2

4.1 Pressure in an ideal multi-component mixture

Introduction

An ideal multi-component mixture consists of

1.  n -pentane (5%)

2.  n -hextane (15%)

3.  n -heptane (50%)

4.  n -octane (30%)

In general, the total pressure, P (Pa) of an ideal four-component mixture is related to the boiling point, T (K) through the formula:

P = x 1 p 1 + x 2 p 2 + x 3 p 3 + x 4 p 4

where, for component i , the mole fraction is x i and the vapour pressure is p i , given by the formula:

p i = exp A i B i ( T + C i ) i = 1 , 2 , 3 , 4

Here p i is in mm Hg (1 mm Hg = 133.32 Pa), T is the absolute temperature (K) and the constants A i , B i and C i are given in the table below.

i component x i A i B i C i
1 n -pentane 0.05 15.8333 2477.07 39.94
2 n -hexane 0.15 15.8366 2697.55 48.78
3 n -heptane 0.50 15.8737 2911.32 56.51
4 n -octane 0.30 15.9426 3120.29 63.63

Problem 1

For the liquid compositions, x i given in the table above, plot a graph of the total pressure, P (Pa) against temperature (K) over the range 250 to 500 K.

Solution

p i = exp A i B i T + C i , expressed in millimetres of mercury, and so it is 133.32 times that in pascals. Therefore, expressed in pascals, we have

P = 133.32 i = 1 4 x i exp A i B i T + C i

Plotting this from T = 250 to 500 gives the following graph

Figure 15

No alt text was set. Please request alt text from the person who provided you with this resource.

Problem 2

Using the Newton-Raphson method, solve the equations to find the boiling points at total pressures of 1, 2, 5 and 10 bars. Show the sequence of iterations and perform sufficient calculations for convergence to three significant figures. Display these solutions on the graph of the total pressure, P (Pa) against temperature T (K).

Solution

We wish to find T when P = 1 , 2 , 5 and 10 bars, that is, 1 0 5 , 2 × 1 0 5 , 5 × 1 0 5 and 10 × 1 0 5 Pa.

Reading crude approximations to T from the graph gives a starting point for the Newton-Raphson process. We see that for 1 0 5 , 2 × 1 0 5 , 5 × 1 0 5 and 10 × 1 0 5 Pa, temperature T is roughly 365 , 375 , 460 and 485 degrees K, respectively, so we shall use these values as the start of the iteration.

In this case it is easy to calculate the derivative of P with respect to T exactly, rather than numerically, giving

P ( T ) = 133.32 i = 1 4 x i exp A i B i T + C i × B i ( T + C i ) 2

Therefore to solve the equation P ( T ) = y , we set T 0 to be the starting value above and use the iteration

T n + 1 = T n P ( T n ) y P ( T n )

For y = 100000 this gives the iterations

T 0 T 1 T 2 T 3 T 4
365 362.7915 362.7349 362.7349 362.7349

We conclude that, to three significant figures T = 36 3 K when P = 100000 Pa.

For y = 200000 this gives the iterations

T 0 T 1 T 2 T 3 T 4
375 390.8987 388.8270 388.7854 388.7854

We conclude that, to three significant figures T = 38 9 K when P = 200000 Pa.

For y = 500000 this gives the iterations

T 0 T 1 T 2 T 3 T 4 T 5
460 430.3698 430.4640 430.2824 430.2821 430.2821

We conclude that, to three significant figures T = 43 0 K when P = 500000 Pa.

For y = 1000000 this gives the iterations

T 0 T 1 T 2 T 3 T 4 T 5
475 469.0037 468.7875 468.7873 468.7873 468.7873

We conclude that, to three significant figures T = 46 9 K when P = 1000000 Pa.

4.2 An approximate Newton-Raphson method

The Newton-Raphson method is an excellent way of approximating zeros of a function, but it requires you to know the derivative of f . Sometimes it is undesirable, or simply impossible, to work out the derivative of a function and here we show a way of getting around this.

We approximate the derivative of f . From Section 31.3 we know that

f ( x ) f ( x + h ) f ( x ) h

is a one-sided (or forward) approximation to f and another one, using a central difference, is

f ( x ) f ( x + h ) f ( x h ) 2 h .

The advantage of the forward difference is that only one extra f -value has to be computed. If f is especially complicated then this can be a considerable saving when compared with the central difference which requires two extra evaluations of f . The central difference does have the advantage, as we saw when we looked at truncation errors, of being a more accurate approximation to f .

The spreadsheet program Microsoft Excel has a built in “solver" command which can use Newton’s method. (It may be necessary to use the “Add in" feature of Excel to access the solver.) In reality Excel has no way of working out the derivative of the function and must approximate it. Excel gives you the option of using a forward or central difference to estimate f .

We now reconsider the problem we met in Examples 24 to 26.

Example 27

We know that the single positive zero of f ( x ) = x tanh ( 1 2 x ) 1   lies between 1.5 and 2 . Use the Newton-Raphson method, with an approximation to f , to approximate the zero of f .

Solution

There is no requirement for f this time, but the nature of this method is such that we will resort to a computer straight away. Let us choose h = 0.1  in our approximations to the derivative.
Using the one-sided difference to approximate f ( x ) we obtain this sequence of results from the spreadsheet program:

n x n f ( x n ) f ( x + h ) f ( x ) h x n + 1 ̲ ̲ ̲ ̲ ̲ 0 1.75 0.231835 1.154355 1.549165 1 1.549165 0.006316 1.110860 1.543479 2 1.543479 8.16 E 05 1.109359 1.543406 3 1.543406 1.01 E 06 1.109339 1.543405 4 1.543405 1.24 E 08 1.109339 1.543405 5 1.543405 1.53 E 10 1.109339 1.543405 6 1.543405 1.89 E 12 1.109339 1.543405 7 1.543405 2.31 E 14 1.109339 1.543405 8 1.543405 0 1.109339 1.543405

And using the (more accurate) central difference gives

n x n f ( x n ) f ( x + h ) f ( x h ) 2 h x n + 1 ̲ ̲ ̲ ̲ ̲ 0 1.75 0.231835 1.144649 1.547462 1 1.547462 0.004448 1.095994 1.543404 2 1.543404 1 E 06 1.094818 1.543405 3 1.543405 7.95 E 10 1.094819 1.543405 4 1.543405 6.1 E 13 1.094819 1.543405 5 1.543405 0 1.094819 1.543405

We see that each of these approaches leads to the same value (1.543405) that we found with the Newton-Raphson method.

Task!

Use a spreadsheet to recompute the approximations shown in Example 24, for the following values of h :

h = 0.001 , 0.00001 , 0 . 000001 .

You should find that as h decreases, the numbers get closer and closer to those shown earlier for the Newton-Raphson method. For example, when h = 0.0000001 we find that for a one-sided difference the results are

n x n f ( x n ) f ( x + h ) f ( x ) h x n + 1 ̲ ̲ ̲ ̲ ̲ 0 1.75 0.231835 1.145358 1.547587 1 1.547587 0.004585 1.096870 1.543407 2 1.543407 2.52 E 06 1.095662 1.543405 3 1.543405 8.08 E 13 1.095661 1.543405 4 1.543405 0 1.095661 1.543405

and those for a central difference with h = 0.0000001 are

n x n f ( x n ) f ( x + h ) f ( x h ) 2 h x n + 1 ̲ ̲ ̲ ̲ ̲ 0 1.75 0.231835 1.145358 1.547587 1 1.547587 0.004585 1.096870 1.543407 2 1.543407 2.52 E 06 1.095662 1.543405 3 1.543405 7.7 E 13 1.095661 1.543405 4 1.543405 0 1.095661 1.543405

It is clear that these two tables very closely resemble the Newton-Raphson results seen earlier.

Exercises
  1. It is given that the function

    f ( x ) = x 3 + 2 x + 8

    has a single negative zero.

    1. Find two integers a and b which bracket the zero of f .
    2. Perform one iteration of the bisection method so as to halve the size of the bracketing interval.
  2. Consider a simple electronic circuit with an input voltage of 2.0 V, a resistor of resistance 1000 Ω and a diode. It can be shown that the voltage across the diode can be found as the single positive zero of

    f ( x ) = 1 × 1 0 14 exp x 0.026 2 x 1000 .

    Use one iteration of the Newton-Raphson method, and an initial value of x 0 = 0.75 to show that

    x 1 = 0.724983

    and then work out a second iteration.

  3. It is often necessary to find the zeros of polynomials as part of an analysis of transfer functions. The function

    f ( x ) = x 3 + 5 x 4

    has a single zero near x 0 = 1 . Use this value of x 0 in an implementation of the Newton-Raphson method performing two iterations. (Work to at least 6 decimal place accuracy.)

  4. The smallest positive zero of

    f ( x ) = x tan ( x ) + 1

    is a measure of how quickly certain evanescent water waves decay, and its value, x 0 , is near 3 . Use the forward difference

    f ( 3.01 ) f ( 3 ) 0.01

    to estimate f ( 3 ) and use this value in an approximate version of the Newton-Raphson method to derive one improvement on x 0 .

    1. By trial and error we find that f ( 2 ) = 4 and f ( 1 ) = 5 , from which we see that the required bracketing interval is a < x < b where a = 2 and b = 1 .
    2. For an iteration of the bisection method we find the mid-point m = 1.5 . Now f ( m ) = 1.625 which is of the opposite sign to f ( a ) and hence the new smaller bracketing interval is a < x < m .
  1. The derivative of f is f ( x ) = 1 × 1 0 14 0.026 exp x 0.026 + 1 1000 , and therefore the first iteration

    of Newton-Raphson gives x 1 = 0.75 0.032457 1.297439 = 0 . 724983 .

    The second iteration gives x 2 = 0.724983 0.011603 0.496319 = 0 . 701605 .

    Using a spreadsheet we can work out some more iterations. The result of this process is tabulated below

    n x n f ( x n ) f ( x n ) x n + 1 ̲ ̲ ̲ ̲ ̲ 2 0.701605 0.003942 0.202547 0.682144 3 0.682144 0.001161 0.096346 0.670092 4 0.670092 0.000230 0.060978 0.666328 5 0.666328 1.56 E 05 0.052894 0.666033 6 0.666033 8.63 E 08 0.052310 0.666031 7 0.666031 2.68 E 12 0.052306 0.666031 8 0.666031 0 0.052306 0.666031

    and we conclude that the required zero of f is equal to 0.666031 , to 6 decimal places.

  2. Using the starting value x 0 = 1 you should find that f ( x 0 ) = 2 and f ( x 0 ) = 8 . This leads to

    x 1 = x 0 f ( x 0 ) f ( x 0 ) = 1 2 8 = 0 . 75 .

    The second iteration should give you x 2 = x 1 f ( x 1 ) f ( x 1 ) = 0.75 0.171875 6.6875 = 0 . 724299 .

    Subsequent iterations can be used to ‘home in’ on the zero of f and, using a computer spreadsheet program, we find that

    n x n f ( x ) f ( x ) x n + 1 ̲ ̲ ̲ ̲ ̲ 2 0.724299 0.001469 6.573827 0.724076 3 0.724076 1.09 E 07 6.572856 0.724076 4 0.724076 0 6.572856 0.724076

    We see that the method converges to the value 0.724076 .

  3. We begin with

    f ( 3 ) f ( 3.01 ) f ( 3 ) 0.01 = 0.02924345684 0.01 = 2.924345684 ,

    to the displayed number of decimal places, and hence an improvement on x 0 = 0.75 is

    x 1 = 3 f ( 3 ) 2.924345684 = 2.804277 ,

    to 6 decimal places. (It can be shown that the root of f is 2.798386, to 6 decimal places.)