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
இருவாய்ச்சி ? ? ?

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