Sunday, September 8, 2019

Work/Life Balance

Work/life balance is a continual struggle, but over the past couple of years I think I've gotten better at it. Partly this is because I've adjusted my ways of working. For example, instead of attending to my phone all weekend, getting stressed out by its pinging sounds, I'll often go on airplane mode until Monday morning. Weekend work and checking email still happen, but they usually happen at my desk, at times when I choose; and I observe a no-work-on-Saturdays rule pretty faithfully. This has forced me to be more efficient on the other six days of the week. Another step I've taken is to limit my weekend travel to seven days per year. (I did the math on this once and calculated that seven weekend days amounted to around 20% of my annual quality time with family; this was as much as I thought I ought to be willing to give away.) Having a finite budget for these days makes me choosier about saying yes to events that take me away from home on Saturdays or Sundays.

Selfie in a hotel 
When I do travel for work, I have a tradition of recording a nightly voice memo for the kids, in which I read aloud one of Aesop's fables; my wife can play it for the kids at bedtime. I believe this probably bores them, but that's why I chose fables (most of which take less than a minute to read). Some of the fables are funny, and sometimes a moral from the fables will prove useful in a practical situation.

The "Moon Tree" in Sacramento, CA
(from a seed that orbited on Apollo 14)
I try to enjoy the places I travel to for work. Maybe the city I'm in has a famous barbecue place or a famous tree; maybe instead of taking Uber to my meeting, I can walk through a historic district. A trip of multiple days often has an evening free, and small cities often have nice museums: in recent years I've been able to dip into the De Young, the Briscoe, the Frist, and the Arizona-Sonora Desert Museum.

From this exhibition
However, the most important factor in improving my work/life balance over the past couple of years hasn't been working smarter; it's been living better independently of work. I'm a member at some museums in the city, and a museum membership is a good value compared to many other forms of entertainment. When a museum sends notices of future exhibitions and one of them looks good, my wife and I choose a specific weekend when we'll see it, and then we put the item on our calendars. We try to have something booked every other month or so.

(My go-to recipe is here.)
I've resumed old pastimes—reading, cooking, and exercising. The temptation to work on a project on a Sunday afternoon is now in healthy competition with the temptation to finish a great book I'm partway through. A good chunk of my Saturday is typically spent shopping for ingredients, cooking, and washing up. As for exercise, while it can feel like an obligation, and I'm no longer the athlete I once was, fundamentally I still enjoy breaking a sweat. (Sometimes I even get good ideas on the elliptical machine.) Exercise also makes me hungrier, so I better enjoy what I eat.

Everything ebbs and flows, and sometimes work trumps all of this. Sometimes I'm just too lazy to maximize the denominator in the work/life fraction. And nothing is ever finally figured out. At best I may continue to learn how to live, year upon year.

Thursday, September 5, 2019

Approximating Pi By Dividing N-Digit Numbers

While on vacation I added a new sequence to the Online Encyclopedia of Integer Sequences. The sequence is about approximations to π:

     π ≈ 3/1

     π ≈ 44/14

     π ≈ 355/113

     π ≈ 3,195/1,017

     π ≈ 99,733/31,746

     π ≈ 833,719/265,381

     π ≈ 5,419,351/1,725,033

     π ≈ 80,143,857/25,510,582

     π ≈ 657,408,909/209,259,755


The nth term of the sequence is the best approximation for π that can be given by a quotient of two n-digit numbers. In a case like 3195/1017 = 3550/1130 where two or more quotients of n-digit numbers each give the best approximation of π, we take the fraction with the smallest numerator and denominator. [Fixed 10/4/19—a tip of the hat to reader Andy for noticing that my original statement of the rule was ambiguous!]

Here are the corresponding decimals. In each case, the last digit shown is the first digit that deviates from the decimal expansion of π.

     3/1 = 3.0…

     44/14 = 3.142… (note this equals the more familiar 22/7)

     355/113 = 3.1415929…

     3195/1017 = 3.1415929… (note 3195/1017 equals 355/113)

     99733/31746 = 3.14159264…

     833719/265381 = 3.141592653581…

     5419351/1725033 = 3.1415926535898…

     80143857/25510582 = 3.141592653589792…

     657408909/209259755 = 3.14159265358979322…

When I thought of this sequence, I searched for it in OEIS and was surprised not to find it. Admittedly this sequence seems unimportant, but it also seems like a natural idea. Anyway, not finding the sequence in OEIS, I googled a few terms and discovered that a Russian computer programmer named Oleg Zelenyak had earlier thought of the sequence as an example in a book on computer algorithms. Zelenyak gives eight terms, so to add value I calculated the 9th term, 657408909/209259755. Finding the 9th term took twelve-plus hours on my laptop, using a pure brute force approach.

You can see some of these details by going to sequences A327360 and/or A327361. The first sequence gives the numerators of the fractions, while the second sequence gives the denominators. (OEIS is an encyclopedia of integer sequences, so it represents fraction sequences by pairs of integer sequences.)

Some other fraction approximations for π can be found at Wikipedia's article on "Milü." Wikipedia's more general article on approximations to π contains some amazing results.