I have trouble with solving the following mixtures problem.

A tank of 380 liters is full of brine with a concentration of 113 grams of salt per liter. How much salt per minute needs to be added per minute so that, when 19 liters remain, the concentration is 227 grams of salt per liter, if brine drains at a rate of 3.8 liters per minute?

The differential equation should be:

y'[t] == p - 3.8*y[t]/(380 - 3.8 t), 

where p is the rate at which salt is added, the unknown I am searching for.

When I imput it into the program it fails to solve it.

DSolve[y'[t] == p - 3.8/(380 - 3.8 t)*y[t], y[t], t].

However, if I replace p a number beween -2.7 to 2.7 it works. It also does if I put 2 E or any other number multiplied by Euler's number. I tried solving it using p = p*e, which did work, however I get laughably small numbers (10^-15) for p.

The printed answer is 114/Log[20], aproximately 38.05g/min.

Am I inputting something wrong?


When I imput it into the program it fails to solve it.

DSolve[y'[t] == p - 3.8/(380 - 3.8 t)*y[t], y[t], t]

Try like this:

ode=y'[t]==p-3.8/(380-3.8 t)*y[t];

Mathematica graphics

Now it works. It looks like due to numerics in original version it got stuck in integration. (just a guess, I really do not know why it does not work with non-exact numbers). Some debugging is needed.

ps. As rule-of-thumb, it is always better when using symbolic functions, such as DSolve and Integrate etc... to use exact numbers.

Version 11.2 on windows.

| improve this answer | |
  • $\begingroup$ Thanks for the quick help. It seems to indeed work now. The answer is a complex number however, which seems weird. $\endgroup$ – Nico Elson Oct 22 '17 at 17:12

Let's see if this clears things up.

First we find the duration of the process

Solve[380 - 38/10 t == 19, t]

which tells us that it takes 95 minutes for the process to complete.


Clear[t, salt, saltAdded];
water[t_] := 380 - 38/10*t;
{salt, saltAdded} = {salt[t], saltAdded[t]} /. DSolve[{
   salt[0] == water[0]*113, salt[95] == water[95]*227, 
   salt'[t] == saltAdded'[t] - water'[t]*salt[t]/water[t], 
   saltAdded''[t] == 0, saltAdded[0] == 0},
   {salt[t], saltAdded[t]}, t][[1]]

Use those results to check the boundary conditions

salt/water[t] /. t -> 0

results in 113 as required.

salt/water[t] /. t -> 95

results in 227 as required.

A plot shows the concentration over the duration

Plot[salt/water[t], {t, 0, 95}, PlotRange -> All]

enter image description here

The saltAdded is 29982/35 == 856.629 grams/minute.

Even though the equations seem correct, the end points are correct and the shape of the plot looks good, that saltAdded seems too large and I'm still looking at this.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.