<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="_pstyle259" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Heading 3" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Heading 2" rightmargin="0.0" spaceabove="8.0" spacebelow="2.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Heading 1" rightmargin="0.0" spaceabove="8.0" spacebelow="4.0"/><Layout alignment="left" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="right" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal258" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="centred" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal257" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" bullet="indent" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="List Item" rightmargin="0.0" spaceabove="3.0" spacebelow="3.0"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="Maple Input"/><Font background="[0,0,0]" family="Times New Roman" name="2D Comment" underline="false"/><Font background="[0,0,0]" bold="false" family="Times New Roman" foreground="[0,128,128]" italic="false" name="Hyperlink" size="12" subscript="false" superscript="false" underline="true"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Normal258" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Normal257" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" italic="true" name="_cstyle259"/><Font background="[0,0,0]" italic="true" name="_cstyle258"/><Font background="[0,0,0]" italic="true" name="_cstyle257"/><Font background="[0,0,0]" italic="true" name="_cstyle256"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="true" name="Heading 3" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Heading 2" readonly="false" size="14" underline="false"/><Font background="[0,0,0]" bold="true" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Heading 1" readonly="false" size="18" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="List Item" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Normal" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" family="Times New Roman" name="Page Number" underline="false"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="_pstyle259" readonly="false" size="12" underline="false"/><Font background="[0,0,0]" italic="true" name="_cstyle260"/></Styles><Page-Numbers enabled="false" first-number="1" first-numbered-page="1" horizontal-location="right" style="Page Number" vertical-location="bottom"/><Group><Input><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal257" style="Normal257">ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL</Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal257" style="Normal257">Lesson 5 -- Application: Mixing Problems</Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal257" style="Hyperlink"><Hyperlink executable="false" hyperlink="true" linktarget="http://www.math.sc.edu/~meade/" style="Hyperlink">Prof. Douglas B. Meade</Hyperlink></Text-field><Text-field layout="Normal257" style="Hyperlink"><Hyperlink executable="false" hyperlink="true" linktarget="http://www.math.sc.edu/~IMI/" style="Hyperlink">Industrial Mathematics Institute</Hyperlink></Text-field><Text-field layout="Normal257" style="Hyperlink"><Hyperlink executable="false" hyperlink="true" linktarget="http://www.math.sc.edu/" style="Hyperlink">Department of Mathematics</Hyperlink></Text-field><Text-field layout="Normal257" style="Hyperlink"><Hyperlink executable="false" hyperlink="true" linktarget="http://www.sc.edu/" style="Hyperlink">University of South Carolina</Hyperlink></Text-field><Text-field layout="Normal257" style="Normal257">Columbia, SC 29208
</Text-field><Text-field layout="Normal257" style="Normal257">URL:   <Hyperlink executable="false" hyperlink="true" linktarget="http://www.math.sc.edu/~meade/" style="Hyperlink">http://www.math.sc.edu/~meade/</Hyperlink></Text-field><Text-field layout="Normal257" style="Normal257">E-mail: <Hyperlink executable="false" hyperlink="true" linktarget="mailto:meade@math.sc.edu" style="Hyperlink">meade@math.sc.edu</Hyperlink> </Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal257" style="Normal257"><Font encoding="ISO8859-1">Copyright \251  2001  by Douglas B. Meade</Font></Text-field><Text-field layout="Normal257" style="Normal257">All rights reserved</Text-field><Text-field layout="Normal257" style="Normal257"/><Text-field layout="Normal257" style="Normal257">-------------------------------------------------------------------</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Section collapsed="true"><Title><Text-field layout="Heading 1" style="Heading 1">Outline of Lesson 5</Text-field></Title><Group><Input><Text-field layout="List Item" style="List Item"><Hyperlink executable="false" hyperlink="true" linktarget="Wks:#5.A" style="Hyperlink">5.A</Hyperlink> One-Tank Mixing Problem</Text-field><Text-field layout="List Item" style="List Item"><Hyperlink executable="false" hyperlink="true" linktarget="Wks:#5.B" style="Hyperlink">5.B</Hyperlink> Variable Volume Mixing Problem</Text-field><Text-field layout="List Item" style="List Item"><Hyperlink executable="false" hyperlink="true" linktarget="Wks:#5.C" style="Hyperlink">5.C</Hyperlink> Two-Tank Mixing Problem</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 1" style="Heading 1">Initialization</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">restart;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">with( DEtools ):</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">with( plots ):</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">with( PDEtools ):</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field bookmark="5.A" layout="Heading 1" style="Heading 1">5.A One-Tank Mixing Problem</Text-field></Title><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">A tank initially contains 40 gal of sugar water having a concentration of 3 lb of sugar for each gallon of water. At time zero, sugar water with a concentration of 4 lb of sugar per gal begins pouring into the tank at a rate of 2 gal per minute. Simultaneously, a drain is opened at the bottom of the tank so that the volume of the sugar-water solution in the tank remains constant.</Text-field><Text-field layout="List Item" style="List Item">(a) How much sugar is in the tank after 15 minutes?</Text-field><Text-field layout="List Item" style="List Item">(b) How long will it take the sugar content in the tank to reach 150 lb? 170 lb?</Text-field><Text-field layout="List Item" style="List Item">(c) What will be the eventual sugar content in the tank?</Text-field><Text-field layout="Normal258" style="Normal258"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Solution</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The mathematical formulation of this problem must express the physical requirement that</Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="_pstyle259" style="_pstyle259"><Equation input-equation="d/dt;" style="2D Comment">NiMqJiUiZEciIiIlI2R0RyEiIg==</Equation> ( <Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" size="12" style="_cstyle257" underline="false">amount of sugar in tank</Font>) = ( rate sugar is added to tank ) - ( rate sugar is removed from tank ) </Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal" style="Normal">Let <Equation input-equation="x(t);" style="2D Comment">NiMtJSJ4RzYjJSJ0Rw==</Equation> denote the amount of sugar (pounds) in the tank at time <Equation input-equation="t;" style="2D Comment">NiMlInRH</Equation> (minutes). Then, the rates in and out are respectively</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">rate_in := 4 * 2;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">rate_out := (x(t)/40) * 2;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">so that the governing ODE is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">ode := diff( x(t), t ) = rate_in - rate_out;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The amount of sugar in the tank initially, that is, when <Equation input-equation="t=0" style="2D Comment">NiMvJSJ0RyIiIQ==</Equation>, gives the initial condition</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">ic := x(0)=40 * 3;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The ODE in this IVP is first-order and linear. The integrating factor is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">mu(t) = intfactor( ode );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The solution to the IVP is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">sol := dsolve( { ode, ic }, x(t), [linear] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(a)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The amount of sugar (in pounds) in the tank after 15 minutes is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">eval( sol, t=15. );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(b)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The tank will contain 150 pounds of sugar at a time <Equation input-equation="t" style="2D Comment">NiMlInRH</Equation> (in minutes) satisfying</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">eq150 := eval( sol, x(t)=150 );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Thus, the desired time is found by the calculations</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">t150 := solve( eq150, t ):</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">t[`150 lbs`] = t150;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">`` = evalf(t150);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Repeating the same steps for the time when 170 pounds of sugar are in the tank leads to the equation</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">eq170 := eval( sol, x(t)=170 );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">whose solution is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">t170 := solve( eq170, t ):</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">t[`170 lbs`] = t170;
`` = evalf(t170);</Font>
</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">This complex-valued solution is clearly not physically realistic. A quick inspection of the solution, graphed in Figure 5.1,</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">plot( rhs(sol), t=0..120, title="Figure 5.1" );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">shows that the amount of sugar in the tank reaches a steady-state limit that is well below 170 pounds. Therefore, at no time is there ever 170 pounds of sugar in the tank.</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(c)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">In (b) it was noted that the amount of sugar in the tank levels off below 170 pounds. The exact limit can be determined from the solution by looking at the limit as <Equation input-equation="t" style="2D Comment">NiMlInRH</Equation> <Equation input-equation="-`&gt;`;" style="2D Comment">NiMsJCUiPkchIiI=</Equation> <Equation input-equation="infinity" style="2D Comment">NiMlKWluZmluaXR5Rw==</Equation>, that is, at</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">steady_state := map( Limit, sol, t=infinity );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">whose value is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">value( steady_state );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Note that <Equation input-equation="x=160" style="2D Comment">NiMvJSJ4RyIkZyI=</Equation> is an <Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" size="12" style="_cstyle258" underline="false">equilibrium</Font> <Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" size="12" style="_cstyle259" underline="false">solution</Font> for this ODE.   However, be careful to avoid the common error of concluding that the limit is 160 pounds <Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" size="12" style="_cstyle256" underline="false">because</Font> <Equation input-equation="x=160" style="2D Comment">NiMvJSJ4RyIkZyI=</Equation> is an equilibrium solution. (Recall the logistic growth model, <Hyperlink executable="false" hyperlink="true" linktarget="Wks:Lesson03.mw#3.B" style="Hyperlink">Lesson 3, Section B</Hyperlink> , which has two equilibria.)</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section></Section><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field bookmark="5.B" layout="Heading 1" style="Heading 1">5.B Variable Volume Mixing Problem</Text-field></Title><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">Consider the previous problem, except that the outflow from the tank is at a rate of 3 gallons per minute.</Text-field><Text-field layout="List Item" style="List Item">(a) Find the formula for the volume of sugar water in the tank at any time. When is the tank empty?</Text-field><Text-field layout="List Item" style="List Item">(b) Find the IVP for the amount of sugar in the tank.</Text-field><Text-field layout="List Item" style="List Item">(c) Find the IVP for the concentration of sugar in the water.</Text-field><Text-field layout="List Item" style="List Item">(d) When is the tank empty? What is the concentration of sugar immediately before the tank is empty? How much sugar is in the tank at this time?</Text-field><Text-field layout="List Item" style="List Item">(e) Plot the amount of sugar and concentration of sugar in the tank up to the time the tank becomes empty. What happens to these solutions at later times?</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Solution</Text-field></Title><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(a)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The volume starts at 40 gallons. Every minute 2 gallons of sugar water are added to the tank and 3 gallons are removed; the net change is a loss of 1 gallon per minute.  The rates "in" and "out" are respectively</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">Vrate_in := 2;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">Vrate_out := 3;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">so the time-varying volume in the tank is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">V := 40 + (Vrate_in-Vrate_out)*t;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Note that <Equation input-equation="V(t);" style="2D Comment">NiMtJSJWRzYjJSJ0Rw==</Equation> is the solution of the IVP</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeV := diff( v(t), t ) = 2 - 3;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">icV := v(0) = 40;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">as confirmed via</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">dsolve( { odeV, icV }, v(t), [separable] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(b)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The IVP for the amount of sugar in the tank is similar to the one in the previous example. There is no difference in the rate at which sugar enters the tank. The concentration of sugar exiting the tank is <Equation input-equation="x(t)/V" style="2D Comment">NiMqJi0lInhHNiMlInRHIiIiJSJWRyEiIg==</Equation> and this is different because <Equation input-equation="V = V(t);" style="2D Comment">NiMvJSJWRy1GJDYjJSJ0Rw==</Equation> is no longer constant.  The rates "in" and "out" are now respectively</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">Srate_in := rate_in;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">Srate_out := (x(t)/V) * 3;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Thus, the governing ODE is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">ode2 := diff( x(t), t ) = Srate_in - Srate_out;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The initial condition is unchanged:</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">ic2 := ic;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(c)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The IVP for the concentration of sugar in the tank is obtained from the ODE in (b) and the definition of the concentration, <Equation input-equation="c(t);" style="2D Comment">NiMtJSJjRzYjJSJ0Rw==</Equation>, which is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">conc_eq := c(t) = x(t)/'V';</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Rather than deriving the differential equation for <Equation input-equation="c(t);" style="2D Comment">NiMtJSJjRzYjJSJ0Rw==</Equation> manually, the <Hyperlink executable="false" hyperlink="true" linktarget="Help:PDEtools,dchange" style="Hyperlink">dchange</Hyperlink> command from the <Hyperlink executable="false" hyperlink="true" linktarget="Help:PDEtools" style="Hyperlink">PDEtools</Hyperlink> package will be used to automate the process.  It gives</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeC := dchange( x(t) = c(t)*V, ode2, [c] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The initial condition for the concentration is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">icC := c(0) = 3;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(d)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The tank is empty when the volume of sugar water is zero. This occurs after 40 minutes, as obtained by</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">t_empty := solve( V=0, {t} );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The concentration is found by solving the (linear) IVP found in (c), which is done via</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">solC := dsolve( { odeC, icC }, c(t), [linear] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Thus, the concentration at the instant the tank empties is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">subs( t_empty, solC );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The amount of sugar in the tank as the tank empties is obtained by evaluating the solution</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">sol2 := dsolve( {ode2,ic2}, x(t), [linear] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">at the time the tank empties.  This gives</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">subs( t_empty, sol2 );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">which is exactly what one would expect. (If not, think about it!)</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 3" style="Heading 3">(e)</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">The requested plots are</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">plot( rhs(sol2), t=0..40, title=`Amount of sugar` );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">and </Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">plot( rhs(solC), t=0..40, title=`Concentration of sugar` );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The concentration remains positive until  <Equation input-equation="t=120" style="2D Comment">NiMvJSJ0RyIkPyI=</Equation> , but after <Equation input-equation="t=40" style="2D Comment">NiMvJSJ0RyIjUw==</Equation>, the volume and amount of sugar become negative. Even though the IVPs have solutions for all time, for <Equation input-equation="t*`&gt;`*40;" style="2D Comment">NiMqKCUidEciIiIlIj5HRiUiI1NGJQ==</Equation> these results are not physically meaningful.</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section></Section></Section><Section collapsed="true"><Title><Text-field bookmark="5.C" layout="Heading 1" style="Heading 1">5.C Two-Tank Mixing Problem</Text-field></Title><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Problem Statement</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">Two tanks, tank I and tank II, are filled with <Equation input-equation="V" style="2D Comment">NiMlIlZH</Equation> gal of pure water. A solution containing <Equation input-equation="a" style="2D Comment">NiMlImFH</Equation> lb of salt per gallon is poured into tank I at a rate of <Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal per minute. The solution leaves tank I at a rate of <Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal/min and enters tank II at the same rate (<Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal/min). A drain is adjusted on tank II and the solution leaves tank II at a rate of <Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal/min. This keeps the volume of solution constant in both tanks (<Equation input-equation="V" style="2D Comment">NiMlIlZH</Equation> gal). Show that the amount of salt solution in tank II, as a function of time t, is given by</Text-field><Text-field layout="Normal257" style="Normal257"> <Equation input-equation="a*V - a*b*t*exp(-(b/V)*t) - a*V*exp(-(b/V)*t)" style="2D Comment">NiMsKComJSJhRyIiIiUiVkdGJkYmKipGJUYmJSJiR0YmJSJ0R0YmLSUkZXhwRzYjLCQqKEYpRiZGJyEiIkYqRiZGMEYmRjAqKEYlRiZGJ0YmRitGJkYw</Equation>.</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal258" style="Normal258">NOTE: This is Exercise 14 (p. 73) from Differential Equations,</Text-field><Text-field layout="Normal258" style="Normal258"> by Polking, Boggess, and Arnold (Prentice-Hall, 2001).</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section><Section collapsed="true"><Title><Text-field layout="Heading 2" style="Heading 2">Solution</Text-field></Title><Group><Input><Text-field layout="Normal" style="Normal">Let <Equation input-equation="x(t)" style="2D Comment">NiMtJSJ4RzYjJSJ0Rw==</Equation> and <Equation input-equation="y(t)" style="2D Comment">NiMtJSJ5RzYjJSJ0Rw==</Equation> denote the amount of salt, in pounds, in tanks I and II, respectively, at time <Equation input-equation="t" style="2D Comment">NiMlInRH</Equation>. The initial conditions for the two tanks are respectively</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">icI  := x(0) = 0;</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">icII := y(0) = 0;</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The "rate in" for tank I is <Equation input-equation="a" style="2D Comment">NiMlImFH</Equation> lb/gal * <Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal/min and the outflow is <Equation input-equation="x(t)/V" style="2D Comment">NiMqJi0lInhHNiMlInRHIiIiJSJWRyEiIg==</Equation> lb/gal at a rate of <Equation input-equation="b" style="2D Comment">NiMlImJH</Equation> gal/min. Therefore, the ODE governing the amount of salt in tank I is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">unassign('V');</Font></Text-field><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeI  := diff( x(t), t ) = a*b - b*(x(t)/V);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">For tank II, the inflow is the same as the outflow from tank I and the outflow exactly matches the inflow. Thus, the ODE governing the amount of salt in tank II is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeII := diff( y(t), t ) = b*(x(t)/V) - b*(y(t)/V);</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The first equation in this pair is independent of the variable <Equation input-equation="y(t);" style="2D Comment">NiMtJSJ5RzYjJSJ0Rw==</Equation>.  Hence, it can be solved first for <Equation input-equation="x(t);" style="2D Comment">NiMtJSJ4RzYjJSJ0Rw==</Equation>, and that result substituted into the second equation, making the second equation depend only on <Equation input-equation="y(t);" style="2D Comment">NiMtJSJ5RzYjJSJ0Rw==</Equation>.  In general, both equations of a system will contain both variables, and the equations will then be <Font bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" size="12" style="_cstyle260" underline="false">coupled</Font>.  Solution techniques for such systems will be developed in succeeding lessons.</Text-field><Text-field layout="Normal" style="Normal"/><Text-field layout="Normal" style="Normal">In this example, the first equation is a first-order linear ODE with integrating factor</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">mu[1](t) = intfactor( odeI );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The solution to the IVP for tank I is therefore</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">solI := dsolve( {odeI,icI}, x(t), [linear] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">To find the amount of salt in tank II, substitute the solution for tank I into the ODE for tank II, obtaining</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeIIa := subs( solI, odeII );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Despite the somewhat complicated appearance of this ODE, note that it is linear, as is verified by</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">odeadvisor( odeIIa );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The integrating factor is then found to be</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">mu[2](t) = intfactor( odeIIa );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">The solution to the IVP for tank II is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">solII := dsolve( {odeIIa,icII}, y(t), [linear] );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Group><Input><Text-field layout="Normal" style="Normal">Thus, the amount of salt in tank II at any time <Equation input-equation="t;" style="2D Comment">NiMlInRH</Equation>, is</Text-field><Text-field layout="Normal" style="Normal"/></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font italic="false" size="12" underline="false">expand( solII );</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group></Section></Section><Group><Input><Text-field layout="Normal" style="Normal">[Back to <Hyperlink executable="false" hyperlink="true" linktarget="Wks:Lesson00.mw" style="Hyperlink">ODE Powertool Table of Contents</Hyperlink>]</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"/></Input></Group><Text-field/><Text-field/><Text-field/><Text-field/><Text-field/></Worksheet>