The Lumber Room

"Consign them to dust and damp by way of preserving them"

Are there Fibonacci numbers starting with 2012? (continued)

leave a comment »

Almost 8 months ago I left the first part of this post unfinished planning to complete it in the morning; seems I slept too long. (Or as this guy said after a 2-year hiatus: “Sorry for the pause guys. I was in the bathroom.”)

Recall: To get a power of 2 that starts with a prefix p (like p = 2012), we want n such that the fractional part of n\log 2 lies between those of \log p and \log(p+1) (all logarithms here to base 10), and similarly to get a Fibonacci number starting with p, we want (with some hand-waving) n such that the fractional part of n\log\phi lies between those of \log(p) + \log{\sqrt{5}} and \log(p+1) + \log{\sqrt{5}}. The more general problem is:

Problem: Given an irrational number \theta and an interval (a,b) \subset (0,1), find n such that \mathrm{frac}(n\theta) lies in the interval (a,b).

Here is one method, based on Edward Burger’s book Exploring the Number Jungle. Let \alpha be the midpoint of the interval (a,b). Then we are trying to find n such that \mathrm{frac}(n\theta) is close to \alpha.

  • Find a fraction \displaystyle \frac{p}{q} approximating \theta, such that \displaystyle |q\theta - p| < \frac1q. (These are the convergents of the continued fraction of \theta, but in practice it seems you can also get away with taking semi-convergents that may not satisfy this property.)
  • Let N be the closest integer to q\alpha. Note that this automatically means \displaystyle |q\alpha - N| \le \frac12
  • Write \displaystyle N = yp - xq with \displaystyle |y| \le \frac{q}{2}. This you can do quite easily with the Euclidean algorithm.
  • Then for n = q + y and k = p + x, we have (it is a simple exercise to prove this)
    \displaystyle |\theta n - k - \alpha| < \frac{3}{n}
  • This means that the distance between n\theta and \alpha is small, modulo 1. If this distance turns out to be still too large, start with a bigger convergent \frac{p}{q}.

I think I had some code to post as well (hey, what’s the actual Fibonacci number that starts with 2012?), but it needs to be cleaned up… probably this works (in Sage).

The thing we’re doing here is called inhomogeneous Diophantine approximation.

[Originally posted on math.stackexchange, here and here.]

Written by S

Fri, 2012-08-03 at 01:56:18

Posted in mathematics

ABBA’s The Day Before You Came

with one comment

[A bit too much on a stupid pop song. Move along. :-)]

The Day Before You Came is the last song that ABBA recorded. It is interesting for more than being their swansong: it is also highly atypical of ABBA.

Here is the song (Link is to Dailymotion because Youtube has videos only of live perfomances):

The music and the video are non-ABBAish too (gone are the exuberance and the outlandish clothes, the video is almost entirely Agnetha with the others getting only a few seconds of screen time and no action), but confining ourselves to the lyrics:

Must have left my house at eight, because I always do
My train, I’m certain, left the station just when it was due
I must have read the morning paper going into town
And having gotten through the editorial, no doubt I must have frowned
I must have made my desk around a quarter after nine
With letters to be read, and heaps of papers waiting to be signed
I must have gone to lunch at half past twelve or so
The usual place, the usual bunch
And still on top of this I’m pretty sure it must have rained
The day before you came

I must have lit my seventh cigarette at half past two
And at the time I never even noticed I was blue
I must have kept on dragging through the business of the day
Without really knowing anything, I hid a part of me away
At five I must have left, there’s no exception to the rule
A matter of routine, I’ve done it ever since I finished school
The train back home again
Undoubtedly I must have read the evening paper then
Oh yes, I’m sure my life was well within its usual frame
The day before you came

Must have opened my front door at eight o’clock or so
And stopped along the way to buy some Chinese food to go
I’m sure I had my dinner watching something on TV
There’s not, I think, a single episode of Dallas that I didn’t see
I must have gone to bed around a quarter after ten
I need a lot of sleep, and so I like to be in bed by then
I must have read a while
The latest one by Marilyn French or something in that style
It’s funny, but I had no sense of living without aim
The day before you came

And turning out the light
I must have yawned and cuddled up for yet another night
And rattling on the roof I must have heard the sound of rain
The day before you came

It is putatively a love song, but it makes no explicit declaration of love. The entire lyrics of the song are merely a catalogue of an average day’s events. The song is a timetable. You’ve got to admire the sheer cheek of this, if nothing else. :-) (a la Peter Cushing lives in Whitstable.)

Yet it is interesting. I think this could be argued to be a first-class example of svabhāvokti, the achievement of a poetic effect by simply and ably describing things as they are. The author of the song describes her usual boring routine, presumably to contrast against her much-changed life after meeting the “you” of the song. This is an inversion of the much more common poetic convention, that of recalling time spent in love, time spent together, etc. (Bilhana’s चौरपंचाशिका Chaura-panchashika comes to mind.)

It is linguistically interesting as well: with few exceptions, the verbs are all accompanied by “must have”, “I’m certain”, “undoubtedly”, “I’m sure”, or “I think”. [I’m not sure what this characteristic of the verb is called. In the old days I think we’d just call it verb tense, but now “tense” is reserved for verb forms that indicate time, and “tense/aspect/mood” is used instead. I don’t know what this particular “must have”-type of construction is called: a Google search throws up terms like near-certainty mode, deductive, non-factual, evidential, presumptive, etc.] It’s as if the author isn’t sure. (It is remarkable that, in general, adding “I’m certain” or “undoubtedly” makes a statement less certain.) One interpretation is that the narrator after meeting her lover no longer remembers her life from before; so different it has become. But considering the level of detail, is this really possible? Besides, how much can a daily routine really change? The trains will still run at the same time, at any rate. A different possibility suggests itself: that the narrator is simply unreliable.

Suddenly a lot of things make sense: she is not describing her life “before you came”. She hasn’t met anyone at all, but is instead hoping to meet someone that will turn her colourless life exciting. The song is not reminiscences about a dull past (who would want to do that?), but she is instead imagining how different she will feel in the future after finding someone, yet so sad is her case that all she can imagine and describe is her present. The video lends credence to this idea: it starts with a scene of her daily commute, a guy appears and the video goes into a (presumably) imagined mode, before the guy disappears and she’s back at the same train station.

This would finally explain why the prevailing mood of the song, as experienced by the listener, is not one of love (it does not evoke śṛṅgāra शृङ्गार in other words): instead it is one of melancholy and weariness.

See also: Guardian article.

Written by S

Fri, 2012-08-03 at 01:10:56

Posted in entertainment

Kannada dictionary online

with 13 comments

The absence of a Kannada dictionary online has been a source of pain for a while (unlike Sanskrit dictionaries). Mohan pointed me to the one at kannadakasturi.com with the warning that it is very slow. He also found that the Internet Archive has a scanned copy of the Kittel dictionary (A Kannada-English school-dictionary : chiefly based on the labours of the Rev. Dr. F. Kittel, by the Rev. J. Bucher (1899)). This is actually a fairly good dictionary and could serve most common purposes. Until someone digitizes it and puts it online (this version at least is out of copyright), we will have to make do with looking up words in this scanned copy. To make it easier to find the right page, below is an “index” to the dictionary. Look down the second column in the table below to find the approximate position of the word you want, then click on the corresponding link in the left column. The gap between successive entries is at most 10 pages, so you should be able to find any word with a click and at most 3 page flips.

http://archive.org/stream/kannadaenglishsc00buchrich#page/n13/mode/2up a
http://archive.org/stream/kannadaenglishsc00buchrich#page/10/mode/2up        aDasatte
http://archive.org/stream/kannadaenglishsc00buchrich#page/20/mode/2up        annu
http://archive.org/stream/kannadaenglishsc00buchrich#page/30/mode/2up        artha
http://archive.org/stream/kannadaenglishsc00buchrich#page/38/mode/2up A
http://archive.org/stream/kannadaenglishsc00buchrich#page/48/mode/2up i
http://archive.org/stream/kannadaenglishsc00buchrich#page/56/mode/2up I
http://archive.org/stream/kannadaenglishsc00buchrich#page/58/mode/2up u
http://archive.org/stream/kannadaenglishsc00buchrich#page/68/mode/2up        ura
http://archive.org/stream/kannadaenglishsc00buchrich#page/70/mode/2up U, R
http://archive.org/stream/kannadaenglishsc00buchrich#page/72/mode/2up RR, lR, lRR, e
http://archive.org/stream/kannadaenglishsc00buchrich#page/76/mode/2up E
http://archive.org/stream/kannadaenglishsc00buchrich#page/78/mode/2up ai
http://archive.org/stream/kannadaenglishsc00buchrich#page/80/mode/2up o
http://archive.org/stream/kannadaenglishsc00buchrich#page/84/mode/2up O
http://archive.org/stream/kannadaenglishsc00buchrich#page/86/mode/2up au
http://archive.org/stream/kannadaenglishsc00buchrich#page/88/mode/2up M H
http://archive.org/stream/kannadaenglishsc00buchrich#page/88/mode/2up k
http://archive.org/stream/kannadaenglishsc00buchrich#page/98/mode/2up        kampu
http://archive.org/stream/kannadaenglishsc00buchrich#page/108/mode/2up        kAruNya
http://archive.org/stream/kannadaenglishsc00buchrich#page/118/mode/2up        kusaku
http://archive.org/stream/kannadaenglishsc00buchrich#page/128/mode/2up        kollAra
http://archive.org/stream/kannadaenglishsc00buchrich#page/132/mode/2up kh
http://archive.org/stream/kannadaenglishsc00buchrich#page/134/mode/2up g
http://archive.org/stream/kannadaenglishsc00buchrich#page/144/mode/2up        gillA
http://archive.org/stream/kannadaenglishsc00buchrich#page/154/mode/2up gh, G, c
http://archive.org/stream/kannadaenglishsc00buchrich#page/164/mode/2up        citra
http://archive.org/stream/kannadaenglishsc00buchrich#page/168/mode/2up ch, j
http://archive.org/stream/kannadaenglishsc00buchrich#page/178/mode/2up        jIva
http://archive.org/stream/kannadaenglishsc00buchrich#page/180/mode/2up jh, J, T
http://archive.org/stream/kannadaenglishsc00buchrich#page/182/mode/2up Th, D
http://archive.org/stream/kannadaenglishsc00buchrich#page/184/mode/2up Dh, N
http://archive.org/stream/kannadaenglishsc00buchrich#page/186/mode/2up t
http://archive.org/stream/kannadaenglishsc00buchrich#page/196/mode/2up        tAmbUla
http://archive.org/stream/kannadaenglishsc00buchrich#page/206/mode/2up        tETu
http://archive.org/stream/kannadaenglishsc00buchrich#page/210/mode/2up th, d
http://archive.org/stream/kannadaenglishsc00buchrich#page/220/mode/2up        dumuku
http://archive.org/stream/kannadaenglishsc00buchrich#page/226/mode/2up dh
http://archive.org/stream/kannadaenglishsc00buchrich#page/230/mode/2up n
http://archive.org/stream/kannadaenglishsc00buchrich#page/240/mode/2up        nikAya
http://archive.org/stream/kannadaenglishsc00buchrich#page/250/mode/2up        neTTage
http://archive.org/stream/kannadaenglishsc00buchrich#page/252/mode/2up p
http://archive.org/stream/kannadaenglishsc00buchrich#page/262/mode/2up        parihAsa
http://archive.org/stream/kannadaenglishsc00buchrich#page/272/mode/2up        punarnava
http://archive.org/stream/kannadaenglishsc00buchrich#page/282/mode/2up        prabOdha
http://archive.org/stream/kannadaenglishsc00buchrich#page/286/mode/2up ph
http://archive.org/stream/kannadaenglishsc00buchrich#page/288/mode/2up b
http://archive.org/stream/kannadaenglishsc00buchrich#page/298/mode/2up        bANali
http://archive.org/stream/kannadaenglishsc00buchrich#page/308/mode/2up        bese
http://archive.org/stream/kannadaenglishsc00buchrich#page/312/mode/2up bh
http://archive.org/stream/kannadaenglishsc00buchrich#page/318/mode/2up m
http://archive.org/stream/kannadaenglishsc00buchrich#page/328/mode/2up        marasuttu
http://archive.org/stream/kannadaenglishsc00buchrich#page/338/mode/2up        mIru
http://archive.org/stream/kannadaenglishsc00buchrich#page/348/mode/2up        mEle
http://archive.org/stream/kannadaenglishsc00buchrich#page/352/mode/2up y
http://archive.org/stream/kannadaenglishsc00buchrich#page/354/mode/2up r
http://archive.org/stream/kannadaenglishsc00buchrich#page/362/mode/2up [?]
http://archive.org/stream/kannadaenglishsc00buchrich#page/364/mode/2up l
http://archive.org/stream/kannadaenglishsc00buchrich#page/370/mode/2up v
http://archive.org/stream/kannadaenglishsc00buchrich#page/380/mode/2up        vidyamAna
http://archive.org/stream/kannadaenglishsc00buchrich#page/390/mode/2up z
http://archive.org/stream/kannadaenglishsc00buchrich#page/398/mode/2up S
http://archive.org/stream/kannadaenglishsc00buchrich#page/400/mode/2up s
http://archive.org/stream/kannadaenglishsc00buchrich#page/410/mode/2up        sambALisu
http://archive.org/stream/kannadaenglishsc00buchrich#page/420/mode/2up        siddhAnta
http://archive.org/stream/kannadaenglishsc00buchrich#page/430/mode/2up        sthAyi
http://archive.org/stream/kannadaenglishsc00buchrich#page/432/mode/2up h
http://archive.org/stream/kannadaenglishsc00buchrich#page/442/mode/2up        hiDi
http://archive.org/stream/kannadaenglishsc00buchrich#page/452/mode/2up        hore
http://archive.org/stream/kannadaenglishsc00buchrich#page/454/mode/2up L, [?]
Note: Pages 262–3 are missing, so from there on, printed page = 2 + number in link

Future work:

  • Extend this data to all pages in the dictionary (around 454/2 = 227)
  • Write a web interface where you can type a word/prefix and be taken to the exact page

Feel free to take it up.

Written by S

Mon, 2012-04-30 at 00:26:10

Kashmir

with 5 comments

Anandavardhana.
Abhinavagupta.
Bhatta Nayaka, Jayanta Bhatta, Sriharsha, Kshemendra, Somadeva, Mammata, Kuntaka, Rudrata, Ruyyaka, Bilhana, Kshemaraja, Kalhana, Jonaraja, Kallata, Kayyata, Mahima Bhatta, Vasugupta, Amaru(?), Damodaragupta, Vamana, Udbhata, Utpala, …
[Many more names to fill here.]

Some have even sought to assign Kalidasa to Kashmir, on no grounds stronger than that he was good at what he did!

Not for nothing is शारदा देवी called काश्मीर-पुरवासिनी.

Written by S

Wed, 2012-03-21 at 22:27:45

Posted in Uncategorized

Are there Fibonacci numbers starting with 2012?

with one comment

Do there exist powers of 2 whose first four digits are 2012?
Are there Fibonacci numbers whose first four digits are 2012?

If the answer is obvious to you (or you don’t care), you can stop reading.

The answer for both is:

  • Yes.
  • There are infinitely many such numbers.
  • In fact, the fraction of (powers of 2 / Fibonacci numbers) starting with 2012 is exactly

    \displaystyle \frac{\log 2013 - \log 2012}{\log 10} \approx \frac1{4644} \approx 0.000216

Similarly with any other prefix p (of any length) in place of 2012. Proof follows.


A number x starts with a prefix p if and only if for some k ≥ 0,

\displaystyle p \cdot 10^k \le x < (p+1) \cdot 10^k

Thus a power of 2, say 2n, starts with p iff

\displaystyle p \cdot 10^k \le 2^n < (p+1) \cdot 10^k for some k \ge 0

Taking logarithms to base 10 and simplifying, this is equivalent to

\displaystyle \log p < n\log2 - k < \log(p+1) for some k \ge 0

This is saying that the fractional part of n\log 2 lies between the fractional parts of \log p and \log (p+1). For example, if p = 2012, this means that the fractional part of n\log 2 lies between \log 2.012 \approx 0.303628 and \log 2.013 \approx 0.303844.


Similarly, for Fibonacci numbers, as is (or should be) well-known, the nth Fibonacci number Fn is the closest integer to \displaystyle \frac{\phi^n}{\sqrt5}, where \displaystyle \phi = \frac{1+\sqrt5}2 is the golden ratio. So F_n starts with p iff

\displaystyle p \cdot 10^k - \frac12 \quad < \quad \frac{\phi^n}{\sqrt5} \quad < \quad (p+1) \cdot 10^k - \frac12

Taking logarithms to base 10 and simplifying, while ignoring the annoying \frac12 which becomes irrelevant in the limit (this line is not rigorous), this is equivalent to

\displaystyle \log(p) + \log\sqrt5 \quad < \quad n\log\phi - k \quad < \quad \log(p+1) + \log\sqrt5

which means that the fractional part of n\log \phi lies between the fractional parts of \log p +  \log\sqrt5 and \log (p+1) + \log\sqrt5. For p = 2012, this means that the fractional part of n\log \phi lies between \log 2.012 + \log\sqrt5 \approx 0.653113 and \log 2.013 + \log\sqrt5 \approx 0.653329.

In either case, we are trying to make the fractional part of n\theta, for some irrational number \theta, lie in some interval. The relevant fact is this:
Theorem 1: for any irrational number \theta, the sequence \mathrm{frac}(n\theta) (where \mathrm{frac}(x) denotes the fractional part of x) is dense in [0, 1).
or, in other words,
Theorem 1: For any irrational number \theta, the sequence n\theta is dense modulo 1.
Proving this theorem is a good exercise.

This means that for any interval you want, you can always find some n such that the fractional part of n\theta lies in your interval. In fact, because the sequence is dense, you can find an infinite sequence of n such that the fractional parts of n\theta converge to the midpoint (say) of the desired interval. This proves the first two facts of the answer, and for the third we need a stronger theorem:

Theorem 2 [Equidistribution theorem]: For any irrational number \theta, the numbers n\theta are uniformly distributed modulo 1.

This means that for any interval I \subset [0,1] of size s (say), the fraction of integers n for which \mathrm{frac}(n\theta) lies in the interval satisfies

\displaystyle \lim_{N \to \infty} \frac{ \left|\left\{ 1 \le n \le N : \mathrm{frac}(n\theta) \in I\right\}\right|}{N} = s

This proves the third fact. The fraction of Fibonacci numbers (or of powers of a number that is not a power of 10) that start with a prefix p \ge 1 is exactly \log(p+1) - \log(p) where log is to base 10.


That much is standard. And non-constructive. We are assured of the existence of such numbers, but how do we actually find one?

The answer (or one answer), as it so often does in these problems, involves continued fractions. Here is one method, [to be continued when I wake up :p]
Edit: Continued here.

Written by S

Sun, 2012-01-08 at 01:29:26

Posted in mathematics

Avadhana

with 6 comments

How many things can you do simultaneously in your head?

Yesterday A couple of weeks ago Nearly three months ago, I attended an avadhana, by Shatavadhani Dr. R. Ganesh. Already (the very next day) my friend Mohan has written about it in great detail, but since I had started scribbling something down then, I thought I should write a post anyway: it is easily the most incredible feat of the human mind I have ever witnessed. (Unfortunately this may not be saying much, for I have not seen, say, George Koltanowski play 34 games of blindfold chess simultaneously. So suffice it to say that repeatedly we in the audience had trouble believing that what we were seeing was really happening!)

The word avadhāna, in common usage, means “concentration” or “attention”. In the specialised sense here, an “avadhana” is a performance of sorts, an exhibition of mental concentration, multi-tasking, literary skill, erudition and wit.

The basic format is this: there is a performer (avadhani) seated on stage, and also with him are several “questioners” (pṛcchakas). The performer has no access to pen or paper or any resources other than his head. The questioners give him various tasks in parallel, and he must answer them all, dividing his attention between them.

And these are no simple tasks! Some are harder than others, but all require great skill and concentration, especially to do them without any secondary memory (like, say, a piece of paper). Some are scheduled to happen in order, some are interrupt-driven, and all require concentration. This was an “Ashtavadhana”, so there were eight questioners/tasks (five of them had to do with composing poetry, and the rest were of a different nature):

1. Nishedhakshara (“letters forbidden”): the questioner gives him a topic on which to compose a verse in Sanskrit, and a metre to compose it in. Already a difficult task for mortals — metres in Sanskrit are to be strictly adhered to in every syllable; there is no amount of permitted variation as in English — but it’s nothing compared to the devilish twist here: the performer must compose the verse interactively, one letter at a time, and after each letter that he announces, the questioner imposes a constraint on what the next letter must not be. Thus for instance, each time the performer appears to be using a word, the questioner can prevent him from completing that word. He must find a way around this constraint, and so on till the entire line is completed.
This is done in four rounds: he composes one line at a stretch (along with the back-and-forth with the Nishedhakshari) in one round, and when the next round arrives, after some 40–50 minutes during which he has been facing other questions, he must pick up where he left off, relying on his memory with no external assistance. (E.g. he isn’t read back what he had composed as the first line.)

2. Samasya-purti: A traditional challenge, in which a line is given, and the performer has to compose a verse with it as its last line. Often the “problem” line will be nonsensical, or wholly inappropriate or even obscene, and the poet has to compose his “solution” poem such that the line makes sense in context. Usually, this involves clever tricks to engineer a radical reinterpratation of the line. Ganesh gave an example from one of his earlier programmes: a line like “Hari-worshipping atheists are numerous” was worked into a poem about music, describing a raga and ending with “Bila/hari-worshipping atheists are numerous”. (Bilahari is a popular raga in Carnatic music.)
In this instance, this round was in Kannada. Also done in four rounds, one line at a time.

3. Datta-pada (“given words”): Poem. Given topic, given metre. The catch: he is given four words that must occur in the poem, but the words are from another language. For instance, here the questioner wanted words like “ape” and “monkey” to appear in each line, and the performer’s task is to compose a poem in Kannada, with the English words occurring as segments of Kannada words. One line per round.

4. Chitrakavya (constrained writing): At the fringe of Sanskrit literature is an incredible body of constrained writing, of everything from palindromes to verses which satisfy difficult constraints on their letters, or which can be re-arranged into certain “shapes”, and so on. Here the performer is asked to compose a poem on a given topic, satisfying the constraint. One line per round.

5. Magic square: At the start of the performance someone from the audience (or the questioner) calls out a number, and the task is to construct a 5×5 magic square — a square of distinct numbers, such that every row, every column, and both diagonals sum to that number. This task is interrupt-driven: at any time during the performance — such as when he is composing a line of some poem — the performer is interrupted by the questioner who asks him for the entry in a particular row and column; the performer must give him a number and return to this task. (So 25 interruptions in all, throughout the performance.) Of all the tasks, this is the only one I feel even remotely confident of doing with a little practice, but it seemed to be the one that impressed the audience the most! Nevertheless, it is not trivial, and is definitely a distraction that can draw one’s full attention for at least a few moments. (Other avadhanas sometimes involve someone who, say, rings a bell at random moments, and the avadhani has to maintain a count of how many times the bell has rung, even as he concentrates on other tasks. A magic square is probably more impressive.)

6. Aprastuta-prasanga: Various meddling distractions and banter. This is interrupt-driven too. This questioner interrupts frequently, asking questions and making comments, and in general needling the performer and pulling his leg. This may include random humorous remarks, or the latest news, politics, celebrity gossip, whatever. The performer comes up with witty replies (well, Dr. Ganesh does, at any rate), deflects the question (or answers it if it’s a serious one), and moves on. I’ve heard it said that while most avadhanis treat this part as something to be endured, Ganesh actually grants this role a big part in the proceedings and even delights in it. This may be a sign of his wit and confidence, or (considering that there will be people in the audience who are impaired in their ability to follow the poetry, and who enjoy this part the most) a generous concession towards the modern-day audience. Either way, this role is a hard task for the questioner as well, and one fraught with danger: apparently, during a previous avadhana of Ganesh that was being conducted at the Bharatiya Vidya Bhavan with (I think) Dr. S R Leela in this role, at one point during the event Mattur Krishnamurthy who was in the audience stood up and yelled at her: “he’s trying to compose a serious poem; why do you distract with such trifles?” — but of course, that is precisely the job. And it appears Ganesh can handle any distraction. :-)
If one imagines the setting of erudite scholarship in an ancient language as a stuffy one, then this sits rather incongruously in that context. So this may serve as “comic relief” from the serious stuff. But actually, I think what this round suggests is that for the avadhani, unlike for us, even arcane metrical composition is at the same level of difficulty as small talk!

7. Ashu-kavitva: Compose a poem quickly. While the other four poem-composing tasks involved composing a single poem, one line in each round, here he is given a topic and must compose a complete poem on it immediately. Ganesh even offered to do it in any metre specified, but as the questioner in this case didn’t specify metres, he picked different metres appropriate to the topic himself. This is one poem per round.

8. Kavya-vachana: Identifying poems. The questioner reads out a poem, which could be from a rather obscure work in the literature, and the performer must identify where it is from. That already requires a deep knowledge of all the literature and a great memory besides, but apparently Ganesh finds that too easy. So what happened here was that the questioner would sing the poem, and instantly, as soon as the singing ended, Ganesh would reply, identifying both the poem and the raga in which it was sung, in verse and in the same metre as the original poem, and singing it in the same raga that was used!

Those are the tasks. So at any given point of time, the perfomer must remember and keep in his head, at minimum, the current state of composition of four poems-in-progress, and the constraints that were imposed on them in the first place, and also the state of the magic square, all the while responding to distractions, and this over a period of several hours — nearly an hour elapsing between working on one line of the poem, and returning to it again.

It is hard to describe how incredible this was to witness in person. For one thing, all the questioners are demanding and trying to trip up the performer, so there’s an elaborate cat-and-mouse game going on. On top of that, when even the audience, who don’t have to do anything but watch, have trouble remembering what has happened in the previous round — even those who have been taking notes — for the performer to resume everything from memory does make one’s jaw drop.

At the end of the performance, the questioners (2), (3), (4) and (7), who had asked for certain poems composed, read out their own creations, that they had composed before the performance at their own leisure. More than once, Ganesh’s compositions created in such a harsh setting were still more beautiful than the ones that had been composed with as much time as desired!

In an age where we’re beginning to feel in the face of technology that perhaps that we’re not so good at multitasking after all, a traditional performance like this feels a bit like the old world turning up in style and showing us how it’s done. Whatever happened to The Magical Number 7±2?

Other notes

* This was in a mixture of Sanskrit and Kannada, but he has given performances that have been entirely in Sanskrit (even the banter), those in which there are eight questioners in Kannada and eight in Sanskrit, etc.

* OK, all this is great, but this must be a once-in-a-lifetime performance, right? The culmination of a life of practice, that happens but once?
Nope. This was Ganesh’s 917th—NINE HUNDRED AND SEVENTEENTH—avadhana. He did another one two weeks later.

* EIGHT people! Four hours! Must be exhausting, and about the limits of what the human mind can do? Nope. He is called “Shatavadhani” because he has at least once performed a Shatavadhana, involving a hundred questioners in parallel rather than eight. Not only that, but he has said he is prepared to do a Sahasravadhana, with a thousand questioners, but it would take over a month to perform, and it is hard to find the people to ask the questions! (And an audience, I imagine.)

* How did he think of doing an avadhana in the first place? What I’ve heard is that he attended one, and felt “I can do this too”. Just like that.

* Of the eight “questioners” (pṛcchakas), only two were professionally related to Sanskrit (they were teachers/professors). The rest were from various fields — software engineers, hardware engineers, teachers of other subjects, and so on — who only pursue their love of Sanskrit in their spare time. (One of them has apparently read through the entire Apte’s dictionary several times, which is an activity I find hard to even imagine.) The audience, too, had a fair number of young people, which Ganesh commented positively upon. (“Gratifying to see a lot of black-haired heads, not just bald or grey-haired ones.”)

* [Other stuff which I had thought of then, but forgot to note down. Will expand if I remember.]

Further reading

* A detailed account of the entire proceedings is in Mohan’s post, as mentioned above. Besides the parallelism and concentration that I have described above, which is the immediately stunning fact to a newcomer, there was a striking beauty in the way he actually handled each of the problems. This is more apparent from Mohan’s post; I have intentionally emphasized the former to (sort of) complement that one. Do go and read it!

* Edit: See this post (“A Modern Day Ashtavadhanam”) by Venetia Ansell. As she notes, “Highbrow Sanskrit arts are far from dead.”
* Another post

* Dr. Ganesh has written a large monograph on avadhana in Kannada, for which he was awarded the first D. Litt. by Kannada University (Hampi).

* If you have trouble believing any of this, there are a few recordings of earlier avadhanas available, and you can try attending the next one.

* Update: The video of this avadhana is now online. The video cannot reproduce the atmosphere, but it’s something:

A few more Avadhanas have been uploaded online, on the Padyapaana YouTube channel.

Written by S

Mon, 2011-12-19 at 01:44:48

Posted in sanskrit

Tagged with , , , ,

My Git personal reference

with 9 comments

Various git things I’ve had to look up from time to time.

(Always, while doing anything dangerous, have a gitk window open. Look, don’t guess. (Haven’t used gitk in a while.) And if you’re sharing your repository publicly, you can forget about most of the below.)

Git reset

What git reset <commit> does:
* Reset HEAD to the given commit
* (If not --soft) copy this new HEAD to the index
* (If --hard) copy contents of index to working dir

So, for example:
* To “undo commit”: git reset HEAD~1
This resets HEAD to HEAD~1, without copying this new HEAD to the index. So it’s as if you didn’t make the commit. You can go and commit in another branch if you want.

Copy commits from another repository

# 1. Add the other repo as a remote
git remote add other_repo_nickname <other repo's path/url>
# 2. Fetch its data. (pull = fetch + merge, so we want only fetch, not pull)
git fetch other_repo_nickname
# 3. The rest should be familiar
git cherry-pick <commit>

Note that you don’t need to specify the remote’s name for cherry-picking. Once you have fetched, all commits, even those originally from the other repo, can be identified just by hash. (If you want to refer to commit by branch, then you can identify it with “other_repo_nickname/branch_name”.)

Swap commits (reorder top two commits)

 git rebase -i HEAD~2 

and in your editor, reorder the two “pick” lines. (See here.)

Recovering commits deleted with reset --hard

In general, these are garbage-collected after 30 days (or when you run git prune or git gc), so you shouldn’t use reset --hard at least without doing a stash first.
If the garbage-collection hasn’t happened yet, get the sha1 hash of the commit with

 git reflog 

then make sure the commit is what you want with

 git show sha1 

and get the commit back with

 git cherry-pick sha1 

(or rebase or merge instead of cherry-pick, if that’s what you want.)

Squashing commits together, to keep your history clean

Use rebase. To squash the last n commits into one, do

 git rebase -i HEAD~n 

and change all “pick”s except the first one to “squash” (or “s”). See here and here.

Delete a specific commit

Use rebase -i, again.

 git rebase -i <commit>~1 

Delete the line for the commit you want deleted. See here and here.

Amend a specific older commit

This is tricky, and I don’t think I’ve seen it anywhere, especially for the case where there are branches that depend on it.
My solution: Find the first branch X that’s downstream from (= later than) it. Keep track of the whole tree downstream from X (take a screenshot if you must); you’ll need it. Checkout X, and do “rebase -i HEAD~[large enough number to cover the commit you want to amend]”. In the editor that pops up, keep all “pick” lines, changing only that one line you want to amend to “edit”. Save and close. Now git has stopped, allowing you to amend that commit. Edit the file. Do “commit –amend” (don’t forget to add all files you want included in that commit!). Do “rebase –continue”. You’re back at X now. Now for the first branch Y that was downstream from X, checkout Y, do “git rebase X”, and recurse on Y.
This doesn’t seem work (gets into rebase conflicts). Need to try again, and ask.

Written by S

Tue, 2011-11-29 at 10:06:52

Posted in compknow

Tagged with

ऋष्यशृंग

leave a comment »

The story of the ascetic Ṛṣyaśṛṅga (ऋष्य-शृंग, “deer-horned”) occurs in the Puranic literature. His father brought him up in an atmosphere of innocence, and he had never seen a woman. (Later, in the Rāmāyaṇa, he officiates at Daśaratha’s sacrifice for children, and it is thus through his grace that Rāma is born.) Pollock:

The Ṛśyaśṛṅga episode appears also [i.e, besides the Ramayana] at MBh 3.110-13, PadmP, Bengali recension, Pātālakhaṇḍa, 13 (reprinted in Lüders 1897), Bhāratamañjarī 3.758-95, Bhadrakalpāvadāna 33, Avadānakalpalatā 65, Alambusā and Naḷanikā Jātakas, etc. The episode is clearly of great importance to traditional India…

Here is the story from the Vana Parva in the Mahabharata (taken from GRETIL), accompanied by a pleasant translation in simple rhyming verse, by Arthur W. Ryder. (Scroll horizontally to read the English text and/or compare. Or to read just the English text, click here.)
Read the rest of this entry »

Written by S

Sun, 2011-10-09 at 12:03:39

Posted in literature, sanskrit

Tagged with

Wellerisms &c.

with 2 comments

[Originally posted to paronomasia/pun-ctilious.]

Charles Dickens at 24 was writing his first novel The Pickwick Papers, which was being published serially like all novels of the era. Sales were chugging along decently for the first three months, until the character Sam Weller was introduced. The career of Dickens would never be the same. The novel became a publishing phenomenon and from that moment on he was a star, and new instalments of Dickens’s novels were often more eagerly awaited than any Harry Potter book has been.

Among the characteristics that made Sam Weller so popular with the masses were his linguistic charms, one of them a form of quotation known as a Wellerism. This survives in American popular culture as the rather lame and narrow-in-scope “…that’s what she said” (or the British “…as the actress said to the bishop”), but turning to samples from Dickens himself:

“out vith it, as the father said to his child, when he swallowed a farden.”

“How are you, ma’am?” said Mr. Weller. “Wery glad to see you, indeed, and hope our acquaintance may be a long ‘un, as the gen’l’m’n said to the fi’ pun’ note.”

“All good feelin’, sir—the wery best intentions, as the gen’l’m’n said ven he run away from his wife ‘cos she seemed unhappy with him,” replied Mr. Weller.

“There; now we look compact and comfortable, as the father said ven he cut his little boy’s head off, to cure him o’ squintin’.”

“Yes, but that ain’t all,” said Sam, […] “vich I call addin’ insult to injury, as the parrot said ven they not only took him from his native land, but made him talk the English langwidge arterwards.”

“Sorry to do anythin’ as may cause an interruption to such wery pleasant proceedin’s, as the king said wen he dissolved the parliament,” interposed Mr. Weller, who had been peeping through the glass door;…

More examples not from Dickens, from Wikipedia and elsewhere:

“We’ll have to rehearse that,” as the undertaker said when the coffin fell out of the car.

“Simply remarkable,” said the teacher when asked her opinion about the new dry-erase board.

“Don’t move, I’ve got you covered”, as the wallpaper said to the wall.

‘It all comes back to me now’, said the Captain as he spat into the wind.

‘Eureka!’ said Archimedes to the skunk.

“Each moment makes thee dearer,” as the parsimonious tradesman said to his extravagant wife.

“Capital punishment,” as the boy said when the teacher seated him with the girls.

“I’ve been to see an old flame,” remarked the young man returning from Vesuvius.

“I hope I made myself clear,” as the water said when it passed through the filter.

“I’m at my wit’s end,” said the king as he trod on the jester’s toe.

“These are grave charges,” murmured the hopeless one, as he perused the bill for the burial of his mother-in-law.

“Notice the foot-note at the bottom of the page,” laughed the court fool, as the royal attendant’s shoes emitted a squeak.

“That’s my mission in life,” said the monk, as he pointed to his monastery.

“Oh, how blue I am,” mourned the poet, as his fountain pen spattered upon him.

“That’s an old gag,” said the cashier, as the bandit stopped up his mouth.

“My business is looking good,” said the model.

See also this post by Krish Ashok, which has a stream of examples culminating in

“Looks like we still have gaps”, he pointed out, like Aamer Sohail to Venkatesh Prasad.

A subgenre is the “Tom Swifty”, with a pun on the adverb:

“The doctor had to remove my left ventricle,” said Tom half-heartedly.

“The situation is grave,” Tom said cryptically.

“I’ve joined the navy,” Tom said fleetingly.

“I have a split personality,” said Tom, being frank.

“This is the real male goose,” said Tom producing the propaganda.

“I won’t finish in fifth place,” Tom held forth.

[See the paronomasia archives for more Tom Swifties from its members, like

“Let’s put them in to bat now and bowl them out,” Tom declared.

and of course everywhere on the internet.]

Written by S

Sun, 2011-08-14 at 06:16:21

Posted in funny, language, quotes

The invitation

with 5 comments

Translated from the शार्ङ्गधर-पद्धति by Octavio Paz:

The invitation

Traveler, hurry your steps, be on your way:
the woods are full of wild animals,
snakes, elephants, tigers, and boars,
the sun’s going down and you’re so young to be going alone.
I can’t let you stay,
for I’m a young girl and no one’s home.


Translated from the गाहा-सत्तसई (= गाथा-सप्तशती) by Andrew Schelling:

Mother-in-law
sleeps over there
so does the
rest of the household but
  traveler
    this is my bed
    don’t trip over
    it in the dark

Written by S

Tue, 2011-06-21 at 18:51:21

(1+ix/n)^n

leave a comment »

[Posting some images here for possible future reuse.]

\displaystyle \lim_{n\to\infty}\left(1 + \frac{ix}{n}\right)^n = \cos x + i \sin x

A non-rigorous argument: when n is large enough so that x/n is small, (1 + ix/n) is roughly (hand-waving) the point on the unit circle at arc length (and hence angle) x/n:

So multiplication by (1+ix/n) roughly corresponds to rotation by angle x/n. Multiplication by (1+ix/n)^n, which is multiplication by (1+ix/n) n times, roughly corresponds to rotation by angle n(x/n) = x. As n \to \infty, “roughly” becomes exact.

Animation for x = 1:

Image generated from Python-generated SVG files; code available if anyone wants.

In particular, once one accepts the fact/definition that \lim_{n\to\infty}\left(1 + \frac{x}{n}\right)^n = e^x (for instance, show that the function f(x) = \lim_{n\to\infty}\left(1 + \frac{x}{n}\right)^n satisfies f(x+y) = f(x)f(y)), it is true that e^{i\pi} is a rotation by π, that is,

\displaystyle e^{i\pi} = -1

Written by S

Tue, 2011-06-21 at 18:04:25

Posted in mathematics

Getting back non-monospaced font in WordPress’s HTML editor

leave a comment »

So apparently some farsighted folks over at WordPress decided recently (see screenshots) that everyone who uses the HTML editor is using it to write code, rather than simply because the unpredictable “Visual” editor sucks so much. If you use WordPress, don’t like this change and would like to go back to using more normal fonts, (you can go complain at the appropriate places, or) open either Firebug console, or in Google Chrome go to View → Developer → Developer Tools and choose the console, and type

document.getElementById('content').style.cssText += "font-family: sans-serif;"

or whatever it is that you want. Making this a Greasemonkey/Stylish/whatever extension is left for others; I just want something quick to fix this annoyance.

Monospaced is fine for code, but typical monospaced fonts lack so many non-ASCII characters that all the glyph substitution makes it really ugly here.

These are (not) a few of my favourite fonts: Medley by WordPress

Edit: Looking around two days later, you can see complaints (I guess… I haven’t read them) here, here, here, etc., and the userscript here.

Written by S

Sun, 2011-06-05 at 04:35:52

Posted in compknow

Serieshelpmate in 19

with 2 comments

Here’s a brilliant problem.

Consider the following chess position.

Black is to make 19 consecutive moves, after which White checkmates Black in one move. Black may not move into check, and may not check White (except possibly on his last move). Black and White are cooperating to achieve the aim of checkmate. (In chess problem parlance, this problem is called a serieshelpmate in 19.) How many different solutions are there?

This problem is due to Kauko Väisänen, and appears in A. Puusa, Queue Problems, Finnish Chess Problem Society, Helsinki, 1992 (Problem 2).

Hint: the above is quoted from Richard Stanley’s Enumerative Combinatorics.

Written by S

Sun, 2011-05-29 at 15:30:25

Posted in mathematics

AE

with one comment

XXVII

“Is my team ploughing,
That I was used to drive
And hear the harness jingle
When I was man alive?”

Ay, the horses trample,
The harness jingles now;
No change though you lie under
The land you used to plough.

“Is football playing
Along the river shore,
With lads to chase the leather,
Now I stand up no more?”

Ay, the ball is flying,
The lads play heart and soul;
The goal stands up, the keeper
Stands up to keep the goal.

“Is my girl happy,
That I thought hard to leave,
And has she tired of weeping
As she lies down at eve?”

Ay, she lies down lightly,
She lies not down to weep:
Your girl is well contented.
Be still, my lad, and sleep.

“Is my friend hearty,
Now I am thin and pine,
And has he found to sleep in
A better bed than mine?”

Yes, lad, I lie easy,
I lie as lads would choose;
I cheer a dead man’s sweetheart,
Never ask me whose.


Read the rest of this entry »

Written by S

Fri, 2011-05-27 at 16:16:04

Posted in literature, quotes

Sanskrit pronouns and closeness

with 2 comments

Reminded from here.

Unlike English “this” and “that”, Sanskrit has two of each. That is, there are four “degrees” of pronouns, varying by proximity:

1. very close, “this”: etad, एतद् :

m. एषः   एतौ   एते (एतेन, एतस्य, एतस्मिन्)
f. एषा   एते   एताः (एतया, एतस्याः, एतस्याम्)
n. एतत्   एते   एतानि (एतेन, एतस्य, एतस्मिन्)

2. close, “this”: idam, इदम्

m. अयम्   इमौ   इमे (इमम्, अनेन, अस्य, अस्मिन्)
f. इयम्   इमे   इमाः (इमाम्, अनया, अस्याः, अस्याम्)
n. इदम्   इमे   इमानि (इदम्, अनेन, अस्य, अस्मिन्)

3. away, “that”: adas, अदस् (rare?)

m. असौ   अमू   अमी (अमुम्, अमुना, अमुष्य, अमुष्मिन्)
f. असौ   अमू   अमूः (अमूम्, अमुया, अमुष्याः, अमुष्याम्)
n. अदः   अमू   अमूनि (अदः, अमुना, अमुष्य, अमुष्मिन्)

4. in absentia, “that”: tad, तद्

m. सः   तौ   ते (तम्, तेन, तस्य, तस्मिन्)
f. सा   ते   ताः (ताम्, तया, तस्याः, तस्याम्)
n. तत्   ते   तानि (तत्, तेन, तस्य, तस्मिन्)

Then there’s also एनम् etc., which according to MW “Grammarians assert that the substitution of एनम् &c for इमम् or एतम् &c takes place when something is referred to which has already been mentioned in a previous part of the sentence”.

Written by S

Tue, 2011-05-24 at 04:45:50

Posted in sanskrit

leave a comment »


रम्याणि वीक्ष्य मधुरांश्च निशम्य शब्दान् 
  पर्युत्सुको भवति यत्सुखितोऽपि जन्तुः ।
तच्चेतसा स्मरति नूनमबोधपूर्वं 
  भावस्थिराणि जननान्तरसौहृदानि ॥

Written by S

Mon, 2011-05-23 at 23:11:44

Posted in personal

Making audio louder with Audacity

with one comment

(Tried with Audacity 1.3.12 beta.)

  1. Open the file in Audacity. Go to Effects → Amplify.
  2. The amplification set is already the maximum possible without clipping. Don’t change anything, just click OK

This makes the file as loud as possible without clipping: without the loudest parts of the “signal” getting lost. If the result is not loud enough, the problem is not with the loudest parts (they are already as loud as they can be), but with the softer parts. So you need a transformation that makes the soft parts louder while keeping the loud parts the same. This is Dynamic range compression: the dynamic range (difference between softest and loudest parts) is compressed.

So, after trying “Amplify”,

  1. Download “Chris’s dynamic compressor” from here (direct link).
  2. Save the file compress.ny in /Applications/Audacity/plug-ins
  3. In Audacity, go to “Effects → Compress dynamics…” (or perhaps it’s called “Compress &dynamics…”)
  4. The first control (“Compress ratio”) is the main one. Or just leave it as it is. Click OK.
  5. If still not loud enough, go back and increase Compress ratio. Of course, increasing it means decreasing the dynamic range — increase it too much and the parts meant to be soft will be no softer than the rest.

Written by S

Sat, 2011-05-21 at 04:57:44

Posted in compknow

Converting old PS files (generated with LaTeX) to searchable PDFs

with 8 comments

pkfix fasc3a.ps fasc3a-fix.ps
ps2pdf fasc3a-fix.ps

A common (or at least, more common than it should be) scenario: you find a PostScript file of some paper, clearly written in (La)TeX, but which looks blurry on screen and you cannot copy any text. Converting to PDF with, say, ps2pdf does not help either. You curse the .ps format, and put up with the blurriness or print it out (where it looks fine) to read it.

Turns out it doesn’t have to be this way. The problem is that the PS file is using bitmap fonts, but assuming you have the scalable (Type 1) versions of those same fonts on your system, you can convert the fonts! There’s a script called pkfix, distributed with TeX Live, which will take a ps file that uses bitmap fonts and try to convert it to use scalable fonts. Just run it as

pkfix inputfile.ps outputfile.ps

This should produce a PS which isn’t blurry and is searchable, but if you prefer PDF, the usual way will work

ps2pdf outputfile.ps

or on Mac OS X if you don’t have ps2pdf for some reason, o inputfile.ps -a macps2pdf where macps2pdf comes with MacGhostView.

If the file is very old (generated with dvips from before 1996) and pkfix doesn’t work, there’s a further script called pkfix-helper that may make the file appropriate for pkfix.

BTW, if it’s your own files that are coming out blurry, something is wrong with your setup. Just install the package cm-super from CTAN—sudo tlmgr install cm-super or whatever—and no other change is needed. Or you can use the lmodern fonts with \usepackage{lmodern}, but that shouldn’t be necessary.

Written by S

Thu, 2011-05-05 at 11:42:30

Posted in compknow

Tagged with , ,

Reality is what it is

with one comment

From Peter G. Casazza’s occasionally pessimistic A Mathematician’s Survival Guide (last emphasis mine):

Wonderful Advances. When I first joined the mathematics community I was excited to join a group dedicated to advancing mathematics. I had a rude awakening when it became clear that we were really working to advance ourselves. This is an unfortunate consequence of the reality around us. We must all compete for very scarce research grants, positions, promotion, tenure, awards, raises etc. But we need to be careful that this reality does not diminish our enjoyment of the subject.

One of the things I wish I had read a few years ago. Little niggles can also matter.

Written by S

Sun, 2011-04-17 at 07:44:37

Posted in personal, quotes

Tagged with

How does Tupper’s self-referential formula work?

with 51 comments

[I write this post with a certain degree of embarrassment, because in the end it turns out (1) to be more simple than I anticipated, and (2) already done before, as I could have found if I had internet access when I did this. :-)]

The so-called “Tupper’s self-referential formula” is the following, due to Jeff Tupper.

Graph the set of all points {(x,y)} such that

\displaystyle  \frac12 < \left\lfloor \mathrm{mod} \left( \left\lfloor{\frac{y}{17}}\right\rfloor 2^{-17\lfloor x \rfloor - \mathrm{mod}(\lfloor y \rfloor, 17)}, 2 \right) \right\rfloor

in the region

\displaystyle  0 < x < 106

\displaystyle  N < y < N+17

where N is the following 544-digit integer:
48584506361897134235820959624942020445814005879832445494830930850619
34704708809928450644769865524364849997247024915119110411605739177407
85691975432657185544205721044573588368182982375413963433822519945219
16512843483329051311931999535024137587652392648746133949068701305622
95813219481113685339535565290850023875092856892694555974281546386510
73004910672305893358605254409666435126534936364395712556569593681518
43348576052669401612512669514215505395545191537854575257565907405401
57929001765967965480064427829131488548259914721248506352686630476300

The result is the following graph:

Figure 1: The graph of the formula, in some obscure region, is a picture of the formula itself.

Whoa. How does this work?

At first sight this is rather too incredible for words.

But after a few moments we can begin to guess what is going on, and see that—while clever—this is perhaps not so extraordinary after all. So let us calmly try to reverse-engineer this feat.

Read the rest of this entry »

Written by S

Tue, 2011-04-12 at 13:05:20

Posted in mathematics

Tagged with , , ,