You will model a tank whose volume grows, and follow the salt in it with Euler's method. The tank holds and of salt at the start. Brine of enters at , and the mixture leaves at .
The idea. The volume is . The salt satisfies . The exact solution is . Euler's method with a small step should agree with it.
Your tasks.
volume(t). Return the volume in litres at time t minutes.salt_rate(Q, t). Return in kilograms per minute.simulate(t_end, h). Start with Q = Q0 and repeat the step round(t_end / h) times. Return the salt at the end.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…