Optimising catching the bus

Often times on my way home, I find myself walking North on Stone Way, attempting to catch a Westbound bus #44 on 45th St. at Stone Wy. I can see the buses go past from afar on Stone Way, and when I see a bus go past, I wonder what the implications are for my wait time at the stop. When I'm far enough away, I want a bus to go past already, so that the next bus might show up just as I get to the stop. But as I get nearer the stop, I don't want a bus to go past, as that would mean a longer wait.

The worst scenario is a bus whizzing past just before I get to the stop, while the best is a bus showing up just as I do. So there's a discontinuity there, and that made me want to model the problem, and help figure out how I should adjust my walking speed to synchronise my arrival and a bus being there.


  • `l` be the distance from the stop when I sight a bus go past,
  • `nu` the frequency of Westbound buses along 45th St.,
  • `v_0` my current speed, and
  • `v` my new (for simplicity) constant speed once I see the bus.

So it takes me `l/v` time to get to the stop, and `l/v mod (1/nu)` time since the last bus passed by. Thus, it's `(-l/v) mod (1/nu)` time for the next bus. I thus want to minimise (the non-negative quantity) `(-l/v) mod (1/nu)`.

Let: `-l/v mod (1/nu) = epsilon_0`, for some `epsilon_0 >= 0`
`=> -l/v = -k/nu + epsilon_0`, for some `k in ZZ_(>=0)`
`=> v = -l/(-k/nu + epsilon_0) = l/(k/nu - epsilon_0) = (l nu)/k + epsilon_1`, for some `epsilon_1 >= 0`

Thus, I should pick speeds just greater than `(l nu)/k`, for some (positive) integral `k`. Let's say I don't want to go any faster than `v_0`, but I don't want to get home soon. I'd then pick `k` such that `(l nu)/k` is just less than `v_0`, i.e. minimising the positive quantity `v_0 - (l nu)/k`.

Let's let: `v_0 - (l nu)/k = v_delta`, with `v_delta > 0`
`=> k = (l nu)/(v_0 - v_delta) = ceil((l nu)/v_0)`.

Therefore, the speed I should target, that would
  1. minimise my wait time at the stop
  2. minimise the overall time
  3. not exceed my current walking speed
is `(l nu)/ceil((l nu)/v_0`.

What are the dimensions of a mod b?

I was doing dimensional analysis for a problem, and I noticed something curious about the remainder operator (sometimes referred to as the `mod` operator).

Let's recap how arithmetic operators interact with dimensional analysis. Say the dimensions of `a` are `A`, and the dimensions of `b` are `B`. For instance, `a` could be an areal measure, and `A` would be `L^2`, while `b` might be a momentum, and `B` would then be `MLT^(-1)`.

Given such quantities `a` and `b`, it's well known that the dimensions of `a*b` is `A*B`, and that of `a/b` is `A/B`. Now how about the dimensions of `a+b` and of `a-b`? That was a trick question: it doesn't make to sense or add or subtract `a` and `b`, unless they have the same dimensions, and are in fact, expressed in the same unit. You cannot add a length and a time, and furthermore, you cannot even add two length quantities, if one is expressed in metres and another in kilometres. Likewise with subtraction.

So what's the story with the remainder operator? What're the dimensions of `a mod b`? Because of the association with `a div b`, my intuition told me it might be `A/B`. Let's test that out.

Imagine I'm walking towards a bus stop, where there's a bus every `10` minutes (in the direction I want to go). When I'm far away, I see a bus go past, and it then takes me `27` more minutes to get to the stop. How long should I expect to wait for my next bus? The answer, of course, is `10 - (27 mod 10)` minutes or `3` minutes. In general, if the time-period (the reciprocal of frequency) of buses were `b` (with dimension `T`) and the time it took me to get to the stop were `a` (with dimensions `T`), the time I should wait for would be `b - a mod b`, with dimensions `T`. The fact that this expression makes sense must mean that both `b` and `a mod b` have dimensions of `T`, and are in the same units.

So that answers what the dimensions of `a mod b` must be: the same as the dimensions of `b`. But how can the dimensions be independent of the dimensions of `a`? Actually, they're not. `a mod b` is `a - kb`, with `k` chosen such that the result is between `0` and `b` (left-inclusive). So the dimensions of `a mod b` are the same as those of `a`, which then implies the following.

Like addition and subtraction, the remainder operator is only defined on quantities with the same dimensions, and in fact, expressed in the same unit, with the result also with the same dimensions and in the same unit.


மல்லிப்பூ வகை

தமிழகத்தில் விளங்கும் மல்லி வகைகள் பற்பல. அவை அனைத்துமே இறைவழிபாட்டிலும் தலையழகிற்கும் நறுமணத்திற்கும் பயன்படுகின்றன. மணம், மென்மை, வெண்மை அகியவற்றினால் மல்லிப்பூ எத்தனையோ உவமைகளில் ஆளாகும். பழமென்றால் தமிழில் எவ்வாறு வாழையோ அவ்வாறே பூவென்றால் மல்லிகை. மல்லிகை தமிழர் பூவென்றே சொல்லலாம்.

அப்பூவின் வகைகள் தமிழில் மட்டுமே அறிந்தேன். வடமொழியிலும் ஆங்கிலத்திலும் உயிரியல் இருசொற்பெயரீட்டிலும் பெயர்கள் அறியாது ஆராய்ந்தேன். அகராதி மற்றும் இணையத்தின் கிடைத்த சில பெயர்கள் மேல் உள்ளன.

தமிழ்ப்பெயர் வடமொழிப்பெயர் ஆங்கிலப்பெயர் இருசொற்பெயர்
பிச்சி, சாதிமல்லி jāti, mālatī Royal jasmine Jasminum grandiflorum
நித்தியமல்லி, பெருமல்லி ? Brazilian jasmine Jasminum fluminense
குண்டுமல்லி navamallikā Arabian jasmine Jasminum sambac
முல்லை, உச்சிமல்லி yūthikā ? Jasminum auriculatum
கத்தூரிமல்லி kunda Indian jasmine Jasminum multiflorum
காட்டுமல்லி vanamallikā Wild jasmine Jasminum angustiflorum
இருவாய்ச்சி ? ? ?

பட்டியலில் குற்றம் குறைகள் அறிந்தோர் தொடர்பு கொள்ளுமாறு வேண்டுகிறேன்.


வேற்றுமையுருபுகள் அவத்தம்

இலக்கணம் பயிலும்பொழுது எட்டு வேற்றுமையுருபுகள் (‐ஐ/‐ஆல்/‐ஓடு/‐உடன்/…) பயின்றேன். சில ஆண்டாக வடமொழி கற்கிறேன். வடமொழியிலும் வேற்றுமையுருபுகள் உள்ளன. மொழியை விளக்க இலக்கணம் எனில், வடமொழியில் பெயர்ச்சொற்களை விளக்க வேற்றுமையுருபுகள் இன்றியமையாதவை. உரையிலோ செய்யுளிலோ பெயர்ச்சொல்லது முடிவில் வரும் பிற்சேர்க்கைகள் எட்டே; அவ்வெட்டது மூலம் பெயர்ச்சொல் எல்லாமே எட்டாக வேறுபடும். இப்பிற்சேர்க்கைதான் வேறுபாட்டது உருபகளென கருதப்படுகின்றன.

அம்மொழி சொல்லச்சொல்ல, தமிழைப்பற்றித் தோன்றியது. வேற்றுமைகள் எவ்வளவு வடமொழியிற்கு பொருந்தியவையோ, அவ்வளவு தமிழிற்கு பொருந்தாதவையென தோன்றிற்று. சிறிது ஆராய்ந்தேன். என்னவென்றால், தமிழ் இலக்கணம் எழுதிய அகத்தியர் முதலானோர் அனைவரும் வடமொழி இலக்கணம் அறிந்தோர். அவ்விலக்கணத்தின் விதிமுறை கண்டு அவற்றை தமிழிலக்கணத்துள் திணித்துள்ளனர். இதனை ஆங்கிலத்தில் பற்பல எடுத்துக்காட்டுடனும் சான்றுடனும் அருமையாக கூறுகிறார் ஆரொலுடு சிப்புமன் முனைவர்.


On Kogul

If you follow Tamil urban pop culture, you’ve probably heard of the ‘kogul’ moniker that describes native Tamil speakers’ pronunciation of foreign words. In Sanskrit, ‘gōkula/goːkul̪ə/’ means ‘cattle-station’, and through synecdoche also means Krishna’s cattle-shed near modern-day Vrindavan in Uttar Pradesh. The derived term ‘gokul’, pronounced /goːkul̪/, is a personal name in various Indian languages. Tamil speakers pronounce the imported word variously as /goːgul/, /koːgul/ and /goːkul/, and thus the label. ‘Kogul’ began life in web-comics and has seen usage in diverse forms – in blog titles, photo captions, and as a Twitter hashtag. A search reveals >50000 ghits.

The reason Tamil speakers pronounce voiceless and voiced consonants interchangeably has to do with Tamil phonemic rules. The specifics are unique to Tamil, but the phenomenon exists in all world languages.

Each language has a fixed set of phonemes, and various context-dependent rules around which phonemes are valid in what contexts. For instance, English allows the /h/ phoneme in every syllabic position except the final. In the initial position, /pr/, /pl/ and /tr/ clusters are allowed but not /tl/. Sanskrit words cannot end in a palatal phoneme. Sanskrit also has sandhi rules when two phonemes come together either in the middle of a word or between words. And so on.

When a language borrows a word from another language it perforce has to adapt the phonemes into its set of valid phonemes. This is why gairaigo words in Japanese often sound very different from the source words (e.g. /bijinesu manejimento/ from ‘business management’, or /raibaru/ from ‘rival’). Other examples include English /ˈke-chəp/ from Amoynese ‘ke2 jap1’ and the Spanish ‘chofer’ from French ‘chauffer’. Not just loan-words, but cognates too are pronounced very differently in different child languages: compare the pronunciations of Stephen, Etienne, Esteban, Stefan and Estephanos across English, French, Spanish, German and Greek respectively.

In the Indian context, languages across India have borrowed Sanskrit words over millennia so systematically that grammarians have classified the borrowings: tatsama words are those that have retained their Sanskrit phonetics, while tadbhava are those with morphed pronunciations, like Hindi ghar/gʰəɽ/ from Sanskrit gr̥ha/gɽ̩ɦə/, pyās/pjaːs̪/ from pipāsā/pipaːs̪aː/ and lakhan/l̪əkʰən̪/ from lakṣmaṇa/l̪əkʂməɳə/ (Note the Hindi dental nasal in place of the Sanskrit retroflex nasal). Sanskrit has also borrowed words, fitting them into its phonemic scheme, e.g. pravāla/pɽəvaːl̪ə/ from the Tamil pavaṛa/pəvəɻə/, and dramiḍa/d̪ɽəmiɖə/ from the Tamil word for the language itself, tamiṛ/t̪əmiɻ/.

In effect, there’s nothing unnatural or wrong about Tamil people pronouncing the Sanskrit-derived word ‘Gokul’ /koːgul/. So why all this fuss?

In the 21st century, the Indo-Aryan culture centered around northern India is on the ascendant. Bollywood movies are popular throughout urban southern India and among the rural middle-class; there are 130 million non-native speakers of Hindi; ‘Indian food’, ‘Indian attire’ and even ‘Indian accent’ have come to mean the food, clothing styles and manner of speaking common in Hindi-speaking cities. Names like Rahul, Neha, Diya and Amar, once only found in the north of India, are now common throughout India, and are percolating into non-Hindi-speaking villages where few understand their meanings. Schwa elision, a standard feature of Hindi, is widespread in names of people, places and establishments well outside the Hindi-sphere.

At the same time, there’s renewed interest in “Sanskritic purity”: there is a movement to declare oneself a Sanskrit-speaker in the Indian census, there are many popular Sanskrit-quote-of-the-day web-feeds, and Carnatic music singers now mispronounce tadbhava words as if they were tatsama words. In fact, the kogul phenomenon was given prominence by a well-known Carnatic music blogger.

So, on the one hand, we have these Sanskrit purists trying to outdo one another in insisting on applying Sanskrit rules to non-Sanskrit languages. On the other hand, North Indian cultural practices have become normative and beyond judgement. That leaves the poor Tamils, pronouncing words in their language the way they’ve always done and according to the rules their grammar prescribes. Except now their pronunciation is being judged against a standard founded on ignorance and built on snobbery.


Alavandar's catuḥślōkī

svādayanniha sarvēṣāṁ trayyantārthaṁ sudurgraham ।
stōtrayāmāsa yōgīndrastaṁ vandē yāmunāhvayam ॥

yāmunācāryēṇa viracitāṁ catuḥślōkīnāmnīṁ stutiṁ mātāmahyā naikēbhyō vatsarēbhyaḥ prāgupadiṣṭōham । tasyā arthamavētuṁ yatamānaḥ anvayaṁ lilēkhiṣāmi ।

kāntastē puruṣōttamaḥ phaṇipatiḥ śayyāsanaṁ vāhanaṁ vēdātmā vihagēśvarō yavanikā māyā jaganmōhinī ।
brahmēśādisuravrajaḥ sadayitastvaddāsadāsīgaṇaḥ śrīrityēva ca nāma tē bhagavati brūmaḥ kathaṁ tvāṁ vayam ॥

bhagavati । tē kāntaḥ puruṣōttamaḥ । tē śayyā phaṇipatiḥ । tē āsanaṁ vāhanaṁ vēdātmā vihagēśvaraḥ । tē yavanikā māyā jaganmōhinī । tvaddāsadāsīgaṇaḥ sadayitaḥ brahmēśādisuravrajaḥ । tē nāma ca śrīrityēva । kathaṁ vayaṁ tvāṁ brūmaḥ ।

atra tu śriyaṁ mahārājñīṁ bhāvayan śrēṣṭhatamāni tadupalakṣaṇāni varṇayati kaviḥ । bhagavati । hē sarvamaṅgalavati । "asyāsti" iti matup । kāntaḥ priyatamō dayitaḥ । kartari ktaḥ । puruṣōttamaḥ uttamaḥ puruṣō nārāyaṇaḥ । "na nirdhāraṇē" ityasmātṣaṣṭhītatpuruṣaniṣēdhātkarmadhārayavyutpattiḥ । śayyā talpam । phaṇipatiḥ phaṇināṁ sarpāṇāṁ patiḥ ādiśēṣaḥ । phaṇaḥ sphaṭā । "ata iniṭhanau" iti matubartha in । āsanamāsandaḥ āsyata asminniti । vāhanaṁ yānaṁ vāhayatīti । vihagēśvarō vihagānāṁ khagānāmīśvarō garuḍaḥ । lakṣmīstu viṣṇuvakṣaḥsthalasthitā nityānapāyinī garutmati āstē tēna vāhyatē cēti yāvat । parasparaṁ virōdhēpi lakṣmīnārāyaṇau śēṣaṁ garuḍamubhāvapi bhuñjāta iti vicitrāspadam । yavanikā tiraskariṇī । purā rājastriyō hriyā yavanikāntarhitā iti । jagatō mōhaḥ jaganmōhaḥ । "ata iniṭhanau" iti matubartha in strītvāt ṅī ca । māyā jaganmōhinī lōkānmōhayati yathā tē lōkā mahālakṣmīṁ draṣṭuṁ nālam । brahmā caturmukhaḥ īśō rudraḥ । tau ādī yasya sa brahmēśādiḥ । tathāvidhaḥ suravrajō dēvasamūhaḥ । sadayitaḥ sapriyaḥ patnībhiḥ sahitaḥ । mahārājñyā dāsadāsyaḥ kvēti cēt gaṇōyamēvēti । sarvāṇi rājalakṣaṇānyupavarṇya antē nāmaiva anupamamityāha । pāñcarātrāgamāt śrīyatē śrayatē śruṇōti śrāvayati śruṇāti śrīṇāti cēti śrīnāmadhēyā । tathā satyāṁ tvayi kathaṁ vā brūmō vayamiti kavērāścaryaṁ bhaktiśca ।

yasyāstē mahimānamātmana iva tvadvallabhōpi prabhurnālaṁ mātumiyattayā niravadhiṁ nityānukūlaṁ svataḥ ।
tāṁ tvāṁ dāsa iti prapanna iti ca stōṣyāmyahaṁ nirbhayō lōkaikēśvari lōkanāthadayitē dāntē dayāṁ tē vidan ॥

lōkaikēśvari । lōkanāthadayitē । dāntē । yasyāḥ tē niravadhiṁ svatō nityānukūlaṁ mahimānam ātmanaḥ (mahimānam) iva tvadvallabhaḥ prabhurapi iyattayā mātuṁ na alam । tāṁ tvāṁ dāsaḥ iti prapannaścēti nirbhayōhaṁ tē dayāṁ vidan stōṣyāmi ।

kaviratra dēvyā anantaṁ mahimānaṁ varṇayannāha । lōkaikēśvari । lōkānāṁ sarvajanānām ēkā kēvalā īśavarī īśitrī sambuddhau । ēkōlpārthē pradhānē ca prathamē kēvalē tathā । sādhāraṇē samānēpi saṅkhyāyāṁ ca prayujyatē । lōkanāthadayitē । jagatpatipriyē । dāntē । damavati । damum̐ upaśamē ityasmāt ktaḥ kartari । "anunāsikasya kvijjhalōḥ kṅiti" iti upadhādairghyam । niravadhim avadhirahitam aparimitam । svataḥ lōkanāthāt tvadvallabhāt nāma śrīmannārāyaṇataḥ nityānukūlaṁ sadānusāram । mahimānaṁ mahattvam । ātmanaḥ svasya tannāma śrīpatēḥ । tvadvallabhastava priyatamaḥ । prabhuḥ svāmī punaśca bhagavān । iyattayā ētāvaditi । mātuṁ tōlayitum । na alam aparyāptaḥ । yasyāḥ tādr̥k mahimā yaṁ mātuṁ bhagavānapi aparyāptaḥ tādr̥śāṁ tāṁ tvāṁ stōṣyāmi nutiṁ kariṣyē । kathaṁbhūtaḥ stōṣyāmīti cēt । dāsaḥ kiṅkaraḥ । prapannaḥ śaraṇaṁ gataḥ । nirbhayaḥ apagatatrāsaḥ । kimarthaṁ nirbhaya iti cēt । bhavatyāḥ dayāṁ karuṇāṁ vidan jānānaḥ । mahālakṣmyāḥ apārāṁ karuṇāṁ samyak avabudhyan taddayayā bhavasāgaraṁ tarīṣyāmīti viśvasan vigatabhayaḥ stōṣyāmīti abhiprāyaḥ ।

īṣattvatkaruṇānirīkṣaṇasudhāsandhukṣaṇādrakṣyatē naṣṭaṁ prāktadalābhatastribhuvanaṁ sampratyanantōdayam ।
śrēyō na hyaravindalōcanamanaḥkāntāprasādādr̥tē saṁsr̥tyakṣaravaiṣṇavādhvasu nr̥ṇāṁ sambhāvyatē karhicit ॥

tribhuvanam anantōdayaṁ rakṣyatē īṣat tvatkaruṇānirīkṣaṇasudhāsandhukṣaṇāt prāk naṣṭaṁ tadalābhataḥ । nr̥ṇāṁ saṁsrutyakṣaravaiṣṇavādhvasu śrēyaḥ na hi sambhāvyatē aravindalōcanamanaḥkāntāprasādāt r̥tē ।

atha śriyaḥ anantā karuṇā taddhētūni phalāni ca varṇyantē । tribhuvanaṁ lōkatrayaṁ bhūrbhuvaḥsvargātmakam । ēkavadbhāvī dviguḥ trayāṇāṁ bhuvanānāṁ lōkānāṁ samāhāra iti । anantōdayaṁ anantāḥ udayāḥ yasya tādr̥k tribhuvanaṁ niravadhikālamiti । prāk naṣṭaṁ caturyugāntē pralīnaṁ parabrahmaṇi । kvēti cēt । tadalabhātaḥ । tvaddayākaṭākṣam anavāpya । "atigrahāvyathanakṣēpēṣvakartari tr̥tīyāyāḥ" iti tasim̐ । sarvanāmnaḥ tvatkaruṇānirīkṣaṇasudhāsandhukṣaṇēnvayaḥ । prāṅnaṣṭamadhunā rakṣyatē bhujyatē । kuta iti । tvatkaruṇānirīkṣaṇasudhāsandhukṣaṇāt । pañcamī hētau । tava karuṇāyāḥ dayāyāḥ nirīkṣaṇamēva dr̥ṣṭirēva sudhā amr̥tam । tasyāḥ sandhukṣaṇaṁ sphūrtiḥ । tasmāt tasya hētunā । jaganti varīvr̥tati tasyāḥ karuṇayā cēt puruṣārthā api kiṁ tasyāḥ dayayā labhyēran । āmityāha yathā । aravindalōcamanaḥkāntāprasādāt । aravindē tāmarasē iva lōcanē yasya saḥ nārāyaṇaḥ । tasya kāntā sahadharmiṇī śrīḥ । tasyā manaḥ cētaḥ । tatprasādaḥ tōṣāt anugrahaḥ । tasmādr̥tē taṁ vinā nēti । r̥tē kiṁ na । nr̥ṇāṁ manuṣyāṇāṁ saṁsr̥tau saṁsārasambaddhēṣu aiśvaryādiṣu phalēṣu akṣarē kaivalyamōkṣē vaiṣṇavādhvani paramapadaprāptau śrēyaḥ bhadraṁ na hi sambhāvyatē upapadyatē karhicit kadācana । kimuta itarē puruṣārthāḥ mōkṣōpi dēvyāḥ karuṇākaṭākṣāvalambita ityabhipraiti ।

śāntānandamahāvibhūti paramaṁ yadbrahma rūpaṁ harērmūrtaṁ brahma tatōpi tatpriyataraṁ rūpaṁ yadatyadbhutam ।
yānyanyāni yathāsukhaṁ viharatō rūpāṇi sarvāṇi tānyāhuḥ svairanurūparūpavibhavairgāḍhōpagūḍhāni tē ॥

yat śāntānandamahāvibhūti paramaṁ brahma rūpaṁ । tatōpi tat priyataraṁ (rūpaṁ) yat mūrtaṁ brahma atyadbhutam । yathāsukhaṁ viharataḥ harēḥ yāni anyāni rūpāṇi । tāni sarvāṇi tē svairanurūparūpavibhavaiḥ gāḍhōpagūḍhāni āhuḥ (pramāṇāḥ) ।

atha divyadampatyōranapāyitvam upavarṇayati । nārāyaṇasya yāni rūpāṇi mūrtayaḥ santi । kīdr̥ṁśi । prathamaṁ divyātmasvarūpam । śāntānandamahāvibhūti । śāntaṁ ṣaḍbhirūrmibhiḥ pipāsākṣucchōkamōhajarāmr̥tyubhī rahitam । ānandam jñānānandamayam । mahāvibhūti sarvavyāpi । tathā śāntam ānandaṁ mahāvibhūti śāntānandamahāvibhūtīti । paramaṁ parō māsyēti paramaṁ nirupamam । brahma br̥hat br̥ṁhaṇaṁ ca । adhunā divyamaṅgalavigrahaḥ । mūrtaṁ mūrtimat brahma brahmaśabdavācyam atyadbhutamatyāścaryakaraṁ tatōpi amūrtarūpādapi priyataraṁ lōkānāṁ saulabhyāt yadrūpaṁ tat । harirviṣṇuḥ yathāsukhaṁ yathēcchaṁ viharati parikrāmati । tathābhūtasya yāni anyāni rūpāṇi syuḥ । vibhavādimūrtīnāṁ grahaṇamatra । āhuḥ pramāṇā iti śēṣaḥ । kimāhuḥ । tāni sarvāṇi rūpāṇi tē tava svaiḥ svakīyaiḥ anurūparūpavibhavaiḥ anurūpāṇām anukūlānāṁ rūpāṇāṁ mūrtīnāṁ vibhavaiḥ kīrtimadbhiḥ gāḍhōpagūḍhāni gāḍham dr̥ḍham upagūḍhāni āliṅgitāni anapāyīni ।

ākāratrayasampannāmaravindanivāsinīm ।
aśēṣajagadīśitrīṁ vandē varadavallabhām ॥

॥ Ω sarvaṁ śrīkr̥ṣṇārpaṇamastu ॥