The Lumber Room

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

Are there Fibonacci numbers starting with 2012?

leave a 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]

Written by S

Sun, 2012-01-08 at 01:29:26 +05:30

Posted in mathematics, unfinished

Avadhana

with 3 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) 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 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. the questioner doesn’t read back what he has 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, 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 (well, Dr. Ganesh, at any rate) comes with witty replies, 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 it. This may be a sign of his wit and confidence, or (considering that there may 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 the scholar 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 is 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, 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 — so for the performer to recall it all 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.

Written by S

Mon, 2011-12-19 at 01:44:48 +05:30

My Git personal reference

with 8 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. And if you’re sharing your repository publicly, you can forget about most of the below.)

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 +05:30

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.)

    lomaśa uvāca
    eṣā devanadī puṇyā kauśikī bharatarṣabha
    viśvāmitrāśramo ramya eṣa cātra prakāśate
    āśramaś caiva puṇyākhyaḥ kāśyapasya mahātmanaḥ
    ṛśyaśṛṅgaḥ suto yasya tapasvī saṃyatendriyaḥ
    tapaso yaḥ prabhāvena varṣayām āsa vāsavam
    anāvṛṣṭyāṃ bhayād yasya vavarṣa balavṛtrahā
    mṛgyāṃ jātaḥ sa tejasvī kāśyapasya sutaḥ prabhuḥ
    viṣaye lomapādasya yaś cakārādbhutaṃ mahat
    nivartiteṣu sasyeṣu yasmai śāntāṃ dadau nṛpaḥ
    lomapādo duhitaraṃ sāvitrīṃ savitā yathā
    yudhiṣṭhira uvāca
    ṛśyaśṛṅgaḥ kathaṃ mṛgyām utpannaḥ kāśyapātmajaḥ
    viruddhe yonisaṃsarge kathaṃ ca tapasā yutaḥ
    kimarthaṃ ca bhayāc chakras tasya bālasya dhīmataḥ
    anāvṛṣṭyāṃ pravṛttāyāṃ vavarṣa balavṛtrahā
    kathaṃrūpā ca śāntābhūd rājaputrī yatavratā
    lobhayām āsa yā ceto mṛgabhūtasya tasya vai
    lomapādaś ca rājarṣir yadāśrūyata dhārmikaḥ
    kathaṃ vai viṣaye tasya nāvarṣat pākaśāsanaḥ
    etan me bhagavan sarvaṃ vistareṇa yathātatham
    vaktum arhasi śuśrūṣor ṛṣyaśṛṅgasya ceṣṭitam
    lomaśa uvāca
    vibhāṇḍakasya brahmarṣes tapasā bhāvitātmanaḥ
    amoghavīryasya sataḥ prajāpatisamadyuteḥ
    śṛṇu putro yathā jāta ṛśyaśṛṅgaḥ pratāpavān
    mahāhrade mahātejā bālaḥ sthavirasaṃmataḥ
    mahāhradaṃ samāsādya kāśyapas tapasi sthitaḥ
    dīrghakālaṃ pariśrānta ṛṣir devarṣisaṃmataḥ
    tasya retaḥ pracaskanda dṛṣṭvāpsarasam urvaśīm
    apsūpaspṛśato rājan mṛgī tac cāpibat tadā                                  SIMPLE DEER-HORN
    saha toyena tṛṣitā sā garbhiṇy abhavan nṛpa
0543_01     sā puroktā bhagavatā brahmaṇā lokakartṛṇā                          I
0543_02     devakanyā mṛgī bhūtvā muniṃ sūya vimokṣyase                        Young Deer-horn was a pious youth
    amoghatvād vidheś caiva bhāvitvād daivanirmitāt                            Devoted to religious truth,
    tasyāṃ mṛgyāṃ samabhavat tasya putro mahān ṛṣiḥ                            A hermit innocently good
    ṛśyaśṛṅgas taponityo vana eva vyavardhata                                  Who grew to manhood in the wood.
    tasyarśyaśṛṅgaṃ śirasi rājann āsīn mahātmanaḥ
    tenarśyaśṛṅga ity evaṃ tadā sa prathito 'bhavat
                                                                               His mother left him at his birth;
    na tena dṛṣṭapūrvo 'nyaḥ pitur anyatra mānuṣaḥ                             He only knew one soul on earth,
    tasmāt tasya mano nityaṃ brahmacarye 'bhavan nṛpa                          His austere father; therefore he
                                                                               Grew up in natural piety.                                                                      

    etasminn eva kāle tu sakhā daśarathasya vai                                Now in a kingdom near at hand
    lomapāda iti khyāto aṅgānām īśvaro 'bhavat                                 No rain had fallen on the land,
0544_01     premoṣitāpacāreṇa tasya rājño yudhiṣṭhira                          Prevented by the magic skill
    tena kāmaḥ kṛto mithyā brāhmaṇebhya iti śrutiḥ                             Of priests the king had treated ill.
0545_01     daivopahatasattvena dharmajñenāpi bhārata
    sa brāhmaṇaiḥ parityaktas tadā vai jagatīpatiḥ
    purohitāpacārāc ca tasya rājño yadṛcchayā
    na vavarṣa sahasrākṣas tato 'pīḍyanta vai prajāḥ                                                                                                                  

    sa brāhmaṇān paryapṛcchat tapoyuktān manīṣiṇaḥ                             An aged priest advised the king:
    pravarṣaṇe surendrasya samarthān pṛthivīpatiḥ                              “Propitiate the clergy; bring
    kathaṃ pravarṣet parjanya upāyaḥ paridṛśyatām                              Pure-minded Deer-horn from the wood,
    tam ūcuś coditās tena svamatāni manīṣiṇaḥ                                  That hermit innocently good.
    tatra tv eko munivaras taṃ rājānam uvāca ha
    kupitās tava rājendra brāhmaṇā niskṛtiṃ cara                               “He dwells in purity afar;
    ṛśyaśṛṅgaṃ munisutam ānayasva ca pārthiva                                  He does not know what women are:
    vāneyam anabhijñaṃ ca nārīṇām ārjave ratam                                 Fetch him, and then the rain will fall;
    sa ced avatared rājan viṣayaṃ te mahātapāḥ                                 Of this I have no doubt at all.”
    sadyaḥ pravarṣet parjanya iti me nātra saṃśayaḥ                                                                                                                           

    etac chrutvā vaco rājan kṛtvā niskṛtim ātmanaḥ                             The counsel pleased the king; he planned
    sa gatvā punar āgacchat prasanneṣu dvijātiṣu                               To entertain the hermit, and
    rājānam āgataṃ dṛṣṭvā pratisaṃjagṛhuḥ prajāḥ                               Invited women of the town
0546_01     sa ca tāḥ pratijagrāha piteva hitakṛt sadā                         To go and bring young Deer-horn down.
    tato 'ṅgapatir āhūya sacivān mantrakovidān
    ṛśyaśṛṅgāgame yatnam akaron mantraniścaye
    so 'dhyagacchad upāyaṃ tu tair amātyaiḥ sahācyutaḥ
    śāstrajñair alam arthajñair nītyāṃ ca pariniṣṭhitaiḥ
    tata ānāyayām āsa vāramukhyā mahīpatiḥ
    veśyāḥ sarvatra niṣṇātās tā uvāca sa pārthivaḥ
    ṛśyaśṛṅgam ṛṣeḥ putram ānayadhvam upāyataḥ
    lobhayitvābhiviśvāsya viṣayaṃ mama śobhanāḥ
0547_01     niyojayām āsa ca tās tasya bālasya lobhane
    tā rājabhayabhītāś ca śāpabhītāś ca yoṣitaḥ                                But they refused the royal plan,
    aśakyam ūcus tat kāryaṃ vivarṇā gatacetasaḥ                                Fearing to meet a holy man;
    tatra tv ekā jaradyoṣā rājānam idam abravīt                                At last an aged crone’s ambition
    prayatiṣye mahārāja tam ānetuṃ tapodhanam                                  Drove her to undertake the mission.                                                            

    abhipretāṃs tu me kāmān samanujñātum arhasi                                “If you will give me what I ask;’
    tataḥ śakṣye lobhayitum ṛśyaśṛṅgam ṛṣeḥ sutam                              She said, “I can fulfill the task;
                                                                               But I require a rich reward
                                                                               Of gold and gems, my royal lord.”                                                              

    tasyāḥ sarvam abhiprāyam anvajānāt sa pārthivaḥ                            With royal bounty richly laden,
    dhanaṃ ca pradadau bhūri ratnāni vividhāni ca                              She took her child, a youthful maiden
    tato rūpeṇa saṃpannā vayasā ca mahīpate                                    More known as beautiful than good,
    striya ādāya kāś cit sā jagāma vanam añjasā                                And so departed to the wood.                                                           

    lomaśa uvāca                                                               II
    sā tu nāvyāśramaṃ cakre rājakāryārthasiddhaye                              She waited till the coast was clear,
    saṃdeśāc caiva nṛpateḥ svabuddhyā caiva bhārata                            And then she sent her daughter dear
    nānāpuṣpaphalair vṛkṣaiḥ kṛtrimair upaśobhitam                             To interview the hermit who
    nānāgulmalatopetaiḥ svādukāmaphalapradaiḥ                                  Had never learned what women do.
    atīva ramaṇīyaṃ tad atīva ca manoharam
    cakre nāvyāśramaṃ ramyam adbhutopamadarśanam
    tato nibadhya tāṃ nāvam adūre kāśyapāśramāt
    cārayām āsa puruṣair vihāraṃ tasya vai muneḥ
    tato duhitaraṃ veśyā samādhāyetikṛtyatām                                   The maiden found the lad and said:
    dṛṣṭvāntaraṃ kāśyapasya prāhiṇod buddhisaṃmatām                            “I trust your pious life is led
    sā tatra gatvā kuśalā taponityasya saṃnidhau                               Without offense, and that your food
    āśramaṃ taṃ samāsādya dadarśa tam ṛṣeḥ sutam                               Of roots and fruits is sweet and good.
    veśyovāca
    kaccin mune kuśalaṃ tāpasānāṃ; kaccic ca vo mūlaphalaṃ prabhūtam           “I trust your father’s heart is blest
    kaccid bhavān ramate cāśrame 'smiṃs; tvāṃ vai draṣṭuṃ sāṃpratam āgato 'smi With deep religious peace and rest;
    kaccit tapo vardhate tāpasānāṃ; pitā ca te kaccid ahīnatejāḥ               For I am hither come to see
    kaccit tvayā prīyate caiva vipra; kaccit svādhyāyaḥ kriyate ṛśyaśṛṅga      Your unpretending piety.”                                                                      

    ṛśyaśṛṅga uvāca                                                            And Deer-horn answered: “Sir, you are
    ṛddho bhavāñ jyotir iva prakāśate; manye cāhaṃ tvām abhivādanīyam          As radiant as a beaming star;
    pādyaṃ vai te saṃpradāsyāmi kāmād; yathādharmaṃ phalamūlāni caiva          I never saw a man like you;
                                                                               Then tell me, sir, what shall I do                                                             

    kauśyāṃ bṛsyām āssva yathopajoṣaṃ; kṛṣṇājinenāvṛtāyāṃ sukhāyām             “To make you happy? Here are roots,
    kva cāśramas tava kiṃ nāma cedaṃ; vrataṃ brahmaṃś carasi hi devavat tvam   Water, a couch of skins, and fruits.
                                                                               What vows are yours, most holy sage?
                                                                               Where is your pious hermitage?”                                                                

    veśyovāca
    mamāśramaḥ kāśyapaputra ramyas; triyojanaṃ śailam imaṃ pareṇa              “My hermitage,” the maid replied,
    tatra svadharmo 'nabhivādanaṃ no; na codakaṃ pādyam upaspṛśāmaḥ            “Is three long leagues from here, beside
0548_01     bhavatā nābhivādyo 'ham abhivādyo bhavān mayā                      The river; there I practice now
0548_02     vratam etādṛśaṃ brahman pariṣvajyo bhavān mayā                     A fearfully ascetic vow.
    ṛśyaśṛṅga uvāca
    phalāni pakvāni dadāni te 'haṃ; bhallātakāny āmalakāni caiva               “For I have sworn that I will greet
    parūṣakānīṅgudadhanvanāni; priyālānāṃ kāmakāraṃ kuruṣva                    Such other hermits as I meet;
0549_01     gṛhāṇa kāmād dhi mamopakārāt                                       And I must clasp and kiss you too—
0549_02     kuruṣva kāmaṃ yad abhīpsitaṃ me                                    So my religion bids me do.”                                                                    

    lomaśa uvāca                                                               She spurned the fruits that he had offered,
    sā tāni sarvāṇi visarjayitvā; bhakṣān mahārhān pradadau tato 'smai         And in their stead to him she proffered
    tāny ṛśyaśṛṅgasya mahārasāni; bhṛśaṃ surūpāṇi ruciṃ dadur hi               Confectionery sweet and good
                                                                               That she had brought into the wood.                                                            

    dadau ca mālyāni sugandhavanti; citrāṇi vāsāṃsi ca bhānumanti              She gave him fragrant garlands too,
    pānāni cāgryāṇi tato mumoda; cikrīḍa caiva prajahāsa caiva                 And brilliant garments, clean and new;
                                                                               She offered wine; and while he quaffed,
                                                                               She played and swayed and danced and laughed.                                          

    sā kandukenāramatāsya mūle; vibhajyamānā phalitā lateva                    She played about him with a ball,
    gātraiś ca gātrāṇi niṣevamāṇā; samāśliṣac cāsakṛd ṛśyaśṛṅgam               And oft coquettishly would fall
    sarjān aśokāṃs tilakāṃś ca vṛkṣān; prapuṣpitān avanāmyāvabhajya            Upon his bosom, until he
    vilajjamāneva madābhibhūtā; pralobhayām āsa sutaṃ maharṣeḥ                 Took fire from her immodesty.                                                          

    atharśyaśṛṅgaṃ vikṛtaṃ samīkṣya; punaḥ punaḥ pīḍya ca kāyam asya           At last she saw the deed was done,
    avekṣamāṇā śanakair jagāma; kṛtvāgnihotrasya tadāpadeśam                   That she had charmed the hermit’s son;
                                                                               And, gazing o’er her shoulder, fled,
                                                                               To make her sacrifice, she said.                                                               

    tasyāṃ gatāyāṃ madanena matto; vicetanaś cābhavad ṛśyaśṛṅgaḥ               When she had left him, peace and joy
    tām eva bhāvena gatena śūnyo; viniḥśvasann ārtarūpo babhūva                Departed from the luckless boy;
                                                                               Sadly he sighed, by love distressed,
                                                                               An aching void within his breast.                                                              

    tato muhūrtād dharipiṅgalākṣaḥ; praveṣṭito romabhirā nakhāgrāt             His father, while he sighed, returned,
    svādhyāyavān vṛttasamādhiyukto; vibhāṇḍakaḥ kāśyapaḥ prādurāsīt            Whose eyes with fire ascetic burned,
                                                                               Whose life was one devoted prayer,
                                                                               Whose nails were overgrown with hair.                                                  

    so 'paśyad āsīnam upetya putraṃ; dhyāyantam ekaṃ viparītacittam            When he beheld his son distressed
    viniḥśvasantaṃ muhur ūrdhvadṛṣṭiṃ; vibhāṇḍakaḥ putram uvāca dīnam          With eye upturned and heaving breast,
                                                                               With longing written on his face
                                                                               And passion in contentment’s place,                                                            

    na kalpyante samidhaḥ kiṃ nu tāta; kaccid dhutaṃ cāgnihotraṃ tvayādya      “What troubles you, my dearest son?”
    sunirṇiktaṃ sruksruvaṃ homadhenuḥ; kaccit savatsā ca kṛtā tvayādya         He asked, “and are your duties done?
    na vai yathāpūrvam ivāsi putra; cintāparaś cāsi vicetanaś ca               Who has been here with you today?”
    dīno 'timātraṃ tvam ihādya kiṃ nu; pṛcchāmi tvāṃ ka ihādyāgato 'bhūt       And Deer-horn answered him straightway.                                                        

                                                                               III
    ṛśyaśṛṅga uvāca                                                            “A hermit youth with hanging hair,
    ihāgato jaṭilo brahmacārī; na vai hrasvo nātidīrgho manasvī                Not short, nor very tall, but fair
    suvarṇavarṇaḥ kamalāyatākṣaḥ; sutaḥ surāṇām iva śobhamānaḥ                 And bright as gold, with lotus-eyes,
                                                                               Some child of heaven, wondrous wise.                                                   

    samṛddharūpaḥ saviteva dīptaḥ; suśuklakṛṣṇākṣataraś cakoraiḥ               “He came in beauty like the sun,
    nīlāḥ prasannāś ca jaṭāḥ sugandhā; hiraṇyarajjugrathitāḥ sudīrghāḥ         Black eyes, sweet voice, his hair undone
                                                                               And hanging soft, dark, fragrant, and
                                                                               Encircled by a golden band.                                                                    

    ādhārarūpā punar asya kaṇṭhe; vibhrājate vidyud ivāntarikṣe                “A relic on his neck was seen
    dvau cāsya piṇḍāv adhareṇa kaṇṭham; ajātaromau sumanoharau ca              That danced like flashing lightnings keen;
                                                                               Below it, two soft swellings white
                                                                               That thrilled me with a strange delight.                                                       

    vilagnamadhyaś ca sa nābhideśe; kaṭiś ca tasyātikṛtapramāṇā                “Large hips he had, but slender waist
    tathāsya cīrāntaritā prabhāti; hiraṇmayī mekhalā me yatheyam               Which I could see was close embraced
                                                                               By a golden belt; I saw it shine
                                                                               And it was not at all like mine.                                                               

0550_01     anyac ca tasyādbhutadarśanīyā                                      “And on his ankles something stirred
0550_02     vibhāti mālā kanakaprabhāsā                                        That jingled like a cooing bird,
0550_03     kaṇṭhe sthitā vakṣasi ghūrṇamānā                                   While on his wrist there tinkled free
0550_04     yathākṣamālā bhavatā nibaddhā                                      A novel kind of rosary.                                                                        

    anyac ca tasyādbhutadarśanīyaṃ; vikūjitaṃ pādayoḥ saṃprabhāti              “And as he moved, the beads would sing
    pāṇyoś ca tadvat svanavan nibaddhau; kalāpakāv akṣamālā yatheyam           Like gay flamingoes in the spring;
                                                                               His pious robe was wondrous fair,
                                                                               And quite unlike the garb we wear.                                                             

    viceṣṭamānasya ca tasya tāni; kūjanti haṃsā sarasīva mattāḥ                “His face was beautiful to see;
    cīrāṇi tasyādbhutadarśanāni; nemāni tadvan mama rūpavanti                  His speech was kind and gladdened me;
    vaktraṃ ca tasyādbhutadarśanīyaṃ; pravyāhṛtaṃ hlādayatīva cetaḥ            His voice was like the nightingale;
    puṃskokilasyeva ca tasya vāṇī; tāṃ śṛṇvato me vyathito 'ntarātmā           It made me sigh and yearn and pale.                                                            

    yathā vanaṃ mādhavamāsi madhye; samīritaṃ śvasanenābhivāti                 “And as in spring the forest trees
    tathā sa vāty uttamapuṇyagandhī; niṣevyamāṇaḥ pavanena tāta                Wave beautifully in the breeze,
                                                                               So, father, when the wind blew, he
                                                                               Shed fragrance like a flowering tree.                                                  

    susaṃyatāś cāpi jaṭā vibhaktā; dvaidhīkṛtā bhānti samā lalāṭe              “His hermit locks— I wondered how
    karṇau ca citrair iva cakravālaiḥ; samāvṛtau tasya surūpavadbhiḥ           They parted on his noble brow;
                                                                               And dangling from each ear, there stirred
                                                                               And danced what seemed a brilliant bird.                                                       

    tathā phalaṃ vṛttam atho vicitraṃ; samāhanat pāṇinā dakṣiṇena              “A round, elastic fruit he had
    tad bhūmim āsādya punaḥ punaś ca; samutpataty adbhutarūpam uccaiḥ          That bounded from the earth like mad
                                                                               When he would strike it merrily—
                                                                               'Twas very wonderful to see.                                                           

    tac cāpi hatvā parivartate 'sau; vāterito vṛkṣa ivāvaghūrṇaḥ               “He moved and swayed with graceful ease—
    taṃ prekṣya me putram ivāmarāṇāṃ; prītiḥ parā tāta ratiś ca jātā           I thought of wind among the trees:
                                                                               A wonderful delight and joy
                                                                               Came when I saw the godlike boy.                                                               

    sa me samāśliṣya punaḥ śarīraṃ; jaṭāsu gṛhyābhyavanāmya vaktram            “He held me in a tight embrace;
    vaktreṇa vaktraṃ praṇidhāya śabdaṃ; cakāra tan me 'janayat praharṣam       I felt his hair; he pressed his face
                                                                               Against my face and made a noise
                                                                               That waked in me the strangest joys.                                                   

    na cāpi pādyaṃ bahu manyate 'sau; phalāni cemāni mayāhṛtāni                “Our simple fruits he did not think
    evaṃvrato 'smīti ca mām avocat; phalāni cānyāni navāny adān me             Were good, or water that we drink;
                                                                               He gave me other fruits and rare,
                                                                               And said: ‘This is my humble fare.’                                                            

    mayopayuktāni phalāni tāni; nemāni tulyāni rasena teṣām                    “They were not like the fruits we eat,
    na cāpi teṣāṃ tvag iyaṃ yathaiṣāṃ; sārāṇi naiṣām iva santi teṣām           But tasted wonderfully sweet;
                                                                               They had a different sort of skin,
                                                                               And different was the pulp within.                                                             

    toyāni caivātirasāni mahyaṃ; prādāt sa vai pātum udārarūpaḥ                “A strange, sweet kind of water he
    pītvaiva yāny abhyadhikaḥ praharṣo; mamābhavad bhūś caliteva cāsīt         Offered with noble piety;
                                                                               It filled me with an odd delight,
                                                                               And earth grew wobbly to my sight.                                                             

    imāni citrāṇi ca gandhavanti; mālyāni tasyodgrathitāni paṭṭaiḥ             “Sweet garlands with a careless mirth
    yāni prakīryeha gataḥ svam eva; sa āśramaṃ tapasā dyotamānaḥ               He wove, and scattered on the earth;
                                                                               Then, glorious as an ancient sage,
                                                                               Departed to his hermitage.                                                                     

    gatena tenāsmi kṛto vicetā; gātraṃ ca me saṃparitapyatīva                  “And since he went, I feel distressed;
    icchāmi tasyāntikam āśu gantuṃ; taṃ ceha nityaṃ parivartamānam             My limbs are burning and my breast;
                                                                               I long to go to him today
                                                                               Or have him here with me alway.                                                                

    gacchāmi tasyāntikam eva tāta; kā nāma sā vratacaryā ca tasya              “Yes, I will tread the path he trod
    icchāmy ahaṃ carituṃ tena sārdhaṃ; yathā tapaḥ sa caraty ugrakarmā         And learn the way he worships God;
                                                                               With him I long to make a trial
                                                                               Of holy life and self-denial.                                                          

0551_01     cartuṃ tathecchā hṛdaye mamāsti                                    “I find no peace from him apart;
0551_02     dunoti cittaṃ yadi taṃ na paśye                                    Religious yearnings fill my heart.”                                                            

                                                                               IV
    vibhāṇḍaka uvāca                                                           “It was a devil, dear my son;
    rakṣāṃsi caitāni caranti putra; rūpeṇa tenādbhutadarśanena                 By foes like these we are undone;
    atulyarūpāṇy atighoravanti; vighnaṃ sadā tapasaś cintayanti                They walk the earth in conquering charm
                                                                               And work religious men much harm.                                                              

    surūparūpāṇi ca tāni tāta; pralobhayante vividhair upāyaiḥ                 “They win us with their cunning wiles,
    sukhāc ca lokāc ca nipātayanti; tāny ugrakarmāṇi munīn vaneṣu              Their wondrous beauty and their smiles,
                                                                               Then show themselves as demons fell
                                                                               And plunge us in the pit of hell.                                                              

    na tāni seveta munir yatātmā; satāṃ lokān prārthayānaḥ kathaṃ cit          “The man who seeks religious peace
    kṛtvā vighnaṃ tāpasānāṃ ramante; pāpācārās tapasas tāny apāpa              Should keep himself from such as these;
                                                                               To ruin us is their delight,
                                                                               My pious boy. Forget the sight.                                                                

    asajjanenācaritāni putra; pāpāny apeyāni madhūni tāni                      “And those sweet waters that you had
    mālyāni caitāni na vai munīnāṃ; smṛtāni citrojjvalagandhavanti             Are tasted only by the bad;
                                                                               And we ascetics never wear
                                                                               A perfumed garland on our hair.                                                                

    lomaśa uvāca                                                               “Resist the devil, boy”; he said
    rakṣāṃsi tānīti nivārya putraṃ; vibhāṇḍakas tāṃ mṛgayāṃ babhūva            And then he hunted for the jade;
    nāsādayām āsa yadā tryaheṇa; tadā sa paryāvavṛte ''śramāya                 Three days he sought without success
                                                                               And ceased for very weariness.                                                         

    yadā punaḥ kāśyapo vai jagāma; phalāny āhartuṃ vidhinā śrāmaṇena           Meantime, the tempting minx returned,
    tadā punar lobhayituṃ jagāma; sā veśayoṣā munim ṛśyaśṛṅgam                 And seeing her, young Deer-horn burned;
    dṛṣṭvaiva tām ṛśyaśṛṅgaḥ prahṛṣṭaḥ; saṃbhrāntarūpo 'bhyapatat tadānīm      “Come quick,” he said, “and let us roam;
    provāca caināṃ bhavato ''śramāya; gacchāva yāvan na pitā mamaiti           You see my father’s not at home.                                                               

    tato rājan kāśyapasyaikaputraṃ; praveśya yogena vimucya nāvam              “Your hermitage I fain would view”;
    pralobhayantyo vividhair upāyair; ājagmur aṅgādhipateḥ samīpam             So, hand in eager hand, they flew
                                                                               And found a boat and floated down
                                                                               The river to the royal town.                                                           

                                                                               No sooner did the hermit gain
    saṃsthāpya tām āśramadarśane tu; saṃtāritāṃ nāvam atīva śubhrām            The royal palace than the rain
    tīrād upādāya tathaiva cakre; rājāśramaṃ nāma vanaṃ vicitram               Fell, drenching every thirsty part
    antaḥpure taṃ tu niveśya rājā; vibhāṇḍakasyātmajam ekaputram               And gladdening the sovereign’s heart.
    dadarśa devaṃ sahasā pravṛṣṭam; āpūryamāṇaṃ ca jagaj jalena
0552_01        samāyāte ṛṣyaśṛṅge 'tha rājan                                   The joyful monarch to the brave,
       sa lomapādaḥ paripūrṇakāmaḥ; sutāṃ dadāv ṛśyaśṛṅgāya śāntām             Bewildered young ascetic gave—
                                                                               Lest he should ever seek release—
                                                                               A princess—and her name was Peace.                                

Written by S

Sun, 2011-10-09 at 12:03:39 +05:30

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 +05:30

Posted in funny, language, quotes

The invitation

with 4 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 +05:30

(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 +05:30

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 +05:30

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 +05:30

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 +05:30

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 +05:30

Posted in sanskrit

leave a comment »


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

Written by S

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

Posted in personal

Making audio louder with Audacity

leave a 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 +05:30

Posted in compknow

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

with 2 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 +05: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 +05:30

Posted in personal, quotes

Tagged with

How does Tupper’s self-referential formula work?

with 15 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 +05:30

Posted in mathematics

Tagged with , , ,

The Book of Heroic Failures

with 3 comments

Stephen Pile’s The Book of Heroic Failures (first published 1979) must be one of the greatest books ever written. Too many books have been written in praise of competence; this book provides an antidote by celebrating failure as only a British author can. Starting with a declaration that “Success is overrated”, it proceeds to chronicle, lovingly, miscellaneous tales from the ages. There is no description I can write that would be a substitute for quoting from the book at length:

THE LEAST SUCCESSFUL ANIMAL RESCUE
The firemen’s strike of 1978 made possible one of the great animal rescue attempts of all time. Valiantly, the British Army had taken over emergency firefighting and on 14 January they were called out by an elderly lady in South London to retrieve her cat which had become trapped up a tree. They arrived with impressive haste and soon discharged their duty. So grateful was the lady that she invited them all in for tea. Driving off later, with fond farewells completed, they ran over the cat and killed it.

THE LEAST ACCURATELY LABELLED MUSEUM EXHIBIT
A first-class example of inaccurate labelling was discovered in October 1971 in County Durham. The object was exhibited in a South Shields museum as a Roman sestertius coin, minted between AD 135 and AD 138. However, Miss Fiona Gordon, aged 9, pointed out that it was, in fact, a plastic token given away free by a soft drinks firm in exchange for bottle labels. The dating was, in her view, almost 2,000 years out.
When challenged to provide evidence, she said: ‘I knew because the firm’s trademark was printed on the back.’
A spokesman for the Roman Fort museum said: ‘The token was designed as a Roman replica. The trouble was that we construed the letter “R” on the coin to mean “Roma”. In fact it stood for “Robinsons”, the soft drink manufacturers.’

THE MOST POINTLESS RADIO INTERVIEW
One of Britain’s most popular radio programmes is ‘Desert Island Discs’ in which a celebrity is asked to imagine that, for unspecified reasons, he is trapped on a desert island with his eight favourite records.
In the early 1970s the programme’s presenter, Roy Plomley was keen to get the novelist Alistair Maclean on to his programme. As a writer of adventure stories, it was felt he might fit the role of a castaway and give a gripping broadcast.
This was soon arranged, despite Maclean’s known reluctance to give interviews.
Mr Plomley arranged to meet him for lunch at the Savile Club in London. They got on extremely well.
During lunch Mr Plomley asked, ‘Which part of the year do you put aside for your writing?’
‘Writing?’ said Maclean.
‘Yes – your books – Guns of Navarone.
‘I’m not Alistair Maclean, the writer.’
‘No?’
‘No. I’m in charge of the Ontario Tourist Bureau.’
With no alternative, the two set off for the studio. During the recording an increasingly agitated producer urged: ‘Ask him about his books.’ ‘He hasn’t written any,’ replied the broadcaster.
The programme was never broadcast.

Read the rest of this entry »

Written by S

Mon, 2011-03-21 at 11:01:42 +05:30

Posted in funny

Indian names

leave a comment »

When The New York Times carried a routine notice about a book in 1961, John Updike, then 29, was so impressed by the author’s name that he wrote a poem about it:

I Missed His Book, But I Read His Name

“The Silver Pilgrimage,” by M. Anantanarayanan. . . . 160 pages.
Criterion. $3.95.      —The Times

Though authors are a dreadful clan
To be avoided if you can,
I’d like to meet the Indian,
M. Anantanarayanan.

I picture him as short and tan.
We’d meet, perhaps, in Hindustan.
I’d say, with admirable élan,
“Ah, Anantanarayanan —

I’ve heard of you. The Times once ran
A notice on your novel, an
Unusual tale of God and Man.”
And Anantanarayanan

Would seat me on a lush divan
And read his name — that sumptuous span
Of ‘a’s and ‘n’s more lovely than
“In Xanadu did Kubla Khan” —

Aloud to me all day. I plan
Henceforth to be an ardent fan
of Anantanarayanan —
M. Anantanarayanan.

(Also on Youtube)

Written by S

Mon, 2011-03-21 at 09:53:43 +05:30

Posted in funny

Tagged with

“Your monkey did not jump high enough”

with 4 comments

Yesterday, in Futility Closet there was a post:

In Longfellow’s novel Kavanagh, Mr. Churchill reads a word problem to his wife:

“In a lake the bud of a water-lily was observed, one span above the water, and when moved by the gentle breeze, it sunk in the water at two cubits’ distance. Required the depth of the water.”

“That is charming, but must be very difficult,” she says. “I could not answer it.”

Is it? If a span is 9 inches and a cubit is 18 inches, how deep is the water?


The problem is simple enough: if the depth of the water is x inches so that the lotus from bottom to tip is x+9 inches, then x2+362=(x+9)2, which means x=(362-92)/18=135/2=67.5.

More interestingly, as I accidentally recognised (I don’t know how), it is from the Sanskrit mathematics text Lilavati (and also found in the Bījagaṇita) of Bhaskaracharya (Bhaskara II). That entire chapter of Kavanagh is essentially quoting the Lilavati (Kavanagh is written in a somewhat embarrassing tone that perhaps explains why it’s so obscure :p); it’s included later below the horizontal line in this post.

Bhaskaracharya, believed to have lived in the 12th century, is considered the last great Indian mathematician, outside of the Kerala school. Like most Sanskrit texts, the Līlāvati is written in verse, so as to be easier to memorise. Unlike many Sanskrit technical works (or for that matter technical works in any language), however, Bhāskara’s works are not written in the typical dry style, and can veer quite poetic at times. His description of the seasons in one of his astronomical works is one of the few true instances of poetry in the Sanskrit astronomical/mathematical corpus. This particular problem, it happens, is written in the beautiful mandākrānta metre: (If it helps: mandakranta is the metre of the Meghadūta, of “शान्ताकारं भुजगशयनं…”, of “नास्था धर्मे न वसुनिचये…”, etc., and you can listen to a recitation in the Marathi tradition by Ashwini Deo.)

चक्रक्रौञ्चाकुलितसलिले क्वापि दृष्टं तडागे
तोयादूर्ध्वं कमलकलिकाग्रं वितस्तिप्रमाणम्
मन्दं मन्दं चलितमनिलेनाऽऽहतं हस्तयुग्मे
तस्मिन्मग्नं गणक कथय क्षिप्रमम्बुप्रमाणम्

cakra-krauñcākulita-salile kvāpi dṛṣṭaṃ taḍāge
toyād ūrdhvaṃ kamala-kalikāgraṃ vitasti-pramāṇam
mandaṃ mandaṃ calitam anilenāhataṃ hasta-yugme
tasmin magnaṃ gaṇaka kathaya kṣipram ambu-pramāṇam

In a certain lake swarming with geese and cranes,
the tip of a bud of lotus was seen one span above the water.
Forced by the wind, it gradually moved, and was submerged at a distance of two cubits.
O mathematician, tell quickly the depth of the water.


Well, that’s my translation, close to Longfellow’s quoted translation by Taylor and to Colebrooke’s better translation, but I may be wrong, so details for anyone who cares to improve it:

In a certain [kvāpi] pool [taḍāge] whose water [salile] was swarming [ākulita] with ruddy geese [cakra] and curlews [krauñcā],
above the water [toyād ūrdhvaṃ] a lotus-bud-tip [kamala-kalikāgraṃ] at a distance of one span [vitasti-pramāṇam] was seen [dṛṣṭaṃ].
Slowly slowly [mandaṃ mandaṃ] by the wind [anilena] moved [calitam] and forced [āhataṃ],
at a distance of two cubits [hasta-yugme] it got submerged [magnaṃ] in the water [tasmin].
O mathematician [gaṇaka], say [kathaya] quickly [kṣipram] the depth of the water [ambu-pramāṇam].

The structure of the book may be worth remarking on: the general formula for exactly this problem is given first (in more technical terms), and then this problem is given as an example!

Glancing through Longfellow, one finds he’s also written a tiny poem called King Trisanku:

Viswamitra the Magician,
By his spells and incantations,
Up to Indra’s realms elysian
Raised Trisanku, king of nations.

Indra and the gods offended
Hurled him downward, and descending
In the air he hung suspended,
With these equal powers contending.

Thus by aspirations lifted,
By misgivings downward driven,
Human hearts are tossed and drifted
Midway between earth and heaven.

Ho hum (1845 America).

The chapter of Kavanagh below this line.


Read the rest of this entry »

Written by S

Sat, 2011-01-29 at 04:06:14 +05:30

Posted in mathematics, sanskrit

People, Pens, Paper, and Computers

with 11 comments

(A post from November 2008 that had been marked private for some reason.)

Attended a talk today that was part of the HCI (Human-Computer Interaction) Seminar Series at MIT CSAIL. Some very exciting stuff.

For several decades now (say, since the Xerox Star was introduced in 1981) there have been dreams and hype of the “paperless office”. This dream has not been realised, because paper has many great qualities that suggest that it is not going to go anywhere. In many ways, technologies that have been touted to replace paper have proved rather cumbersome. Somewhat like writing like this:

Pencil encumbered with brick

Some recent technologies that keep the dream alive are the Tablet PC and (new to me) the Anoto (etc.) digital pens that work in conjunction with digital paper (just normal paper printed with a pattern, not “electronic paper”). I played for a few seconds with Livescribe‘s “Pulse Smartpen”, but it was after the talk so I didn’t have much time. Here is a video of all that it can do.

People prefer paper. There have been two lines of work — trying to produce paper-like technology and trying to improve integration between paper and the PC.

I guess both the tablet PC and Livescribe-like technologies fall into the former category. For the Tablet PC, he described a model of interaction that (with a pen) is more natural than the point-and-click model: crossing. The idea is that instead of actions being performed when a target on the screen is clicked upon, actions are performed when targets are crossed across. It is claimed that crossing-based interface is at least as fast as point-and-click, and is faster when you require only “approximate” crossing, and it is possible to change all your applications to work with crossing instead by simply changing a system DLL. He showed a crossing-based drawing application called CrossY; see the video.

Then he showed another work called PapierCraft, which fits into the other line of work. The insight is that although people prefer to read and annotate on paper, they usually get them in digital form. The common example is that academics download an article, then print it out, and work with the printed copy, making annotations etc. The idea is to keep in a database an image of what the printed copy looks like, and then consider people to be working on the digital copy with the printed copy as a proxy for it — when they perform annotations, cut-copy-paste etc., link those operations to the digital copy. See video.

He also showed some two-display e-book readers that can emulate flipping pages, working with different documents, etc; see video.

The speaker was François Guimbretière; see his page for more details. All very cool stuff.

Written by S

Fri, 2011-01-14 at 01:44:21 +05:30

Posted in Uncategorized

Follow

Get every new post delivered to your Inbox.