Mixing Problems

mix.mws

Douglas B. Meade (meade@math.sc.edu)

1 Overview

Mixing problems provide a simple application of linear differential equations. The problems considered in this worksheet concentrate on the modelling and interpretation of the solution more than the mechanics of the solution techniques for first-order linear ODEs and IVPs. Graphical and symbolic solutions will be examined, and the problems will be extended to illuminate other interested, and accessible, features of these problems.

The majority of the effort will be spent on problems with discontinuous coefficients (as introduced in the worksheet discont.mws, which examined Problems 31 and 32 in Section 2.3, pp. 53-54). Another problem to which the same techniques can be applied is the parachute problem (Example 3, pp. 112-113) and several Problems from Section 3.4.

In order for you to work through this worksheet, it will be necessary for you to fill in missing pieces of some of the Maple commands. A pair of question marks (??) marks each place where the Maple code needs to be modified.

2 Objectives

• to gain experience working with first-order linear ODEs and IVPs

• to be introduced to problems that have discontinuities

• to collect more practice using graphical (DEplot) and symbolic (dsolve) methods to solve and analyze IVPs

• to gain experience using solutions generated by Maple to answer subsequent questions

• to be introduced to the piecewise command

3 New Maple Commands

• piecewise creates a piecewise-defined function, i.e., a function defined by different rules for different parts of its domain

4 Problem 33 (Section 2.2, p. 45)

Suppose a brine solution containing 3 kg of salt per liter (L) runs into a tank initially filled with 400 L of water containing 20 kg of salt. If the brine enters at 10 L/min, the mixture is kept uniform by stirring, and the mixture flows out at the same rate, find the mass of salt in the tank after 10 min. [Hint: Let A denote the number of kilograms of salt in the tank at t minutes after the process begins, and use the fact that

rate of increase in A = rate of input - rate of exit

4.1 Solution

> restart;
> with( DEtools ):
> with( plots ):

The relevant data for this problem is:

• inflow: salt concentration with 3 kg of salt per liter at a flow rate of 10 L/min

• outflow: flow rate of 10 L/min

• initial state: 20 kg of salt in 400 L of water

The corresponding differential equation and initial condition are:

> ODE := diff( A(t), t ) = 30 - 10/400 * A(t);
> IC := A(0) = 20;

ODE := \frac{∂}{∂t} A(t) = 30 − \frac{1}{40} A(t)

IC := A(0) = 20 4.1.1 Points to Ponder

Before computing any solutions, look at this problem and develop a rough picture about what the solution should look like. Questions to consider include:

• Does the amount of salt increase, decrease, or stay the same for t just a little larger than 0?

• What will the amount of salt be after a long period of time has passed (i.e., as t -> ∞)?

A graphical solution provides a simple means of confirming your intuition, and to verify that the model is reasonable. Replace the question marks (??) in the following Maple commands to create an informative view of the solution to this problem, including the direction field.

> DEplot( ??, ??, t=0..??, { [??,??] },
> title=`Problem 33 (p.45) -- Graphical Solution` );

The specific question that is asked in this problem is: how much salt is in the tank after 10 minutes?

The graphical solution yields an estimate of approximately 275 kg. To determine the exact amount, a symbolic solution is needed. This can be easily determined by hand (what is the appropriate integrating factor?), or by Maple. Modify the following command so that it returns the exact solution to this problem

> SOLN := dsolve( { ??, ?? }, A(t) );
> SOLN := simplify( SOLN );

SOLN := SOLN

The amount of salt in the tank after 10 minutes is A(10), which can be evaluated by substituting t = 10 into the solution:

> simplify( subs( t=10, SOLN ) );

SOLN

Which is, using floating point arithmetic, approximately

> evalf(");

SOLN

Note that this is consistent with the estimate obtained from the graphical solution. The qualitative behavior of the solution is easily observed from the solution: the amount of salt increases for all t>0 and tends towards the equilibrium solution A = 1200.

4.1.2 Point to Ponder

• How long does it take the solution to get within 1% of the equilibrium solution?

5 Problem 35 (Section 2.3, p. 54)

Suppose a birne containing 2 kg of salt per liter runs into a tank initially filled with 500 L of water containing 50 kg of salt. The brine enters the tank at a rate of 5 L/min. The mixture, kept uniform by stirring, is flowing out at a rate of 5 L/min.

(a) Find the concentration, in kilograms per liter, of salt in the tank after 10 min.

(b) After 10 min, a leak develops in the tank and an additional liter per minute of mixture flows out of the tank. What will be the concentration, in kilograms per liter, of salt in the tank 20 min after the leak develops?

5.1 Solution

This problem is like the previous example, except that after 10 minutes the tank springs a leak and an extra 1 L of the brine solution is drained each minute. This has two effects on the problem, first it introduces a discontinuity in the the differential equation and second, for t>10, the volume is not constant. The specific questions asked in the problem will be augmented with other questions that provide qualitative information about the solution.

Two different approaches to this problem will be considered. The first, which parallels that in the text, is to define two separate IVPs, using the solution from the first IVP to determine the initial condition for the second IVP. The second approach is to use Maple’s piecewise command to write a single IVP, with a discontinuous coefficient. In each case, both the graphical and symbolic solution will be examined.

For t<10 minutes, the differential equation and initial condition associated with this problem are

   > ODE1 := diff( A(t), t ) = 10 - 5/500*A(t);
   > IC1 := A(0) = 50;

ODE1 := \frac{∂}{∂t} A(t) = 10 − \frac{1}{100} A(t)

IC1 := A(0) = 50

For t>10 the differential equation is significantly different, the volume of solution in the tank is no longer a constant 500 L – each minute the volume decreases by one liter. This “rate equation” sounds like a differential equation – and it is!

> ODEv := diff( v(t), t ) = -1;
> ICv := v(10)=500;

ODEv := \frac{∂}{∂t} v(t) = −1

ICv := v(10) = 500

This IVP is so simple that it would be foolish to use Maple to solve it. The general solution to the ODE is: v(t) = C − t; the initial condition (at t = 10) shows that C = 510 and, thus, v(t) = 510 − t for all t>10. Thus, the concentration of solution being drained from the tank is \frac{A(t)}{v(t)} = \frac{A(t)}{510−t} for t>10. Combined with the other information for this problem, the differential equation that results is

> ODE2 := diff( A(t), t ) = 10 - 6/(510-t)*A(t);

ODE2 := \frac{∂}{∂t} A(t) = 10 − 6 \frac{A(t)}{510 − t}

The “initial condition” for the second stage of the process ( t>10) is the amount of salt at the end of the first stage, A(10). To estimate this amount, complete the following DEplot command to generate a graphical solution of the problem.

> p1 := DEplot( ??, ??, ??, ??, ??  ):
> display( p1, title=`Problem 35 (p.54) -- Graphical Solution,
t<10` );

This provides the approximate initial condition

> ICb := A(10) = 140;

ICb := A(10) = 140

A first answer to the question about the amount of salt in the tank 20 minutes after the leak begins, i.e., t = 30, can be obtained from a graphical solution. (Be particularly careful about the specification of the time interval and the initial condition.)

> p2 := DEplot( ??, ??, ??, ??, ??  ):
> display( ??, title=`?¿ );

The “union” of these two plots is particularly effective at illustrating the interconnections between the two stages of the problem.

> display( { p1, p2 }, title=`Problem 35 (p.54) -- Graphical Solution,
0<t<30` );

5.1.1 Points to Ponder

• Notice that the solution is continuous. In fact, the solution appears to be differentiable at t = 10, but we know that this cannot be so. (Why?)

• Moreover, the change in the outflow rate does not seem to have had much of an impact on the solution. If this is actually true, what qualitative behavior do you expect to see in A? (That is, assuming there is no leak, what is A(t) as t–> ∞?)

• Determine the true long-time behavior of the solution using the graphical solution for 9 minutes after the leak begins. Identify all unexpected behavior in the solution – explanations will be developed in the remainder of this worksheet.

At this point it seem reasonable to ask if the graphical solution can really be trusted. Since the IVP involved in each stage involves a first-order linear ODE, an explicit solution can be obtained. The following commands can be used to construct the solution for all t>0.

The solution during the first 10 minutes is obtained by a single call to dsolve:

> SOLN1 := dsolve( { ??, ?? }, A(t) );

This solution is used to determine the initial condition for the second stage of the process. Substituting t=10 into the first solution yields:

> IC2 := subs( t=10, ??  );

which is, approximately,

> evalf( IC2 );

IC2 Now, the solution the second IVP is easily determined:

> SOLN2 := dsolve( { ??, ?? }, A(t) );

While this solution is somewhat messy, note that it is simply a sixth-order polynomial (with a few very small coefficients).

> evalf( SOLN2 );

SOLN2

A plot of the solution over the requested time interval yields the picture

> P1 := plot( rhs(??), t=0..??, color=RED ):
> P2 := plot( rhs(??), t=??..??, color=BLUE ):
> display( {P1,P2}, title=`Problem 35 (p.54) -- Symbolic Solution,
0<t<?¿ );

5.1.2 Points to Ponder Note that there are some differences in the graphical and symbolic solutions, but not before t = 510.

• What is special about t = 510?

• What can be said about the solutions for t>510?

• (Hint: What does the existence theory have to say about this problem?)

Other features of this solution that are of interest include the maximum amount of salt in the tank, and the time at which this occurs. Both answers can be obtained either from the graphical or symbolic solution. One way in which the symbolic solution can be used to obtain this information is illustrated in the next set of commands, which are missing a few arguments.

Basically, all that is needed is to find the critical points of the solution during stage 2 (why?). For this, a derivative of the solution is needed

> dA := diff( rhs(??), t );
> fsolve( ??, ??  );

The maximum amount of salt in the tank is, therefore, approximately

> evalf( subs( t=149.85207, SOLN2 ) );

SOLN2 5.1.3 Note on Maple Usage – fsolve vs. solve

Note that solve can be used, but the results are almost of no use (to see what I mean, change the colon to a semi-colon at the end of the solve command that follows). All five (5) solutions are reported, in terms of nested radicals. The main item of interest in these solutions is that there is only one real root; the other four appear as two pairs of conjugate pairs.

   > solve( dA=0,t ):

Numerical approximations to the roots confirm this conjecture:

   > evalf(");

SOLN2

5.1.4 Points to Ponder

• Do you think this amount is exactly 600 kg or the time is exactly 150 minutes?

• Or, are these floating point approximation accurate to more several digits to the right of the decimal point?

• How could you use Maple to test these conjectures?

The analysis has focused on the amount of salt in the tank. Similar questions can be asked about the concentration of the salt in the tank.

5.1.5 Plot the concentration as a function of time t for as long as the solution is physically reasonable.