In: Computer Science
A. Set up the IVP for the following mixture problem:
Suppose that a large tank containing 1000 gallons of pure water and that water containing 0.5 pounds of salt per gallon flows into the tank at a rate of 10 gallons per minute. The contents of the tank are kept thoroughly mixed and pumped out at the same rate so that the water level in the tank will remain constant. How much salt will be in the tank after 1 minute. Initially the tank contains no salt. Please use x(t) be the amount of salt at any time t in the tank.
B. Write codes to solve the IVP analytically and numerically using Sage Math Cell coding. Put your sage codes in the space provide below.
C. Use your codes, to determine the exact amount of salt and an approximate amount of salt after 1 minute with different step size h = 0.5, 0.1, and 0.05. Thanks!
We want a function that gives the amount of salt at time t, but
all the information is about how the amount
of salt is changing.
Let s(t) = amount, in kg of salt at time t. Then we have
ds
dt
= (rate of salt into tank) − (rate of salt out of tank)
= (0.05 kg/L · 5 L/min) + (0.04 kg/L · 10 L/min) −
s kg
1000 L
· 15 L/min
= 0.25 kg/min + 0.4 kg/min −
15s
1000
kg/min
So we get the differential equation
ds
dt
= 0.65 −
15s
1000
=
65
100
−
15s
1000
ds
dt
=
130 − 3s
200
We separate s and t to get
1
130 − 3s
ds =
1
200
dt
Integrate
Z
1
130 − 3s
ds =
Z
1
200
dt
−
1
3
· ln |130 − 3s| =
1
200
t + C1
ln |130 − 3s| = −
3
200
t + C2
|130 − 3s| = e− 3
200 t+C2
|130 − 3s| = C3e
−3t/200
130 − 3s = C4e
−3t/200
−3s = −130 + C4e
−3t/200
s =
130 − C4e
−3t/200
3
Since we begin with pure water, we have s(0) = 0.
Substituting,
0 =
130 − C4e
−3·0/200
3
0 = 130 − C4
C4 = 130
1Stewart, Calculus, Early Transcendentals, p. 607, #48.
So our function is
s(t) = 130 − 130e−3t/200
3
After one hour (60 min), we have
s(60) = 130 − 130e−3·60/200
3
s(60) ≈ 25.7153
Thus, after one hour there is about 25.72 kg of salt in the
tank