Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/examples/kitten.ipynb
Views: 531
Kittens
Modeling and Simulation in Python
Copyright 2021 Allen Downey
License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
If you have used the Internet, you have probably seen videos of kittens unrolling toilet paper. And you might have wondered how long it would take a standard kitten to unroll 47 m of paper, the length of a standard roll.
The interactions of the kitten and the paper rolls are complex. To keep things simple, let's assume that the kitten pulls down on the free end of the roll with constant force. And let's neglect the friction between the roll and the axle.
This diagram shows the paper roll with the force applied by the kitten, , the lever arm of the force around the axis of rotation, , and the resulting torque, .
Assuming that the force applied by the kitten is 0.002 N, how long would it take to unroll a standard roll of toilet paper?
We'll use the same parameters as in Chapter 24:
Rmin
and Rmax
are the minimum and maximum radius of the roll, respectively. Mcore
is the weight of the core (the cardboard tube at the center) and Mroll
is the total weight of the paper. L
is the unrolled length of the paper. tension
is the force the kitten applies by pulling on the loose end of the roll (I chose this value because it yields reasonable results).
In Chapter 24 we defined to be the constant that relates a change in the radius of the roll to a change in the rotation of the roll:
And we derived the equation for in terms of , , and .
So we can compute k
like this:
Moment of Inertia
To compute angular acceleration, we'll need the moment of inertia for the roll.
At http://modsimpy.com/moment you can find moments of inertia for simple geometric shapes. I'll model the core as a "thin cylindrical shell", and the paper roll as a "thick-walled cylindrical tube with open ends".
The moment of inertia for a thin shell is just , where is the mass and is the radius of the shell.
For a thick-walled tube the moment of inertia is
where is the density of the material, is the height of the tube (if we think of the roll oriented vertically), is the outer diameter, and is the inner diameter.
Since the outer diameter changes as the kitten unrolls the paper, we have to compute the moment of inertia, at each point in time, as a function of the current radius, r
, like this:
Icore
is the moment of inertia of the core; Iroll
is the moment of inertia of the paper.
rho_h
is the density of the paper in terms of mass per unit of area. To compute rho_h
, we compute the area of the complete roll like this:
And divide the mass of the roll by that area.
As an example, here's the moment of inertia for the complete roll.
As r
decreases, so does I
. Here's the moment of inertia when the roll is empty.
The way changes over time might be more of a problem than I have made it seem. In the same way that only applies when is constant, only applies when is constant. When varies, we usually have to use a more general version of Newton's law. However, I believe that in this example, mass and moment of inertia vary together in a way that makes the simple approach work out.
A friend of mine who is a physicist is not convinced; nevertheless, let's proceed on the assumption that I am right.
Simulation
The state variables we'll use are
theta
, the total rotation of the roll in radians,omega
, angular velocity in rad / s,r
, the radius of the roll, andy
, the length of the unrolled paper.
Here's a State
object with the initial conditions.
And here's a System
object with the starting conditions and t_end
.
You can take it from here.
Exercise:
Write a slope function we can use to simulate this system. Test it with the initial conditions. The results should be approximately
Exercise: Write an event function that stops the simulation when y
equals L
, that is, when the entire roll is unrolled. Test your function with the initial conditions.
Now run the simulation.
And check the results.
The final value of theta
should be about 200 rotations, the same as in Chapter 24.
The final value of omega
should be about 63 rad/s, which is about 10 revolutions per second. That's pretty fast, but it might be plausible.
The final value of y
should be L
, which is 47 m.
The final value of r
should be Rmin
, which is 0.02 m.
And the total unrolling time should be about 76 seconds, which seems plausible.
The following cells plot the results.
theta
increases slowly at first, then accelerates.
Angular velocity, omega
, increases almost linearly at first, as constant force yields almost constant torque. Then, as the radius decreases, the lever arm decreases, yielding lower torque, but moment of inertia decreases even more, yielding higher angular acceleration.
y
increases slowly and then accelerates.
r
decreases slowly, then accelerates.