Pages

Sunday, January 30, 2022

Pigment of the Imagination

I've previously mentioned Janelle Shane's blog, AI Weirdness, about applying artificial intelligence software to unusual tasks, often producing hilarious results. This week's post was about coming with new paint colors, and after I shared it on social media, my friend Garrett brought up an interesting aspect: Computers typically express color using a standard called sRGB, but this is only a subset of the colors our eyes can perceive. Thinking about this sent me down a rabbit hole of reading about color perception, generation, and physical properties.

As a physicist, I think of color as synonymous with wavelength, a property of light. Visible light is a small slice of the EM spectrum, ranging from longer-wavelength red to shorter-wavelength blue:

Cropped from Wikipedia

However, this does not capture the full range of colors people see! Humans perceive color via cells in our eyes called cones. They come in three varieties, which are sensitive to different parts of the visual spectrum. I long believed these were evenly spaced in red, green, and blue, but it's not as clear-cut as that. While reading about this stuff, I found a Python package called Colour, which includes a tool to plot the different cone's responses to wavelengths:

As you can see, there's pretty significant overlap between the nominal red and green cones, and the red also can pick up blue light. People with color blindness are typically missing one type of cone, and you can see that that wouldn't decrease the range of wavelengths, just the nuance. [Correction from Garrett: This is actually the "standard colorimetric observer," which is different from the actual cone sensitivity, which doesn't include the bump in red.]

In 1931, a group called the International Commission on Illumination (CIE, since they were French) came up with a description of the space of colors humans perceive, using the responses of the 3 cone types shown above. We can transform those 3 variables to eliminate the overall intensity, and just look at the color variation in what's called a chromaticity diagram:

Around the curved border you can see labels for the wavelengths of those pure colors, but the interior colors can only be produced by mixtures. The lower edge is called the line of purples, and represents colors that have no single-wavelength equivalent.

Of course, everything I've showing you is being displayed on your computer screen. An LCD screen displays colors by mixing amounts of red, green, and blue light:

Woods et al., Figure 3

Once again we see that these colors have a fair amount of overlap, but they are more separated in wavelength than our cones. To specify the amount of each color to use, computers use one byte (up to 256 values) for each of red, blue, and green. That range of values results in the dashed triangle in the chromaticity plot above. As Garrett pointed out, this is only one corner of that space. The trouble is, We're looking at that plot on a computer using RGB color, so we can't even see what we're missing! The funny thing is, when I originally shared Shane's post, I was thinking of my artist-cousin Autumn using some of the new AI-named colors, but working in the real world her palette is even more expansive.

Sunday, January 23, 2022

An Onager of His Own

A couple weeks ago was my nephew Ezra's birthday, and his parents gave him the dream of any future physicist (if I've done my job as an uncle): a catapult! Seeing him play with it got me thinking about the mechanics, and a question popped into my head: Catapults, and later cannons, typically have wheels to make them easier to move and aim, but how does that affect firing? The momentum of throwing something forward pushes the catapult back, and if the wheels are free to turn during firing, that backward motion can be significant.

Wikipedia

Momentum is conserved, so if the catapult and stone start at rest, the product of mass and velocity must be equal and opposite for the two after firing:


where M and v_C are the mass and velocity of the catapult, and m and v_S are those of the stone. Initially, I thought this suggested the wheels would help to give greater range, since a greater backwards velocity for the catapult gives a greater forward velocity to the stone. However, there's also the mass: The wheels allow the catapult to act as a separate entity, but removing (or locking) the wheels connects the system to the Earth. To compare these setups, we need to calculate how the energy stored in the spring (or gunpowder) gets distributed. The total energy is
If we combine this with the previous equation, we can eliminate v_C, and see how the stone's velocity changes with the catapult's mass:
The Wikipedia page for the onager, which is the archetypical catapult design pictured above, gives a stone mass of 26 kg, and a range of 130 meters, which lets us estimate an energy. We can plot this velocity as we vary the mass of the catapult:
This says the bigger the base, the faster we can throw the stone, so locking the wheels is the best option. However, that's assuming we're fixing the catapult to the Earth. In the case of a cannon on a ship, it may be more desirable to let the cannon roll backwards than set your ship rocking side-to-side.

Thanks for the inspiration, Ezra, and happy sieging!