# Variable Velocity

1. Jan 4, 2014

### hexlan

I've been relearning c++ and my friend gave me a problem to try and solve programmatically. Here is the set up:

There is a pitcher with a gallon of water.
The water is being poured out beginning at a rate of 2x milliliters per second.
x begins at 1 and increases by 1 over 5 seconds.

The goal is to find out how long it takes to pour out all the water.

I finished writing a program and got an answer, but unfortunately both me and my friend are quite rusty with our calculus and have no way of checking the answer.

Could someone possibly provide an answer, or better yet go through the proper way of solving it.

2. Jan 4, 2014

### Staff: Mentor

Does that mean x=1 + t/5?
WolframAlpha can integrate that (where u is the time in seconds), you just have to set the result equal to the number of milliliters in a gallon (I refuse to calculate with imperial units).

Or does the flow rate increase in steps (2, 4, 8, ... ml/s)? Then you need a sum.

3. Jan 4, 2014

### hexlan

That is correct.

4. Jan 4, 2014

### kbrookes

dv/dt = 2^x, x=1+(t/5) therefore dv/dt = 2^(1+t/5). Integrate this to find v in terms of t, when t=0, v=0. Use this to find the constant of integration. From this you can sub the volume of a gallon in ml to find the value of t(seconds). I think this should work however the integration may be a little tricky. Thanks Kyle

Last edited: Jan 4, 2014