# Setting up and solving for ODE

1. Jan 21, 2008

### hotcommodity

[SOLVED] Setting up and solving for ODE

1. The problem statement, all variables and given/known data

A 5 gallon bucket is full of pure water. Suppose we begin dumping salt into the bucket at a rate of .25 lbs per minute. Also, we open the spigot so that .5 gallons per minute leaves the bucket, and we add pure water to keep the bucket full. If the salt water solution is always well mixed, what is the amount of salt in the bucket after 1 minute?

2. Relevant equations

If I call the rate of salt flowing in $$\frac{dI}{dt}$$ then $$\frac{dI}{dt}= \frac{.25 lb salt}{min}$$

If I call the rate of solution flowing out $$\frac{dO}{dt}$$ then $$\frac{dO}{dt}= \frac{0.5 gal solution}{min}$$

The concentraion as the amount of salt at any time t divided by the amount of pure water is $$\frac{S(t)}{5gal}$$. Multiplying dO/dt by the concentration gives $$\frac{dO}{dt} = \frac{0.1S}{min}$$.

3. The attempt at a solution

I figure $$\frac{dS}{dt} = \frac{dI}{dt} - \frac{dO}{dt}$$

and thus $$\frac{dS}{dt} = .25 - 0.1(S)$$

I won't type out the rest until I know that I'm on track. Is this correct reasoning?

Any help is appreciated.

Last edited: Jan 21, 2008
2. Jan 21, 2008

### Mathdope

I think you are on the right track, yes.

3. Jan 21, 2008

### hotcommodity

Ok then. I have:

$$\frac{dS}{dt} = .25 - 0.1(S) = 0.1( 2.5 - S)$$

I separate variables (really only S) and integrate:

$$\int \frac{dS}{2.5 - S} = \int 0.1 dt$$

$$ln|2.5 - S| = 0.1t + C_1$$

$$2.5 - S = \pm e^{0.1t}e^{C_1}$$

$$2.5 - S = C_2e^{0.1t}$$

$$S(t) = 2.5 + C_3e^{0.1t}$$

If there is 0 salt at t = 0, then C3 = 2.5, and I have

$$S(t) = 2.5 + 2.5e^{0.1t}$$

However, this is incorrect.

4. Jan 21, 2008

### Mathdope

C3 would be -2.5 not 2.5

5. Jan 21, 2008

### hotcommodity

But at 1 min, that would give me a negative answer.

6. Jan 21, 2008

### Mathdope

It's possible that the problem lies in the fact that you're derivative measuring rate in is in terms of salt (with no water), while the derivative measuring rate out is in terms of the salt solution (with the water).

If they are adding pure water to keep the bucket full, you may need to recheck what you put for dI/dt.

Edit: No , now that I look again, it does look like both rates are measuring that of the salt only. Hmmm. I'll keep looking.

7. Jan 21, 2008

### hotcommodity

OK thanks, I appreciate the help.

Edit: If it helps at all the answer is 0.238 lbs.

Last edited: Jan 21, 2008
8. Jan 21, 2008

### Mathdope

Try factoring out a -0.1 instead of a 0.1 when you are setting up the differential equation. It shouldn't matter (!) but it will give you a negative exponential instead of a positive. I have to go eat but I'll be back in a half hour or so to see if that helps. Maybe someone else will see the problem too.

Edit: see below. It does matter. That's your problem right there, as "explained" below.

Last edited: Jan 21, 2008
9. Jan 21, 2008

### Mathdope

It is not the case that d/dS(ln|2.5 - S|)=1/[2.5 - S], so your antiderivative is a bit off (not much). Can you see why?

Last edited: Jan 22, 2008
10. Jan 22, 2008

### hotcommodity

I believe I should have used u-substitution while integrating. If I had done so, I would have:

$$- ln|2.5 - S| = 0.1t + C_1$$

$$-|2.5 - S| = e^{0.1t}e^{C_1}$$

$$-(2.5 - S) = \pm e^{0.1t}e^{C_1}$$

$$S - 2.5 = C_2e^{0.1t}$$

$$S(t) = C_2e^{0.1t} + 2.5$$

When S(t) is 0, C2 must be -2.5.

$$S(t) = 2.5 - 2.5e^{0.1t}$$

This is pretty much what I had before, I'm not sure what I'm doing wrong.

11. Jan 22, 2008

### Mathdope

Your mistake is going from the first line to second on the left hand side. In other words
$$- ln|2.5 - S|$$ doesn't become $$-|2.5 - S|$$ when exponentiating. Try it once more.

12. Jan 22, 2008

### hotcommodity

Ok I got it, I needed to place the negative on the other side of the equation. So I have:

$$S(t) = 2.5 - 2.5e^{-0.1t}$$

And I get the correct answer. Thank you very much for your help :)

13. Jan 22, 2008

### Mathdope

Aye that's it. You're welcome. You can now mark the thread solved.

Last edited: Jan 22, 2008