Calvin’s Interesting Question

Calvin and Hobbes (October 19, 1989)

Given a set of positive integers $\{q_i\}_{i=1}^n$, describe the set $s_t \in S$ of positive integers such that there exists only one linear combination of $\sum_{i=1}^n a_i q_i = s_t$.

In the comic above, it’s pretty obvious with the amount of money given, that Calvin was hoping to get four “D”s. In fact, all integers from 1 to 9 can only be expressed in one permutation.

A satisfying answer to all sets of integers might be less trivial.

Cloud Cuckoo Land

The novel is a paean dedicated to books and libraries, painting five stories separated by time but connected via a singular, fictional book. Two tales follow children stuck on opposing sides during a siege of Constantinople in 15th century, two other resides in a fictional town in Idaho around the 20th century and beyond, while the final character lives in the near-future on an inter-planetary ship. Through dumb luck, the four who live in the past all end up preserving an antediluvian, fictional Greek codex called “Cloud Cuckoo Land.”

The eponymous Greek book itself plays as essential role throughout the novel, introducing themes and motifs which the reader can easily grasp onto. It’s really an AP Lit teacher’s dream come true with the deluge of overt themes like the power of knowledge and of those who controls the knowledge, the very human desire to reach too high, or simply the horrors of warfare.

But I think I connected with how time was treated in the novel. Depending on context, years, or even a whole lifetime, would pass in a single chapter. It reminds me of Gentleman in Moscow, where time accelerated through the chapters. Decades seemingly compressed into two sentences whilst the adventures as a child were so exquisitely detailed. Life seems diminutive as time marches on and destroys those that were not carefully preserved.

With that solemn conclusion, it still has a positive angle. No matter how meaningless an action now is, as long as humanity lives on, it might have a positive impact on someone down the line. We’ll be dust by then and our contributions will be lost to time, but posterity will nevertheless appreciate the bit of effort.

It’s a fairly well-written book overall. I thought there were several plot points missing and a bit too many deus ex machinas, but I did really enjoy it.

Arcane

I’ve followed the League of Legends esports scene for more than a decade now, and playing on-and-off for longer. The lore videos and cinematics which Riot releases were also engaging to me, and sometimes I wish they were longer. Yet, I’ve only watched Arcane a week ago…

Boy, was it good. And not at at the “adaption of videogame” level good, but stands its ground against the vast ocean of television compendium level good.

Everything from character development to music to art design and the story lines, I found it airtight against most trite criticism. It shows rather than tells, and assumes the viewer is an adult. The detail in each frame of animation can only be fully appreciated only on a second or third time around. The trials and tribulations which Vi and Powder/Jinx goes through can be felt.

I wished I watched it sooner.

Putnam 2022 A1

Determine all ordered pairs of real numbers $(a, b)$ such that the line $y = ax + b$ intersects the curve $y = \ln(1 + x^2)$ in exactly one point.

I really liked this problem, and thought it makes for a good “research” problem for calculus classes. For notation purposes, let $g(x) = \ln(1 + x^2)$. The following is also very sketch-like, and conversational. We first note that logarithmic curve is even, and we can simply consider $a \ge 0$, since $y = -ax + b$ will have the same number of intersection points. Simply looking at the graph, it’s clear that $(a, b) = (0, 0)$ is such a solution, and for fixed $a = 0$, that no other $y$-intercept will work.

Intuitively, for large enough slope, a line will also only intersect $g(x)$ at one point, no matter the intercept since it “outgrows” the log. We can formalize this by noting that $g'(x) = \frac{2x}{1 + x^2}$ with

  1. $\lim_{x\to \pm \infty} g'(x) = 0$,
  2. $g'(0) = 0, g'(1) = 1$
  3. $g'(x) \le 1$ by trivial inequality.

Assume not, then there exists two or more zeros for the function $g(x) – (ax + b)$. By the mean value theorem, then there would exist a point $c$ such that $g'(c) – a = 0$, which cannot happen since $|g'(c)| \le |a|$.

Now, we need to examine the region where $1 > a > 0$. For $b > 0$, if the $y$-intercept is large enough then the logarithmic growth will not catch up with the linear growth. To find this “large enough” intercept, we set simply find the line where it intersects $g(x)$; this will occur where the derivatives equal.

Solving $g'(x) = a$, we have $\frac{2x}{1 + x^2} = a \implies x^*_{\pm} = \frac{1 \pm \sqrt{1 – a^2}}{a}$. The intersection $b$ will be $ax^*_{+} + b = \ln(1 + (x^*_p)^2) \implies b = \ln(1 + (x^*_p)^2) – ax^*_p$, hence any $b > \ln(1 + ((x^*_p)^2) – ax^*_p$ suffices.

On the other hand, the root $x^*_{-}$ corresponds to the cases where $b < 0$ where the line “ducks” underneath first before intersecting the log curve, and hence any $b < \ln(1 + (x^*_m)^2) – ax^*_m$ will work.

Finally,the case of $a = 1$ is left as an exercise because this is too long.

The Mandolin-ian.

Laziness prompted me to buy a mandolin. It did expedite the slicing of my potatoes, but at a cost of some dermis from the knuckle of my middle finger. Hubris lost me that piece of skin.

Wow, this is so easy to slice by using my hand. Why use the protector. Only dumb peo….

Worse of all, since I wasn’t done with the dish, I had to painstakingly finish the recipe with only one hand. Arranging the sliced potatoes vertically in the casserole dish can be a real spud in the butt as one might say.

For the Black Friends-day dinner the next day, I made the same potato gratin dish again. This time using the protector the entire time. I stayed whole. The dish stayed delicious (because how can it not be? It had two cups of heavy cream and another half pound of premium cheese. It’ll be difficult to make it not delicious), and life was joyous.

I guess the lesson here is that I should’ve bought a mandolin awhile ago, back when I was young, limber and heal from scrapes in half an hour rather than the six hours it took for the wound to congeal. Pride will never change.

On an tangent, I really cannot find the connection of the word mandolin the instrument versus mandolin the slicer. There is a website which claims that the tool was named because the action resembled the strumming movement of mandolin the instrument but that sounds bonkers to me.

 

Interpolation in Tensorflow

I recently had to interpolate some data in the setting of training some machine learning code, coded in Tensorflow. It turns out that the interpolator doesn’t work with the compiled Tensorflow functions, which is usually recommended for faster execution. This is quite annoying, but has a simple solution using the

numpy_function

in Tensorflow.

import tensorflow as tf import numpy as np from scipy.interpolate import NearestNDInterpolator   x = np.linspace(0, 10, 10) y = np.linspace(0, 10, 10) z = np.sin(x + y) interp = NearestNDInterpolator(list(zip(x, y)), z)  points = tf.constant([[1, 2], [3, 4], [5, 6]], dtype=tf.float64)  @tf.function def test(x): return interp(x)  @tf.function def test_2(x): return tf.numpy_function(interp, inp=[x], Tout=tf.float64)  print(test_2(points))      # Works print(test(points))        # Doesn't work

Yet another qualm

This past Sunday was the only day when a broken clock could be potentially correct for more than two times a day.

But you know what’s annoying? Changing the clocks on ovens and cars by pressing the “H” button eleven times.

Turkey Trip

I went to Turkey for a total of ten days this past October, and it was a great trip. The amount of cultural heritage everywhere is unprecedented for me; it felt that every patch of land had some sort of historical significance. This was paired with awesome, unique natural features that I’ve never seen anywhere else.

The trip started in Istanbul where I only stayed for two nights. One could theoretically stay for far longer in this bustling metropolis, but I felt that I saw enough. It was also incredibly overwhelming in terms of people density, even for me who actually enjoys NYC.

The highlights in Istanbul is quite easily the Hagia Sophia, and the Basilica Cistern. The former is free as it’s a working mosque, but the line is wild at peak times. I went during the morning right before it opened, and the line winded down a side street. I did have a nice conversation with a short British woman and her six feet four husband. The Basilica Cistern does cost money, and the line is still an issue. I managed virtually zero wait by going near closing time. Nevertheless, these historical structures were breathtaking.

Hagia Sophia
Basilica Cistern
Hagia Sophia interior
Topkapi Palace

Other highlights include Topkapi palace with its many antiquities, and a cruise around the Bosphorus strait. Unfortunately for me, the Blue Mosque was still under renovations and I couldn’t appreciate the full splendor.

Besides the sights, Istanbul was very pedestrian-friendly and had a wealth of shopping. My excursion into the Grand Bazaar was unfruitful shopping-wise, but it’s still a sight to behold the many shops. I went with a cheap culinary experience, which was quite easy but I did overspend one meal… by around 2 dollars. I think the lesson is to avoid places with bi-modal reviews.

Grand Bazaar

I then went to Selcuk and the nearby Ephesus, eponym of the book of Ephesians. Here is really where the history became tangible (tbh, my Caliphates history is pretty rough): I probably walked the same steps that the apostle Paul and Mary strolled two thousand years ago. The actual Roman town was very well preserved, and it felt more Roman than Rome due to the lack of cars around. Finally, I went by a former Sevens Wonders: the Temple of Artemis. Unfortunately, the only thing that remains is a single column and the grounds are mostly peddlers.

There were a few other attractions around Selcuk such as the place where Mary allegedly died, a local redoubt, and the ruins of St. John Basilica. Selcuk itself was quite fun to walk around with cheap food and locals everywhere. I far enjoyed my time there compared to Istanbul.

Ephesus theater
Temple of Artemis
Library of Celsus

Afterwards, I took a day trip to Pamukkale, which was arguably one of the highlights of the trip. Due to the contents in the hot springs, an alien-like waterfall structure built up. The Romans realized this and built a town around it with a well-preserved theater. The star was definitely the warm waterfall though. This place deserves its UNESCO heritage site designation. But maybe the most curious thing is the number of “influencers” trying to take their Insta pics…

Hierapolis theater
Pamukkale falls
Pamukkale falls

Finally, I went to Ankara to visit an old office mate. We visited the local museum where I saw the skull of the King Midas, much to my surprise. We also ended up eating a good deal of food. Speaking of dining, I really do enjoy the freshness of the cuisine in Turkey. It seems that the cherry tomatoes in Turkey did have more flavor with an basil-esque aftertaste. There are also a lot more more lamb-based foods plus fresh Mediterranean seafood which I enjoyed. Unfortunately, the food was not as cheap as I thought it would be. Thanks Obama.

Lastly, the trip ended up in Cappadocia. The area felt like the hoodoos that I saw in New Mexico, but just at a far larger scale with more varied terrain and water. Furthermore, there were old Christian churches carved into the features. This area was truly unique in both the historical significance and natural wonders. In addition, there are also the possibility for balloon rides! I think I could’ve spend another day there with how many features that I didn’t get to see.

Cappadocia
Cappadocia
Cappadocia church
Cappadocia houses
Cappadocia houses

As for some closing thoughts, I felt a bit bad for not talking to that many Turkish people. I stayed in hotels (in fact, got upgraded from a hostel since it was low season) and mainly kept to myself due to possible scams. Nevertheless, the people I talked to were all nice and respectful to a clear foreigner.

Lastly, there are a lot of cats… petting them all would’ve took forever. 

Two Trips

Recently went on a fifteen mile round trip hike to Jordan Hot Springs in the Gila Wilderness. I’m still not used to the variation in the landscape of New Mexico. The trail mostly lies within a canyon with a river carving through it.

The most fun part of the trail is definitely the river crossings. Successfully fording a river really does make one feel like an adventurer. Oh, and the hot springs was nice to I guess. It’s nice that I didn’t die from the amoeba.

Then the other day, I finally went to a concert in New Mexico to a band that I know and love. The Head and The Heart was playing at the Ladder to the Moon festival. On a whim, I decided to drive the 2 hours to northern NM and see them during the lunar new moon.

It was an awesome show.

On a side note, having great ear plugs really make concerts so much better.

Definitions

bête noire

a person or thing strongly detested or avoided.

otiose

producing no useful result.