utorok 1. novembra 2022

A vraj nudný kopec!

Z kruháča medzi Pod Lesom a Novou Lesnou – lokálpatrioti prepáčia nejasnosť vyjadrenia – je to na Slavkovský štít 10.4 km. Prvých tri a pol kilometra vedie k dolnej stanici pozemnej lanovky v Starom Smokovci. Toto je prvá tretina vzdialenosti na vrchol, ale len 12% prevýšenia. Vtipné je, že to lokálne dá zabrať i tak, napr. úsek od liečebne k Timrave je luxusný. Koniec-koncov Memoriál Jána Stilla tento úsek obchádza. Tak, či onak kilometre s prevýšením nad 50 metrov si nohy všimnú a je treba sa tomu prispôsobiť. Tu som sa šetril, vediac, čo ma ďalej čaká.

utorok 7. júna 2022

Na prechádzke Jurou

 

Búrka ustupuje a po týždni ignorovania bežeckých topánok ma to ťahá von. Na obzore sa týči Jura, prezentujúca vhodný cieľ. Plán: St-Geni – Crêt de la Neige, necelých 15 km jedným smerom s 1500 metrami prevýšenia. Pozerám na staré výkony, usudzujem, že tempo okolo 8:00 min/km je dostatočne pesimistický odhad. Ak nepôjdem úplne mimo, odhad splním a nebudem mať problém s vlakom.

pondelok 23. mája 2022

Adversity and Adaptation

 

Good stories have a plot and a moral, or a learning to take away. This one has both, which – of course – does not make it a good:)

sobota 5. februára 2022

The Clever Cashier – with love to my teachers

Back at uni, we have frequently heard of some mythical creatures. The eagle eye has often spotted what the next step would be. ("Bystré oko snadno nahlédne" was the expression in Czech.) There also was the clever quantum mechanic ("zručný kvantový mechanik") who used the postulates of quantum mechanics and the knowledge of special functions to make headway. While the appearance of the two entities was welcome at times, as it broke the flow of mathematical operations, they often left us wishing we could manage it so easily too.

One such entity made its appearance only once. First, we were reminded about the basics of Riemann integration[1] – cut the integration interval into sub-intervals, take the maximum of the function on each of them multiplied by the length of the corresponding sub-interval, add them together. Then send the number of sub-intervals to infinity and evaluate the limit.


Fig. 1: The main idea of Riemann integration. Picture by Lucas Vieira, Public domain, via Wikimedia Commons.

A simile followed: This is the same approach as the one used by a cashier. When making the daily total, they take value of take each coin[2] and add it to the total.[3] Common sense, right? A revelation followed, though. A smart cashier (šikovný pokladník) does it in a different way. First, he counts all the coins of a particular denomination and create a subtotal by multiplying the number of coins by the denomination. In the end, he adds the subtotals. Clever indeed, right? If you are in education or mathematics, you might guess what followed. The smart cashier's approach was used to approximate the area under the curve in Fig. 1. This was our introduction to the Lebesgue integration by our Calculus lecturer, Mirko Rokyta.  

Fig. 2: Picture by User:Svebert, CC0, via Wikimedia Commons. The main idea of Lebesgue integration is to look “horizontally” and count “how often” the function reaches a certain value. The resulting construction is mathematically very powerful.

I have not heard of the smart cashier since Fall of 2001.

A month or so ago, I came across a challenge in my work. I had a dataset with colours reported by users and I wanted to analyse if the colours  were happy, neutral or sad. We were interested in the aggregate value of happiness, as well as partial sums per sets.

set 1set 2set 3set 4
magenta/fuchsiaburgundyemeraldviolet
chocolateorangecopperbrick red
lemonceruleanbaby blueindigo
navy blue
electric bluebyzantium


baby blue


brick red

My original approach was straightforward: go through ever entry, assign it a value (1, 0 or -1) and process these at the end. Just for fun, try doing so. My main difficulty at this point was not the number of entries but the need to make a choice – often in a situation where I had no strong opinion. Is brick red (left) a happy colour or is it neutral? What about byzantium (right) – is the “dark enough” to be considered sad? Or is it regally happy? When faced with the task, I did what seemed the best: I asked a colleague to rate as well, and then we reconciled the differences. A few weeks later, an onerous task became a seemingly insurmountable one: 

set 1set 2set 3set 4
copperjungle greenharlequinivory
electric bluegreenlavendermaroon
harlequinmagenta/fuchsiamagenta rosemagenta rose
indigojungle greenemeraldgray
mauveindigoorangelemon
lemongreenorchidnavy blue
erinlemonpinklavender
maroonmagenta rosenavy bluepeach
jadeivorycyan/aquapuce
ivorymagenta/fuchsiaoliveindigo
navy bluegrayorangeivory
electric bluejungle greenmauveelectric blue
magenta rosegrayemeraldindigo
limeindigomagenta roseharlequin
ivorynavy bluemagenta rosecyan/aqua
oliveochrelemongreen
navy bluejadejade
orangecopperharlequin
lavendererinmagenta/fuchsia
ivory
green
lilac
maroon
magenta rose
jungle green
magenta/fuchsia
green
lilac
ivory
green
olive
magenta/fuchsia
green
mauve


mauve


jade


electric blue


mauve


Short of employing an algorithmic approach (or paying someone to do it), the only option seems to be going entry by entry. Entry by entry..., like Riemann. Riemann is like a cashier..., oh, what would the clever cashier do? I do not know yet, but let’s see. Wait, if you order the first column, you’ll have four instances of mauve, three of electric blue and three of ivory. So you can count the mauves in the first column, assign it a value (1?) and proceed. Soon afterwards I realise that ivory and mauve are also present in the other columns. Now the solution is clear: you only need to rate the unique entries! Lookups and sums will take care of the rest. In the end, the work needed was reduced by a factor of 3. (That’s a big deal.)

The Clever Cashier emerges victorious. More importantly, the episode shows how a simple beautiful[4] concept can be reused in a different setting decades after being learnt. Allow me to end with a big appreciation to Mirko Rokyta for teaching in this way.


[1] I ask the experts to be generous with the non-rigorous language.

[2] We will consider only coins: they are more visual, especially when stacked.

[3] The cashier uses a discrete approximation.

[4] This is the right combination of adjectives. Henri Lebesgue’s idea is much better than simple and its undeniable elegance gives it beauty.