Pages

Sunday, January 19, 2025

Beet the Traffic

We watch the local news every morning, and this week a story caught my interest: Alternatives to using road salt to avoid harmful risks. The key point of the story is that runoff from salting the roads can damage the surrounding environment, but adding beet juice to the solution can make it stick to the roads better. Reading up on the idea, I've found it's still debated whether this idea is really better for the environment, but the bit I was curious about is the ability to stay on the road.

Looking into ways I could model this, I found a paper discussing how droplets spread over time based on their surface tension. Their model was a bit more involved than I wanted to get, so I made some simplifications: The droplet takes the form of an ellipsoid with constant volume and circular base. This constrains the relationship between the height and the radius. The paper defines a value they call h* where gravity and surface tension balance. After my simplifications, it takes the form

where ρ is the density of the fluid, g is the acceleration due to gravity, and γ is the surface tension. For a given fluid, we can look up the surface tension and density. I decided to try a salt-water solution (γ, ρ), a sugar-water solution (γ, ρ), and molasses (γ, ρ).

The paper gives a t^1/5 form for the height of the drop, so we can start each of these fluids as a hemisphere and see how they spread as they approach their respective h* values:

This shows the sugar and salt spreading at roughly the same rate, contrary to the idea given in the report, so I expect my model is not capturing all their qualities. What I find really interesting though is that the thicker molasses actually spreads faster, because it's more dense that the other two, so gravity exerts a stronger force. Naturally, this brought to mind a bit of history from my home state, when a flood of molasses from a ruptured tank cut a swath of destruction through Boston!

Sunday, January 5, 2025

Make Like a Tree and Get Out of Here

Swarthmore's Scott Arboretum traditionally gives incoming students a plant to care for in their dorms. Shockingly, the Hawaiian Schefflera I received in 2007 is still going 17 years later! Over the years as I've moved from place to place and kept the plant in different environments, I've been impressed by its ability to track the sunlight, frequently growing lopsided as it reaches toward the nearest window until I think to turn it. This has resulted in some twisting, gnarled branches:

If you've been reading this blog, you can probably guess where this is going – I was curious if I could make a simulation of my plant's heliotropic tendencies. I decided to model the plant as a collection of connected branch segments, each a fixed length and pointing at an angle relative to the vertical. At each step, we iterate over all the segments and pick an action:

  • If the segment has no children, i.e. it's at the tip of a branch, we add a new segment on the end with a probability p_grow/size, where size is the number of existing segments.
  • If the segment does have children, we add a new one with probability p_sprout/size.
  • If neither of those occur, we adjust the angle of the branch to point closer to the sun's current position. The adjustment is proportional to how far off the angle is, how many branches are on the end of this one, and a constant stiffness for the plant.

I tried a bunch of values for the different parameters until I landed on a range that gave plants looking reasonably similar to the real thing (click to enlarge):

The numbers along the top give the stiffnesses, and the ones on the left give the sprout probability. The sun moves back and forth sinusoidally, which you can see in the snaking of the plants. I wasn't able to get my digital plants to spread as much as the analog one, possibly because I'm not accounting for the plant casting shadow on itself, but I'm still pleased with the results – The top center one seems particularly good. If you'd like to try for yourself, the code is here.

Sunday, December 29, 2024

Tour de Living Room

A number of years ago, Marika and I got a Peloton bike, and I've often wondered whether the data from logged rides is available. This week I did some digging, and I found a couple people exploring the same question. It turns out Peloton offers the same type of REST API that I learned about when I was exploring the PUC data! Unfortunately, it's largely undocumented, but I was able to get what I was interested in by following those links above. The bike records several different statistics: the speed I'm pedaling measured in revolutions per minute (rpm), the resistance applied to the pedals measured as a percent, the output power resulting from those two factors measured in Watts, and my heart rate measured by my watch in beats per minute (bpm).

Because I'm a physicist, I was both delighted by the use of SI units for the power (Watts) and total energy (Joules), and disappointed that resistance is simply given as a percentage. I know that the output power depends on both the cadence and resistance, so we can plot those 3 together and see what the relation is:

It's a little hard to see, but if you look at points with similar resistance (color), they show a roughly linear relation between the cadence and output. As resistance increases, so does the slope. Unfortunately, the data Peloton gives is rounded to integers, so it's hard to get a precise measure of the relation.

The classes we take on the bike give target ranges for cadence and resistance over the course of a ride. The bike shows where you are relative to the min and max, and I've noticed that sometimes I can stay roughly in the center, and other times I'm ping-ponging from end to end. My impression was that it was higher resistances that made it more difficult to stay stable, so to back that up I split the rides into regions based on changes in the target resistance/cadence, and plotted the standard deviation of my cadence:

This doesn't show a relation as cut and dry as I expected, but we can see that the highest deviations all are during resistances higher than 30%, which is where I start to feel strained.

The final thing I wanted to look at was long term trends – Can I see improvement in my performance? I took some summary statistics for each ride, and plotted them with the number of days since we got it. First I looked at the distribution of output power over each ride:

The dots show the median power, and the lines show the 25th/75th percentiles. At the very beginning, I was a bit overambitious, and tried a class that was way above my abilities, then settled into a more consistent level. After a significant break (our time living in the RV, which barely has space for us and Eros, let alone a bike), I've been on a nice upward trend. The other improvement I wanted to look for was a trend in heart rates – Ideally, I should be able to achieve the same output power with a lower heart rate.

Since it takes time for my heart rate to respond to changes in effort, I decided a better measure was the max rate with the total work done over the course of each ride. You can see above, I do manage to hit higher work totals for the same heart rate, and for the lower work totals, my heart rate is lower – Progress!

If you have your own Peloton and want to see your stats (or maybe develop a Peloton analysis package?) you can find my code here.