Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Continuing my previous question from today - I should code a program that finds approximate value of the aforementioned differential equation. The full text of the assignment is:

Water purifier with volume $V = 10000 m^3$ has been contaminated by lead, which is disolved in it with volume of $10 g/m^3$. Fresh water is coming to the purifier at the rate of $2 m^3/s$ and it flows out at the same rate. How long will it take for the volume of lead in the water to drop below $10 \mu g/m^3$?

It can be equated as this differential equation: $$m' = -\frac{m}{V}v$$

Where $V = 10000 m^3$ - the Volume of the purifier, $v = 2 m^3/s$ - rate of water inflow/outflow and $m$ is the amount of lead present at the given time. I have no problem solving it explicitly.

After separating the variables I get:

$$m(t) = Ke^{\frac{-1}{500}t}$$

Where $K = 10000$

My problem is that I don't know what to use for the Euler's approximation. The equation stated here does not contain $t$ for the time elapsed - that's something that shows up only after integrating it and separating the variables and since $t$ is what I'm looking for I'm kinda stuck. Any help would be greatly appreciated.

share|cite|improve this question
up vote 1 down vote accepted

Your DE is autonomous; that is, the independent variable doesn't show up. We can simplify your DE to


where $C$ is a constant you obtain from your given $v$ and $V$. Thus, your Euler iteration runs a bit like (where $t$ is the independent variable):


where $t_0=0$, $m_0=10000$, and $h$ is a predetermined stepsize.

share|cite|improve this answer
Thanks for the answer - I have luckily figured that on my own last night, but the problem I have is somewhere else. I am running the algorithm like this - And is giving me really weird results. – Alexandar Živkovič Oct 31 '11 at 9:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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