If you dip a straw in a cup of water and hold your finger over the top, you can then pull the straw out and remove the amount** contained in the straw.
Obviously it would take an infinite number of dips to empty the cup completely, but did you ever wonder how many times would you have to repeat this process to lower the water level to some smaller amount?
This file provides an analytical solution (for any cup and straw dimensions) to this question and a simulated process that verifies the analytical equation, as well as a graph showing the change in water level after each dip.
** Under certain assumptions:
1. The cup and straw are perfectly cylindrical
2. The amount of water in the straw for any dip is exactly equal to the height of the water in the cup times the crosssectional area of the straw. (Ignoring adhesive/cohesive properties of water that result in meniscus/surface tension effects)
3. The outside of the straw is completely dry at the time of removal from the cup
4. The straw has negligible volume (so its volume does not displace water in the cup when it is inserted)
1.0.0.0  MathWorks update: Added Live Script. 

1.0.0.0  Updated description, information 

1. Updated Published mfile (HTML)


1) Added the derivation to the anyalitical solution for anyone interested 

Description update 

Format fix in the published file 
Create scripts with code, output, and formatted text in a single executable document.
The assumption
4. The straw has negligible volume (so its volume does not displace water in the cup when it is inserted)
is excessive,
the solution is valid even for finite thickess of straw wall.
Sorry,
n = log(V0/Vn)/r
What a nice theory! what do I missing?
Let
As = crosssection Area of straw
Ac = crosssection Area of cup
r=As/Ac <<<< 1
V0= initial water volume in the cup
V1 = volume in cup after first iteration,
V2  after second,
...
Vn  after nth iteration,
...
According to assumption r<<1,
V1=(1r)*V0;
V2=(1r)*V1=(1r)^2*V0,...
Vn=(1r)^n*V0;
thus if you want to reach certain Vn, then
n=log(Vn/V0)/log(1r)
or (r<<1)
n = r*log(V0/Vn)
What's wrong? Where is any problem?
interesting, thoughtful, and creative
The analytical solution derivation is now available.
This could have been a good submission if it were complete. In addition to what everyone else criticzed it for, this submission should track the dynamics of every molecule of the liquid. Without that it is worthless example of wasted time using MATLAB.
Just kidding. This submission is an example of different folk's expectations. What the author thought was fun, was interpretted much differently by others.
By the way, the general consensus seems to be that this would find a more appropriate home in the Physics category, so I plan to move it there shortly.
I'll work on it (the derivation part and hopefully an experiment too), just for John I think. :)
Really this whole idea of the cup and straw started when I was trying to drink my juice with a straw in the dining hall at college ... and I wondered how long it would take me. Probably the only reason I haven't collected some actual data yet is the difficulty in making the measurements (all I have is a ruler!). But it would be neat to see how the equation holds up. :)
John is not too critical ... Perhaps I was just being overly sensitive because this submission was intended to be something fun and simple and not a perfectly robust model of a physical system ... and from some of the various (not just John's) comments, people seemed to be interpretting it much too seriously. In any case, I hope everyone enjoys their time reviewing my work (not work! fun!) and I am sure there will be updates! :)
Joe seems to think I'm too critical, that I can't appreciate elegant mathematics. The problem is that there is no elegant mathematics here. He has left it all out. All there is is a formula with no basis for its derivation. As I said in my initial review, this is NOT a poor work. It could be much better, and I hope he chooses to make it so. John
I like this contribution. A simple problem is stripped to its essence. A purely geometric problem results. I suppose that is why this contribution was considered general mathematics.
Using numerics and an analytic derivation to double check your results is always good practice, and Matlab makes this especially easy. As an example of the role of matlab in scientific (and engineering) practice, this example is valuable.
I would have liked to see the physical assumptions explicitly stated. These are, in addition to those mentioned, that the meniscus volume is neglected and that the surface of the straw has a finite wetting angle (so no liquid clings to the outside of the straw if it is withdrawn from the cup sufficiently slow). Perhaps this would have improved the appreciation for this contribution.
On the other side, if nobody is paying you to do this, the efford should stop when the fun does.
Further, by recognizing that the straw of cross sectional area A_s = pi R_s^2, removes V*A_s/A_c each time it is dipped in the cup, one can see that after each dip, the volume is multiplied by a factor (A_cA_s)/A_c. After n dips, the volume is
V_n = V_0 ((A_cA_s)/A_c)^n
and thus
h_n = h_0 ((A_cA_s)/A_c)^n
Exponential decay as shown in the contribution (or did I make a mistake?)
Thank you for your contribution,
Roger.
This was not intended to be the endall model of the cupstraw system. No one begins modeling the path of a ball through the air with all the possible considerations that could affect its flight (gravity, air resistance, shape/spin of the ball, etc). No, they begin with the largest contributor (gravity) and initially model the path with a parabola ... This was just supposed to be an elegant analytical solution to a simplified problem (I even mentioned the assumptions I was making), and anyone who may want to build upon it to make it more realistic of an actual system is free to do so, but it would require a purely numerical approach, which is why I did not introduce it as such ... [*sigh* people are so critical and can't even appreciate elegant mathematics]
Fluid density, surface tension/s (water material air), fluid viscosity, material wettability are all missing here !
where is the physics of the experiment gone ?
3d shape of the meniscus i.e. surface tension effects  should be taken into account otherwise the physics of the model is poor and the model purely mechanistic.
Anyone interested in the derivation of my analytical solution can feel free to email me (I would normally think the simulated verification of the solution would be valid enough) and it would be gladly provided. It seemed to be a bit too lengthy to include here. Incidently, I did the work with pencil and paper so I do not have an electronic copy, but I would spend the time documenting it further if someone were to ask nicely ...
This was supposed to be for fun because I found the solution interesting. The whole point of the submission is to provide an analytical solution under the assumptions I mentioned in the file. If someone else wants to run an experiment to test my solution, I would be glad to see the results, but I do not see it as necessary for this submission ...
Once again, I submitted this file because I think the situation I described has an intriguing, nontrivial solution and I wanted to share it. I'm not sure why Mr. John D'Errico is so excessively critical. :/
Wow, what a crazy formula! Who would have guessed that it would be something so strange looking? Someday (if I'm really bored) I might try this. :)
Don't get me wrong, this is not at all a poor effort. My rating would lie somewhere in the 3 to 4 range. But what does this lack? What would I have wanted to see to rate this a 5?
 I was disappointed to see a derivation of the fundamental equation dismissed with handwaving, with only a vague reference to "an inductive approach".
 Experimental data supporting the hypothesized model. This is trivially easy to collect, so why not do so? Merely showing that the formula accurately reflects an iterative computer simulation is inadequate. However, if the model could be shown to reasonably predict real physical behavior, this would impress me. Exact predictions would not be necessary, but then explanation of why the model is flawed, including an estimate of the straw material volume per unit length, surface tension effects, etc., could indicate how the model might be improved. I'd ask if the straw had a perfectly circular, uniform crosssection along its length. Did any water remain attached to the straw as droplets between dips.
What did the author do well? I was impressed to see a good description of the problem, comments explicitly describing each line of code, and references to units.
Finally, I'd suggest that as a mathematical model of a physical system, this logically belongs in the Chemistry & Physics category as opposed to general mathematics.