Letter Seven

· February 14, 2021

Algebra of Udon Satisfaction, and a Bad Heuristic™.

Udon Deal

I write this with sore wrists, flour sullied clothes and an almost-disgust for udon noodles. Yesterday, I had a sudden craving for Udon noodles, a kind of Japanese Noodle made of whole wheat. The noodle has a bite to it, it’s springy, chewy and beautiful. I had to have it. This flash of motivation to make my own Udon came to me at about 9:30 PM on a Saturday night - kind of late for cooking, but I figured it would be good to capitalise on my motivation before I run out of it. I had the 3 basic ingredients that went into it - salt, flour and water 1, so I thought I could quickly knead me some dough and let it rest for the night, allowing the gluten form overnight. This in itself turned out to be a huge pain - I didn’t know dough (about 30 odd per cent hydration) can get this hard. My knuckles got red, and my wrists sore, but I kneaded till I had my shaggy dough. Mind you, this was dough worth at least 6 portions 2

I woke up today morning, to see how my dough had fared overnight. It had become a brick, which resulted in me starting my day by increasing the hydration in my Udon dough.

Kneading is very important to Udon preparation. Kneading allows the formation of gluten, the structure that lends the noodle its springy, chewy texture. The Japanese traditionally use their feet to do the kneading. My wrists thanked me for this discovery and proceeded to stomp away on my dough (much to my mother’s horror.)

Feet kneading

I bagged my dough and stomped away. I did this in small batches.

After the intense kneading session, I let the dough rest again for a bit and proceeded to start rolling out the noodle. Here is where I started hating myself.

Let me tell you something I discovered about cooking. Cooking is the most human thing you can. My grandfather always says that the meaning of life lies in cooking - humans would have been nowhere if not for the urge of having good food 3. I love cooking 4. I have been cooking all sorts of thing as a hobby for years. It has been a source of great joy and learning. But nothing is as much a pain as cooking in large quantities.

The satisfaction (or feeling of being rewarded) by cooking depends on two opposing functions - The Joy function, and The Effort function. This can be modelled to look something like this, assuming you are cooking for $n$ people

[\text{Joy}(n) \propto n] [\text{Effort}(n) \propto \frac{1}{k-n}]

To maximise satisfaction, you would have to maximise the joy per effort expended. This would look something like this:

[\text{Peak Satisfaction} = \text{maxima}({\frac{\text{Joy(n)}}{\text{Effort(n)}}})]


Assuming appropriate constants, I have modelled my satisfaction function5 as $\text{Satisfaction}(n) = n(5-n)$

Plotting it makes it clear, I am quite a bit past the peak satisfaction (which occurs at $n=2.5$, which translates to me as main course + starters for two.)

Here are a couple of illustrative examples of what output from peak satisfaction cooking looks like, as opposed to output from suboptimal satisfaction cooking (albeit net fun cooking)


Optimal Satisfaction Udon

Suboptimal Satisfaction Udon

Suboptimal Satisfaction Udon

I also have this habit of eating while cooking. I have eaten enough Udon (raw+cooked), to be sick of Udon for the rest of the day.

All said Udon 6, the joy still outweighed the effort to make a kilo of handmade Udon for my whole family (I made enough to have leftovers for dinner tonight). I am just glad I don’t live in a family that is $n\geq5$

A bad heuristic.

I love heuristics. I think of them as older people giving me advice - it may not be right all the time, but sometimes they have a point. Whenever I find myself in a place where the decisions get a little hard, or I don’t trust my choice much, I like to employ a bad heuristic.

A bad heuristic is, in this context, a formalisation of the various factors affecting a decision into a formula. I especially like bad heuristics because they are what the title say - bad. By bad, I mean that the heuristic is chock-full caveats and drawbacks. This means, I would never completely rely on the heuristic, quite like the advice given by the aforementioned older folk.

Off late, I have been in a bind to pick my next side coding project. To solve this conundrum, I have employed the following analysis resulting in a Bad Heuristic®

Broadly, coding projects can be divided into two categories

End User Projects

These are projects that can be used by the end user without caring for underlying implementation level details. Examples

  • Ethereum
  • IPFS
  • Calibre
  • Docker


  • Project is not dependent on the success of the language it was built using, only the idea.
  • Further reach, since its not constrained by the users of a particular language.


  • Harder to come up with ideas for standalone full fledged end user tools, as opposed to libraries.
  • High probability that something you have made would be done elsewhere, but better. This would mean, lesser people using your project.

Library Projects

These are projects that live and die with the popularity of the language framework, or the ecosystem they reside in. Example

  • Django
  • Scikitlearn
  • GORM


  • The idea can be recycled from another library. Example, you notice that Python has a nice library for audio manipulation, but Racket doesn’t. The idea is to recreate a library in another language.
  • Low probability of someone doing what you did if you pick the right $P(Library Niche, Language)$


  • The library can only be as popular as the language it’s implemented in.

The function to pick project.

Taking into account these factors, and my love for making niche projects, I have derived the following Bad Heuristic™:

[ ProjectScore(Lang, Niche, Cat) = \begin{cases} Niche^3, & \text{for Cat = End-User}
\newline Lang \times Niche^2, & \text{for Cat = Library}
\end{cases} ]


[NicheScore(Project) =max \left(0, \frac{\text{75k - (# of Stars for Most Popular Project on the same topic)}}{75k} \times 2 \right)] (Niche Score is proportional to how niche your project topic/subject is.)


[LangScore(Project) = max\left(\frac{\text{# of Stars for Most Popular Project in the Language}}{75k} \times 2, 2 \right)] (Lang Score is proportional to the popularity of the language.)

Here, I have some applied examples

Making a static site generator (Cat = End-User)

$Niche Score = \frac{(75k-50k)}{75k} \times 2= 0.\overline{6}$

$Project Score = 0.\overline{6}^3 = 0.\overline{296}$

Here, the most popular static site generator is Hugo, with 50k stars.

Making a homomorphic cryptography library in Racket (Cat = Library)

$NicheScore = \frac{(75k-2.6k)}{75k} \times 2= 1.930\overline{6}$

$LangScore = \frac{3k}{75k} \times 2= 0.08$

$ProjectScore = 1.930\overline{6}^2 \times 0.08 ≈ 0.298 $

Here, most popular homomorphic encryption library is HElib with 2.6k stars Here, most popular Racket repository is Racket with 3k stars

A finite state machine in Haskell. (Cat = Library)

$Niche Score = \frac{(75k-7.6k)}{75k} \times 2= 1.7973$

$LangScore = \frac{23k}{75k} \times 2 = 0.61$

$ProjectScore = 1.7973^2 \times 0.61 ≈ 1.97 $

A homomorphic cryptography library in Haskell (Cat = Library)

$NicheScore = \frac{(75k-2.6k)}{75k} \times 2= 1.930\overline{6}$

$LangScore = \frac{23k}{75k} \times 2 = 0.61$

$ProjectScore = 1.9306^2 \times 0.61 ≈ 2.2736 $

Creating a terminal RSVP speed reader (Cat=End-User)

Picking this as an example, because the $NicheScore$ is affected by me ( ☆ ͜ʖ ☆) $NicheScore = \frac{(75k-0.125k)}{75k} \times 2= 1.9967$

$Project Score = 1.9967^3 = 7.9604$

Cons of Heuristic

Biased towards making more niche things, so does not account for the ceiling created by the niche itself.

Pros of Bad Heuristic

Keeps you away from ordinary projects.

A visual representation of the heuristic.

Red axis is LangScore, green axis is NicheScore. Blue is the project score.


You can see my niche bias here.

Bad heuristics forever

Bad heuristics are great, they give you a direction, make you question that direction, and best of all, keep changing taking into account newer circumstances. This heuristic is only the first iteration. Being reliant on bad heuristics is itself a bad heurisitic that may one day change for me 7.


  1. I also added my secret ingredient, MSG. Spoiler, I don’t think I added enough to make a difference. It was a little too subtle. Next time, I would add way more. It definitely had a positive impact. 

  2. When I used to stay with my flatmates back in college, I used to cook only for myself. Sometimes for a couple of people. I never cooked huge quantities. After moving back home post-college, I realised I had to scale up a lot since I couldn’t just cook for myself anymore. In my house, it’s okay if there is more food, but there mustn’t be too less. 

  3. A bit extreme I know, but he definitely lives by those words. 

  4. Something my grandfather is very proud of and belives I inherited from him. Highly likely to be honest. 

  5. I have been reading about chaos theory. Of course I would use this equation to model satisfaction. 

  6. Pronounced all said and done. Similarly, the title reads “A done deal” 

  7. Sry for cringe ending. 

Twitter, Facebook