Jan 17,, 37 tweets, 9 min read
Last week I got a lot of attention because of the claim that the “color of something infinitely hot” is (148,177,255) in sRGB space, which was reproduced by John C. Baez 🔽. Some have wondered as to the exact value, let me explain this and why. 🧵⤵️ •1/37
Now for some background: first, I did this computation back around 2005, when writing a page about colors and colorimetry — madore.org/~david/misc/co… — in my usual style of trying to understand something and writing all about it so I can forget it afterwards. •2/37
So if you want some more detailed explanations about colors and CIE matching functions and what “white” and so on mean, I refer to the page mentioned in the previous tweet. For more about the blackbody spectrum and the Rayleigh-Jeans law, see J. C. Baez's explanations. •3/37
Anyway, I did this computation probably sometime in 2005, and then I mentioned it on Twitter in 2018 🔽, and for some reason it got some attention again, so John asked me for more details. •4/37
He then wrote a Twitter thread (cited at the top of this one), and a blog post about it johncarlosbaez.wordpress.com/2022/01/16/the… (with essentially the same content as the Twitter thread). •5/37
This gained some attention after being mentioned on Hacker News news.ycombinator.com/item?id=299626… where some people tried to redo my calculation and got slightly different values, e.g., (154,181,255) or (145,181,255). Whence the discrepancy? And how did I compute my values? •6/37
There are several reasons why computations would differ, but one idea is that colorimetry is not like metrology: in metrology when you change a standard (e.g., the kilogram) you take extreme pains to ensure that it matches the previous standard with utmost accuracy, … •7/37
… while colorimetry — well, the point is to render something for the human eye and the human eye is not exactly a high precision spectrometer: we have just three (or four) kinds of cells, and not everyone's eye reacts in the same way, or even parts of the same eye. •8/37
So it makes little sense to try to reach high levels of precision when two different people might not agree as to whether two colors are identical. Or even the same person under different viewing conditions, or other factors of the sort. •9/37
Now, the basic idea to determining the color of a given light spectrum is this: you integrate the spectrum against “color matching functions” to obtain the (X,Y,Z) coordinates (up to an arbitrary scale if we're talking color without brightness being specified). •10/37
Ideally, X,Y,Z should be (proportional to) the response of the three kinds of cells on the human retina, but because they were determined back in the 1930's, they couldn't ascertain this, so they're pretty arbitrary. Moreover, they weren't measured very accurately. •11/37
The standard X,Y,Z color-matching functions were determined in 1931 by the Commission Internationale de l'Éclairage (CIE): en.wikipedia.org/wiki/CIE_1931_…‌. Amazingly, these 90-year old measurements are still the basis of much of colorimetry. •12/37
Still, better functions are now available. When I did my computation back in 2005, this was just started (by determining the cone response curves), thanks to work from University College London's Colour & Vision Research lab cvrl.ioo.ucl.ac.uk/index.htm •13/37
So one possible reason why people might get slightly different values for the color of the Rayleigh-Jeans spectrum is that the computations use different color-matching functions, e.g., more recent ones than the CIE XYZ functions of 1931 that I used. •14/37
(Another possible reason is how the numerical integration is performed: we are to compute ∫B(λ)·U(λ)·dλ, where B(λ) is the spectrum (here ∝1/λ⁴) and U(λ) is the X, Y or Z matching function. But the matching functions are given by a set of discrete values: … •15/37
… for each wavelength λ between, say, 360nm and 830nm, with 1nm increments, we are given a value U(λ); so the obvious idea to compute the integral is by simply summing the values B(λ)·U(λ)·1nm, i.e., apply the rectangle method. But you might do otherwise.) •16/37
Anyway, this is the first step of the computation of the color: in my case, I used the CIE 1931 values given here github.com/Gro-Tsen/color… and if we sum U(λ)/λ⁴ for U being X,Y,Z, and then normalize (meaning divide by X+Y+Z as brightness is arbitrary), … •17/37
… we find (x,y,z) = (0.239877, 0.234037, 0.526086). Again, this level of precision is illusory, the matching functions aren't nearly so accurate, and it may be better to use newer ones than the 1931 ones. (Or maybe not, as the standards are based on the 1931 ones.) •18/37
The next step of the computation is to convert (x,y,z) to linear-space (r,g,b): this is simple linear algebra: (r,g,b) indicate how much we turn on the three red, green and blue phosphors, and each one gives a spectrum which has a specified (x,y,z) value. •19/37
There is a slight subtlety, however: colors are usually defined “up to a scale” (we don't really care about absolute luminosity), so we're actually doing projective geometry: to specify the basis of the (r,g,b) space relative to the (x,y,z) space, we need four points: … •20/37
… so the (r,g,b) space is specified by giving the (x,y,z) values, each up to scale (normalized by x+y+z=1 by convention), of the red, green and blue phosphors ((1,0,0), (0,1,0) and (0,0,1) in the rgb space), but also of the “white point” (1,1,1). Here's for sRGB: 🔽 •21/37
(White point is actually what changes most from one monitor to another or from one setting to another: the phosphors don't change much, but white calibration is crucial. The sRGB standard specifies the “D65” white, which is close but not identical to a 6500K blackbody. … •22/37
… So if you want to view the color we're talking about as accurately as possible, if your monitor doesn't have an sRGB mode, you should at least set the “color temperature” to 6500K, which is a way of setting the white point.) •23/37
Anyway, using the values from sRGB given above, for (x,y,z) = (0.239877, 0.234037, 0.526086), we find (r,g,b) = (0.297733, 0.437847, 1), this time normalized by b=1 because we're trying to render a color up to brightness, so let's make it as bright as possible. •24/37
The final step is a historical accident and a gratuitous annoyance: you'd think that you specify 8-bit rgb values by taking the linear (r,g,b) I computed and just multiplying them by 255 and rounding… and you'd be wrong. There is an extra step called “γ correction”. •25/37
Because CRT monitors did not react linearly to their input, it was decided to store image values not as linear output values but as input values: the output follows some power law of the input, whose exponent is called γ (gamma), hence the name, gamma correction. •26/37
Nowadays this doesn't make much sense: it's just a convention: we store (say) 8-bit values (R,G,B), and how much the red phosphor lights is proportional to (R/255)^γ (ditto for G,B) for γ specified by the standard to emulate old CRT monitors. 🤷 •27/37
This means that the gray with half the luminosity of the brightest white (255,255,255) isn't (128,128,128) as you'd think, but (188,188,188). It makes everything so much more complicated, but, alas, this is how things are and we can't really change them now. •28/37
In sRGB, the γ value is about 2.2, but it's not even that, the input→output response curve is defined piecewise, it's a 2.4-th power with an offset except for very low values where it's linear. Tedious and complicated. •29/37
So, the details are given in the sRGB standard, w3.org/Graphics/Color… — which is whence I took the table in tweet 21 above. From (r,g,b) = (0.297733, 0.437847, 1), applying 255 × (1.055 × u^(1/2.4) − 0.055) to each coordinate, we get (148.36, 176.67, 255). •30/37
So this explains how I did my computation. The actual code is here: github.com/Gro-Tsen/color… — which I hereby release in the Public Domain if you think you can do something with it, but it's very much a mess as I didn't plan on publishing it, it was for my own use. •31/37
(I just needed it to write the page mentioned in tweet 2 above.) Still, if you run “make” on a modern Linux, it compiles and generates a few things; and then “rayleighjeanstosrgb” performs the computation of the color associated to the Rayleigh-Jeans spectrum. •32/37
Perhaps more interestingly, “blackbodytosrgb” followed by a number (between 500 and 80000) returns the color of the corresponding blackbody. And “huetosrgb” followed by a number (between 390 and 830) returns the closest color to the monochromatic of that wavelength. •33/37
But again, even though I think I was careful in how I did things, don't take any of this as very accurate: the CIE functions are a measurement done in the 1930's on a handful of (probably not too representative) volunteers, and there are variants of them, … •34/37
… the sRGB standard is a very basic standard, the version I used in 2005 may be outdated, your computer may not even be trying to take the color as being sRGB, and your screen probably doesn't respect sRGB anyway. •35/37
And anyway how you see a color depends on a million other things, from your age and angle of sight to how the room you're in is lit, so just take it as a very rough approximation of what color extremely hot objects have. •36/37
PS: if you've enjoyed this thread, you might also enjoy the one below 🔽, explaining why the primary colors should not really be “red, green, blue” but rather “incandescent red”, “psychedelic aquamarine” and “extreme purple”. •37/37

• • •

Missing some Tweet in this thread? You can try to force a refresh

This Thread may be Removed Anytime!

Twitter may remove this content at anytime! Save it as PDF for later use!

# More from @gro_tsen

Jan 16,
It seems some people want Jodorowsky's ‘Dune’ resurrected!
Oh, it turns out that scans of the book are already available online (ping @Conscrit_Neuneu):
Jan 16,
If ℳ is a nonstandard model of PA (Peano arithmetic), with ℕ identified with the standard subset of ℳ, we can define six sets of subsets of ℕ which might be called “non-standard computable in ℳ”, namely:
ⓐ those X⊆ℕ for which there is e∈ℳ such that ∀i∈ℕ. ℳ⊧(e•i)↓ and ∀i∈ℕ. (i∈X⇔ℳ⊧(e•i)=1),

ⓑ those X⊆ℕ for which there is e∈ℕ such that ∀i∈ℕ. ℳ⊧(e•i)↓ and ∀i∈ℕ. (i∈X⇔ℳ⊧(e•i)=1),
ⓒ those X⊆ℕ for which there is e∈ℳ such that ∀i∈ℳ. ℳ⊧(e•i)↓ and ∀i∈ℕ. (i∈X⇔ℳ⊧(e•i)=1),

ⓓ those X⊆ℕ for which there is e∈ℕ such that ∀i∈ℳ. ℳ⊧(e•i)↓ and ∀i∈ℕ. (i∈X⇔ℳ⊧(e•i)=1),
Jan 15,
Ces gens sont vraiment obstinés dans leur connerie. Tout le monde sait qu'imposer le port du masque en extérieur est inutile, ça peut même être nuisible, un juge administratif a suspendu la mesure idiote, mais ils veulent quand même persister. Mais POURQUOI???
Rappel sur pourquoi l'obligation du port du masque en extérieur peut être nuisible (voir surtout tweets 6–13):
Mais c'est surtout cette obstination dans la bêtise qui me laisse perplexe. La mesure n'est réclamée ni soutenue par personne, aucun scientifique, aucun groupe significatif, il n'y a pas de popularité à récolter à la prendre… je ne comprends vraiment pas.
Jan 15,
This leads me to ask: is there a specific name for a morphism φ:A→B of commutative rings (or maybe just an inclusion) such that 𝔪 ↦ φ^−1(𝔪) defines a bijection between maximal ideals of B and those of A (i.e., Specmax(B) → Specmax(A))?
(This is the case of the inclusion of the ring of smooth real functions inside the ring of continuous ones in the context of the tweet cited above.)
There are a number of sub-questions or variants, here:
‣ When does (pullback by) φ take a maximal ideal to a maximal ideal?
‣ When does it define a bijection on the prime ideals?
‣ Does the conjunction of the two above imply that it defines a bijection on the maximal ideals?
Dec 29, 2021
Let me write a thread about the steady state of the SIRS epidemiological model and what it can tell us about what endemic covid might look like (how often we will catch it and whether we have any control over this), or at least, what the parameters involved are. 🧵⤵️ •1/43
(I had written a thread 🔽 about this at the beginning of the pandemic, in a different context, concerning other endemic coronaviruses, but I think it's now time to revisit it, and rather than refer to it, I'll redo it from scratch.) •2/43
In the SIRS model, people go through three states cyclically: S = “susceptible”, i.e., NOT immune to infection; I = “infectious” (=infected); and R = “recovered”, which in this model should rather be taken to mean “currently immune”. Unlike in SIR, immunity DOES NOT last. •3/43
Dec 29, 2021
Le courage des juges, gardiens de l'état de droit: