File Exchange

image thumbnail

Empty a Cup with a Straw

version (129 KB) by Joseph Kirk
Calculates the number of dips a straw must make to decrease the water level in a cup


Updated 04 Mar 2016

View License

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 cross-sectional 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)

Comments and Ratings (16)

Vassili Pastushenko

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.

Vassili Pastushenko

n = log(V0/Vn)/r

Vassili Pastushenko

What a nice theory! what do I missing?
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 n-th iteration,

According to assumption r<<1,


thus if you want to reach certain Vn, then


or (r<<1)

n = r*log(V0/Vn)

What's wrong? Where is any problem?

ed churchill

interesting, thoughtful, and creative

Joseph Kirk

The analytical solution derivation is now available.

Duane Hanselman

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.

Joseph Kirk

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.

Joseph Kirk

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! :)

John D'Errico

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

Roger Jeurissen

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_c-A_s)/A_c. After n dips, the volume is

V_n = V_0 ((A_c-A_s)/A_c)^n

and thus

h_n = h_0 ((A_c-A_s)/A_c)^n

Exponential decay as shown in the contribution (or did I make a mistake?)

Thank you for your contribution,

Joseph Kirk

This was not intended to be the end-all model of the cup-straw 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]

paulo britton

Fluid density, surface tension/s (water- material- air-), fluid viscosity, material wettability are all missing here !
where is the physics of the experiment gone ?

i. scardanzan

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.

Joseph Kirk

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, non-trivial solution and I wanted to share it. I'm not sure why Mr. John D'Errico is so excessively critical. :/

Debbie M

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. :)

John D'Errico

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 cross-section 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.


MathWorks update: Added Live Script.

Updated description, information

1. Updated Published m-file (HTML)
2. Enhanced m-file

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

Description update

Format fix in the published file

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux