The Lumber Room

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

Proverbs from China and India (possibly)

with one comment

(Reposting from G+ for posterity)

I came across this 1907 book by Arthur Guiterman (who was previously encountered here), titled “Betel Nuts: or What They Say in Hindustan”, in which he claims to have collected proverbs and sayings “gleaned in Bengal, in the Punjab, in Rajputana, and even among the mountains of Kashmir and Afghanistan”.

I write “claims”, because the practice was rampant, at the time, to write random things and attribute them to various exotic peoples. Nevertheless, many of these look like genuine proverbs from the region. He writes:

These proverbs, and hundreds like them, are ever in the mouths of the people of Hindustan, giving spice and color to their speech even as the Betel Nut—the chewing-gum of the Orient—spices the breath and reddens the lips of the folks of the bazaars. Many of them are more than proverbs: they are really condensations of shrewd, pithy stories illustrative of native life in its varied phases—stories so well known that the repetition of a couplet containing the point conveys the whole tale to the mind of the hearer. It is literature in shorthand.

This is a good description of the way proverbs and other sayings are used in India. (See Sadāsvāda post on nyāya-s.)

Of the verses in the collection, some are still good sayings (helped by the rhyme), some are recognizable from subhāṣita collections or real Indian proverbs, some are dull in English but evoke the possibility of having been something pithy in the original, and some are interesting only for what they may say about a (possibly fictional) culture that may have had such proverbs.

In a second book, published in 1920 when the first book was out of print, he reproduces these with a few more added (some lightly modified), along with a section titled “Chips of Jade: or What They Say in China”, containing proverbs putatively from China.

Some samples below, from both “Betel Nuts” and “Chips of Jade”. Each verse is independent.

Betel Nuts, or What They Say in Hindustan

God ripes the mangoes,
The Farmer shakes the tree:
God cures the patient,
The Doctor takes the fee.

Now hear the words the Brahman said:
“The Lion’s Mane, the Miser’s Hoard,
The Serpent’s Fang, the Brave Man’s Sword,
Ye may obtain — when they are dead.”

Three were invited — here come Nine!
Water the porridge; all shall dine.

He laughed derision when his Foes
Against him cast, each man, a Stone:
His Friend in anger flung a Rose —
And all the City heard him groan.

They toil not, but decry their bread.
They fight not, they defame the Dead.

The Goat gave up her life; ’twas not enough.
The Eater grumbles that the meat is tough.

A Day or a Minute? a Year or a Moon?—
Now, which does he mean when he says, “Pretty soon!”

Thou lackest, O Shirker,
Though long thou hast prayed?
Know, God’s a Good Worker,
But loves to have Aid.

Buy not, like a hapless Dunce,
Gauds unworth the Keeping.
“Dear,” O Sahib, weeps but once;
“Cheap” is always weeping.

Liars died in Days of Old;
Now, they never catch a Cold!

The Chiefs that Peasants choose by Lot
They will not be afraid of.
The Idol-carver worships not;
He knows what Gods are made of.

The Goat made friends with the Grass and Wheat;
Now what, oh, what may the poor Goat eat?

Smooth Flatterers have done much wrong
For which the World is paying.
If none had praised the Donkey’s Song
He would not still be braying.

Small Ills are the Fountains
Of most of our Groans.
Men trip not on Mountains,
They stumble on Stones.

“My Beard is burning!” one will cry.
Another lights his Pipe thereby.

“My Wisdom aids the World!”— How sweet
That Secret Thought of Great and Small!
The Sea-gull sleeps with Upturned Feet
To catch the Sky when that shall fall.

I hurled the Missile: With Edge unstained
The Shard returned to its Parent Clay;
The Birds, all clamoring, whirred away;
The Sin of Seeking to Kill remained.

“O Allah, take me!” prayed Ram Chunder.
Above him crashed and rolled the thunder.
“Not now!” he cried in fright and sorrow.
“Not now O Lord! — I meant tomorrow!”

[^”Allah” changed to “Shiva” in second book!]

The Tiger came! She slew him
And dragged him from the House
And down the Drain she threw him; —
And yet, she fears a Mouse!

Avoid Suspicion: When you’re walking through
Your Neighbor’s Melon-patch, don’t tie your Shoe.

If You suspect him,
Then Reject him.
If you Select him,
Don’t Suspect him.

A Demon, sick of Single Life,
In Lanka wed a Monkey Wife;
And thence arose, by Heaven’s Grace
(Lal Das declares), the English Race.

“Who cooked this Rice?”
“Not I! — that Worthless Hound!”
“’Tis very nice.”
“Why—yes—I stirred it round!”

Ben Ali, Ram Chunder and Yussuf are tall,
But the Man with the Club is the Lord of them all.

A Queen are you and a Queen am I, —
But who will spread the Clothes to dry?

A Shower of Honey on a Sugar Shed
Is shamed by Speech of Lovers newly wed.

“O Allah,” prays the Cat in hungry Zeal,
“Send Blindness on my Lord, that I may steal!”
“O Allah,” prays the Dog, “endow with Meat
My Lord, who, being filled, shall bid me eat!”

Lal Mir’s Cat is grown too fat
To hunt her Prey and snatch it.
A Mouse she saw and waved her Paw
To bid her Master catch it.

“He has killed a Thousand Men!”
“Ah? he’s Half a Doctor, then.”

The Donkey turns a hungry Eye
Upon the Fields all bare and dry;
Then waxes fat, the Happy Ass,
To think he’s eaten all that Grass!

The Comb was the Bee’s,
But by Man it is eaten.
The Sin was the Flea’s,
But the Bedding is beaten.

I’ve found my Knife, but where are you, O Hound!
When I find you, my Knife can not be found!

[^ Occurs in some Subhashita collection: stone]

The Rains have come! The Rice-blades spring!
The Farmer cares not who is King!

The eager Fish
Repent within the Net.
Young Lovers wish,
And Married Men regret.

Death took him off
But cured his Cough.

My Love departs with Dawning Light,
Mine Eyes are dark with Sorrow.
I pray thee, Lord, make such a Night
That there shall be no Morrow!

The Farmer prays for Rain,
The Washerman for Sun.
If Prayers were not in vain,
The World would be undone.

These Letters Black are Seeds, the which my Pen
In Snow white Furrows diligently sows;
The Harvest shall be reaped by other Men,
But what shall be that Harvest, Heaven knows.

The donkey to the camel said,
“How dainty are your feet!”
The camel to the donkey said,
“Your voice is very sweet!”

[^ occurs somewhere: …aho rūpam…]

My lord, when called “My Lord!” will duly come.
‘Tis thus I keep “my lord” beneath my thumb.

At Men of Deeds are jealous slanders thrown,
As Stones are cast at Fruitful Trees alone.

Four things in Stubbornness all else surpass:
A Child, a King, a Woman and an Ass.

By diverse Yearnings torn and tried.
Poor Men grow ever thinner:
The Bridegroom longs to see the Bride,
The Guests to see the Dinner.

“Yes,” says the Man; “Yes,” says the Woman, too;
And what can Judge, or Priest, or Sultan do?

A Man may greet his Friends with honeyed Tongue,
And yet in Trade be hard and cold as Ice.
The Cat has Gentle Teeth to hold her Young,
But very Different Teeth for catching Mice.

They that challenge Danger, bring
On themselves disastrous Force:
Do not stand Before the King,
Do not stand Behind the Horse.

[^I’ve heard “ಅರಸನ ಮುಂದಿರಬೇಡ, ಕತ್ತೆಯ ಹಿಂದಿರಬೇಡ” butಗಾದೆ /ಗಾದೆಗಳು have “ಅರಮನೆಯ ಮುಂದಿರಬೇಡ, ಕುದರೆಯ ಹಿಂದಿರಬೇಡ”.]

The Bitter Gourd I planted where Sago Heaps had lain,
With Treacle-drops and Honey I drenched the Little Hill;
I trained the Leafy Tendrils on rods of Sugar Cane;
But when the Fruit had ripened, alas! ’twas Bitter still!

What Culprit fails to urge the Plea
That there are Others Worse than He?

Chips of Jade, or What They Say in China

Eight Sailors; Seven want to steer.
That Junk won’t come to Port, I fear.

Within the Home where fewer Servants dwell,
With greater Speed the Daily Work is done:
One Man will bring Two Buckets from the Well;
Two Men, between them both, will carry One.

The Starveling Cat maintains the Firm Belief
That every Well-fed Cat must be a Thief.

It somewhat soothes the Bankrupt’s woe
To talk of Debts that Others owe.

Two Friends have I — True Friends, I know;
But which a Deeper Love discloses?
This, brings me Coals in Winter’s Snow,
While That, in Summer, brings me Roses.

Though the Doctor is sure
As his Charges are high.
He whom Medicines cure
Was not Fated to Die.

If Right, though Right without a Flaw
Is _All_ you have, don’t go to Law.

Fear not lest Men say Evil Things of you.
But fear to do the Ill they say you do.

This One Makes a Net,
That One stands and wishes;
Would you like to bet
Which One gets the Fishes?

Words are Wind in Empty Space;
Writing leaves a Lasting Trace.

Defame a Man of Energy, and soon
The Mob will echo, mingling Truth and Lie.
Let one lone Mangy Mongrel bay the Moon,
And all the Village Curs will swell the Cry.

Still leagues on leagues the Great Wall stretches on,
But where has Shi Hwang-ti, who built it, gone?

Search thrice thy Heart and thrice thy Soul again;
Thus shalt thou know the Minds of Other Men.

In Talk he’s a Wonder,
But Small are his Gains.
How loud is the thunder!
How little it Rains!

The Petty Rascal’s Fetters clank;
The Wholesale Robber starts a Bank.

Shall I, grasping, gather Wealth and breed it —
For my Children jealously conserve it?
Should my Sons surpass me, they won’t need it;
Should they not, why then, they won’t deserve it.

The Boy may plan to fly his Kite,
The Man to cut his Hay;
But Old North Wind comes up at night
And blows their Plans away.

Recorded Words are Fetters;
When Angry, don’t write Letters.

You “Nearly Did it”? That’s your loss.
I’ll pay you just the Fare
Due him that rowed me half across
The Stream — and left me there!

The Heron sought to sup his fill
Upon the Clam, who caught his bill
And held him fast, till, nothing loath,
The Hungry Fisher bagged them Both.

Untrained is he that hath not seen
The World’s Rough Face in Sun and Shower,
That hath not shared the Fat and Lean,
That hath not tasted Sweet and Sour,
And known the Foul, but loved the Clean,
And felt the Thorn, yet plucked the Flower.

Fame is the Dew on the Jasmine Stalk,
Fame is the Scream of a passing Hawk,
Fame is the Foam of the Vessel’s Keel,
Fame is a dying Thunder Peal,
Fame is the Scent on the Mountain Moss
Left when the Musk Deer bounds across.

The Arrow’s on the String,
The supple Bow is bent;
My Hand must do that Thing
For which my Life was lent.

When, wrapped in Flame, your Home’s a blackened Shell,
‘Tis growing rather late to Dig a Well.

[^ I think this is in a subhashita collection too]

Your Acres teem with Rice; — but still
A Pint a Day is all you eat.
Your House is wide; the Space you fill
Therein is hardly Seven Feet.

[^ gośatādapi gokṣīraṃ prasthaṃ dhānyaśatādapi / prāsādepi ca khaṭvārdhaṃ śeṣāḥ paravibhūtayaḥ //!topic/sadaswada/yBw3u03Fqvw%5D

Her Fragrance proved by every Breeze that blows,
What need is there of Words to praise the Rose?

Fish see the Bait alone; and is it stranger
That Men should see the Profit, not the Danger?

Up, Farmer! Toil
While Dawn is hazy!
The Good Brown Soil
Is never lazy.

One Kind Word keeps the Heart aglow
Through Three Long Months of Ice and Snow.

When Drinking Water, bless the Parent Rill;
When Eating, thank the Plow that broke the Clod;
When Donning Garments, praise the Weaver’s Skill;
With every Breath He gives, remember God.

The Monkey jeers; such odd Mistakes
In Weaving Sticks, the Pigeon makes!
But while the Monkey has his Jest,
The Pigeon learns to Build a Nest.

A Word has stolen in and bred a Doubt;
Ten Thousand Oxen cannot drag it out.

Ride within or carry the Sedan,
What’s the difference? — Are you not a Man?

The Monastery near
The Nunnery is set;
There’s nothing wrong or queer
In that, of course — and yet —

Written by S

Wed, 2016-12-28 at 14:48:57

Posted in Uncategorized

A simple puzzle, with a foray into inequivalent expressions

leave a comment »

[Needs cleanup… just dumping here for now.]

Mark Jason Dominus tweeted and later blogged about this puzzle:

From the four numbers [6, 6, 5, 2], using only the binary operations [+, -, *, /], form the number 17.

When he tweeted the first time, I thought about it a little bit (while walking from my desk to the restroom or something like that), but forgot about it pretty soon and didn’t give it much further thought. When he posted again, I gave it another serious try, failed, and so gave up and wrote a computer program.

This is what I thought this time.


Any expression is formed as a binary tree. For example, 28 = 6 + (2 * (5 + 6)) is formed as this binary tree (TODO make a proper diagram with DOT or something):

               6       *
                     2    +
                        5   6

And 8 = (2 + 6) / (6 – 5) is this binary tree:

              +       -
            2   6   6   5

Alternatively, any expression is built up from the 4 given numbers [a, b, c, d] as follows:
Take any two of the numbers and perform any operation on them, and replace the two numbers with the result. Then repeat, until you have only one number, which is the final result.

Thus the above two expressions 28 = 6 + (2 * (5 + 6)) and 8 = (2 + 6) / (6 – 5) can be formed, respectively, as:

  1. Start with [6, 6, 5, 2]. Replace (5, 6) with 5+6=11 to get [6, 11, 2]. Replace (11, 2) with 11*2=22 to get [6, 22]. Replace (6, 22) with 6+22=28, and that’s your result.
  2. Start with [6, 6, 5, 2]. Replace (2, 6) with 2+6=8 to get [8, 6, 5]. Replace (6, 5) with 6-5=1 to get [8, 1]. Replace (8, 1) with 8/1=8 and that’s your result.

So my idea was to generate all possible such expressions out of [6, 6, 5, 2], and see if 17 was one of them. (I suspected it may be possible by doing divisions and going via non-integers, but couldn’t see how.)

(In hindsight it seems odd that my first attempt was to answer whether 17 could be generated, rather than how: I guess at this point, despite the author’s assurance that there are no underhanded tricks involved, I still wanted to test whether 17 could be generated in this usual way, if only to ensure that my understanding of the puzzle was correct.)

Read the rest of this entry »

Written by S

Wed, 2016-07-20 at 00:38:51

Posted in mathematics, unfinished

Multiple ways of understanding

leave a comment »

In his wonderful On Proof and Progress in Mathematics, Thurston begins his second section “How do people understand mathematics?” as follows:

This is a very hard question. Understanding is an individual and internal matter that is hard to be fully aware of, hard to understand and often hard to communicate. We can only touch on it lightly here.

People have very different ways of understanding particular pieces of mathematics. To illustrate this, it is best to take an example that practicing mathematicians understand in multiple ways, but that we see our students struggling with. The derivative of a function fits well. The derivative can be thought of as:

  1. Infinitesimal: the ratio of the infinitesimal change in the value of a function to the infinitesimal change in a function.
  2. Symbolic: the derivative of x^n is nx^{n-1}, the derivative of \sin(x) is \cos(x), the derivative of f \circ g is f' \circ g * g', etc.
  3. Logical: f'(x) = d if and only if for every \epsilon there is a \delta such that when 0 < |\Delta x| < \delta,

    \left|\frac{f(x+\Delta x) - f(x)}{\Delta x} - d\right| < \epsilon.

  4. Geometric: the derivative is the slope of a line tangent to the graph of the function, if the graph has a tangent.
  5. Rate: the instantaneous speed of f(t), when t is time.
  6. Approximation: The derivative of a function is the best linear approximation to the function near a point.
  7. Microscopic: The derivative of a function is the limit of what you get by looking at it under a microscope of higher and higher power.

This is a list of different ways of thinking about or conceiving of the derivative, rather than a list of different logical definitions. Unless great efforts are made to maintain the tone and flavor of the original human insights, the differences start to evaporate as soon as the mental concepts are translated into precise, formal and explicit definitions.

I can remember absorbing each of these concepts as something new and interesting, and spending a good deal of mental time and effort digesting and practicing with each, reconciling it with the others. I also remember coming back to revisit these different concepts later with added meaning and understanding.

The list continues; there is no reason for it ever to stop. A sample entry further down the list may help illustrate this. We may think we know all there is to say about a certain subject, but new insights are around the corner. Furthermore, one person’s clear mental image is another person’s intimidation:

  1. The derivative of a real-valued function f in a domain D is the Lagrangian section of the cotangent bundle T^{\ast}(D) that gives the connection form for the unique flat connection on the trivial \mathbf{R}-bundle D \times \mathbf{R} for which the graph of f is parallel.

These differences are not just a curiosity. Human thinking and understanding do not work on a single track, like a computer with a single central processing unit. Our brains and minds seem to be organized into a variety of separate, powerful facilities. These facilities work together loosely, “talking” to each other at high levels rather than at low levels of organization.

This has been extended on the MathOverflow question Different ways of thinking about the derivative where you can find even more ways of thinking about the derivative. (Two of the interesting pointers are to this discussion on the n-Category Café, and to the book Calculus Unlimited by Marsden and Weinstein, which does calculus using a “method of exhaustion” that does not involve limits. (Its definition of the derivative is also mentioned at the earlier link, as that notion of the derivative closest to [the idea of Eudoxus and Archimedes] of “the tangent line touches the curve, and in the space between the line and the curve, no other straight line can be interposed”, or “the line which touches the curve only once” — this counts as another important way of thinking about the derivative.)

It has also been best extended by Terence Tao, who in an October 2009 blog post on Grothendieck’s definition of a group gave several ways of thinking about a group:

In his wonderful article “On proof and progress in mathematics“, Bill Thurston describes (among many other topics) how one’s understanding of given concept in mathematics (such as that of the derivative) can be vastly enriched by viewing it simultaneously from many subtly different perspectives; in the case of the derivative, he gives seven standard such perspectives (infinitesimal, symbolic, logical, geometric, rate, approximation, microscopic) and then mentions a much later perspective in the sequence (as describing a flat connection for a graph).

One can of course do something similar for many other fundamental notions in mathematics. For instance, the notion of a group {G} can be thought of in a number of (closely related) ways, such as the following:

  1. Motivating examples: A group is an abstraction of the operations of addition/subtraction or multiplication/division in arithmetic or linear algebra, or of composition/inversion of transformations.
  2. Universal algebraic: A group is a set {G} with an identity element {e}, a unary inverse operation {\cdot^{-1}: G \rightarrow G}, and a binary multiplication operation {\cdot: G \times G \rightarrow G} obeying the relations (or axioms) {e \cdot x = x \cdot e = x}, {x \cdot x^{-1} = x^{-1} \cdot x = e}, {(x \cdot y) \cdot z = x \cdot (y \cdot z)} for all {x,y,z \in G}.
  3. Symmetric: A group is all the ways in which one can transform a space {V} to itself while preserving some object or structure {O} on this space.
  4. Representation theoretic: A group is identifiable with a collection of transformations on a space {V} which is closed under composition and inverse, and contains the identity transformation.
  5. Presentation theoretic: A group can be generated by a collection of generators subject to some number of relations.
  6. Topological: A group is the fundamental group {\pi_1(X)} of a connected topological space {X}.
  7. Dynamic: A group represents the passage of time (or of some other variable(s) of motion or action) on a (reversible) dynamical system.
  8. Category theoretic: A group is a category with one object, in which all morphisms have inverses.
  9. Quantum: A group is the classical limit {q \rightarrow 0} of a quantum group.

One can view a large part of group theory (and related subjects, such as representation theory) as exploring the interconnections between various of these perspectives. As one’s understanding of the subject matures, many of these formerly distinct perspectives slowly merge into a single unified perspective.

From a recent talk by Ezra Getzler, I learned a more sophisticated perspective on a group, somewhat analogous to Thurston’s example of a sophisticated perspective on a derivative (and coincidentally, flat connections play a central role in both):

  1. Sheaf theoretic: A group is identifiable with a (set-valued) sheaf on the category of simplicial complexes such that the morphisms associated to collapses of {d}-simplices are bijective for {d < 1} (and merely surjective for {d \leq 1}).

The rest of the post elaborates on this understanding.

Again in a Google Buzz post on Jun 9, 2010, Tao posted the following:

Bill Thurston’s “On proof and progress in mathematics” has many nice observations about the nature and practice of modern mathematics. One of them is that for any fundamental concept in mathematics, there is usually no “best” way to define or think about that concept, but instead there is often a family of interrelated and overlapping, but distinct, perspectives on that concept, each of which conveying its own useful intuition and generalisations; often, the combination of all of these perspectives is far greater than the sum of the parts. Thurston illustrates this with the concept of differentiation, to which he lists seven basic perspectives and one more advanced perspective, and hints at dozens more.

But even the most basic of mathematical concepts admit this multiplicity of interpretation and perspective. Consider for instance the operation of addition, that takes two numbers x and y and forms their sum x+y. There are many such ways to interpret this operation:

1. (Disjoint union) x+y is the “size” of the disjoint union X u Y of an object X of size x, and an object Y of size y. (Size is, of course, another concept with many different interpretations: cardinality, volume, mass, length, measure, etc.)

2. (Concatenation) x+y is the size of the object formed by concatenating an object X of size x with an object Y of size y (or by appending Y to X).

3. (Iteration) x+y is formed from x by incrementing it y times.

4. (Superposition) x+y is the “strength” of the superposition of a force (or field, intensity, etc.) of strength x with a force of strength y.

5. (Translation action) x+y is the translation of x by y.

5a. (Translation representation) x+y is the amount of translation or displacement incurred by composing a translation by x with a translation by y.

6. (Algebraic) + is a binary operation on numbers that give it the structure of an additive group (or monoid), with 0 being the additive identity and 1 being the generator of the natural numbers or integers.

7. (Logical) +, when combined with the other basic arithmetic operations, are a family of structures on numbers that obey a set of axioms such as the Peano axioms.

8. (Algorithmic) x+y is the output of the long addition algorithm that takes x and y as input.

9. etc.

These perspectives are all closely related to each other; this is why we are willing to give them all the common name of “addition”, and the common symbol of “+”. Nevertheless there are some slight differences between each perspective. For instance, addition of cardinals is based on perspective 1, while addition of ordinals is based on perspective 2. This distinction becomes apparent once one considers infinite cardinals or ordinals: for instance, in cardinal arithmetic, aleph_0 = 1+ aleph_0 = aleph_0 + 1 = aleph_0 + aleph_0, whereas in ordinal arithmetic, omega = 1+omega < omega+1 < omega + omega.

Transitioning from one perspective to another is often a necessary first conceptual step when the time comes to generalise the concept. As a child, addition of natural numbers is usually taught initially by using perspective 1 or 3, but to generalise to addition of integers, one must first switch to a perspective such as 4, 5, or 5a; similar conceptual shifts are needed when one then turns to addition of rationals, real numbers, complex numbers, residue classes, functions, matrices, elements of abstract additive groups, nonstandard number systems, etc. Eventually, one internalises all of the perspectives (and their inter-relationships) simultaneously, and then becomes comfortable with the addition concept in a very broad set of contexts; but it can be more of a struggle to do so when one has grasped only a subset of the possible ways of thinking about addition.

In many situations, the various perspectives of a concept are either completely equivalent to each other, or close enough to equivalent that one can safely “abuse notation” by identifying them together. But occasionally, one of the equivalences breaks down, and then it becomes useful to maintain a careful distinction between two perspectives that are almost, but not quite, compatible. Consider for instance the following ways of interpreting the operation of exponentiation x^y of two numbers x, y:

1. (Combinatorial) x^y is the number of ways to make y independent choices, each of which chooses from x alternatives.

2. (Set theoretic) x^y is the size of the space of functions from a set Y of size y to a set X of size x.

3. (Geometric) x^y is the volume (or measure) of a y-dimensional cube (or hypercube) whose sidelength is x.

4. (Iteration) x^y is the operation of starting at 1 and multiplying by x y times.

5. (Homomorphism) y → x^y is the continuous homomorphism from the domain of y (with the additive group structure) to the range of x^y (with the multiplicative structure) that maps 1 to x.

6. (Algebraic) ^ is the operation that obeys the laws of exponentiation in algebra.

7. (Log-exponential) x^y is exp( y log x ). (This raises the question of how to interpret exp and log, and again there are multiple perspectives for each…)

8. (Complex-analytic) Complex exponentiation is the analytic continuation of real exponentiation.

9. (Computational) x^y is whatever my calculator or computer outputs when it is asked to evaluate x^y.

10. etc.

Again, these interpretations are usually compatible with each other, but there are some key exceptions. For instance, the quantity 0^0 would be equal to zero [ed: I think this should be one —S] using some of these interpretations, but would be undefined in others. The quantity 4^{1/2} would be equal to 2 in some interpretations, be undefined in others, and be equal to the multivalued expression +-2 (or to depend on a choice of branch) in yet further interpretations. And quantities such as i^i are sufficiently problematic that it is usually best to try to avoid exponentiation of one arbitrary complex number by another arbitrary complex number unless one knows exactly what one is doing. In such situations, it is best not to think about a single, one-size-fits-all notion of a concept such as exponentiation, but instead be aware of the context one is in (e.g. is one raising a complex number to an integer power? A positive real to a complex power? A complex number to a fractional power? etc.) and to know which interpretations are most natural for that context, as this will help protect against making errors when manipulating expressions involving exponentiation.

It is also quite instructive to build one’s own list of interpretations for various basic concepts, analogously to those above (or Thurston’s example). Some good examples of concepts to try this on include “multiplication”, “integration”, “function”, “measure”, “solution”, “space”, “size”, “distance”, “curvature”, “number”, “convergence”, “probability” or “smoothness”. See also my blog post below in which the concept of a “group” is considered.

I plan to collect more such “different ways of thinking about the same (mathematical) thing” in this post, as I encounter them.

Written by S

Sat, 2016-03-26 at 10:05:09

Posted in mathematics, quotes

The Pandit (काशीविद्यासुधानिधिः)

with one comment

The Pandit (काशीविद्यासुधानिधिः)
A Monthly Journal, of the Benares College, devoted to Sanskrit Literature

This was a journal that ran from 1866 to 1920, and some issues are available online. “The Benares College” in its title is what was the first college in the city (established 1791), later renamed the Government Sanskrit College, Varanasi, and now the Sampurnanand Sanskrit University.

There are some interesting things in there. From a cursory look, it’s mainly editions of Sanskrit works (Kavya, Mimamsa, Sankhya, Nyaya, Vedanta, Vyakarana, etc.) and translations of some, along with the occasional harsh review of a recent work (printed anonymously of course), but also contains, among other things, (partial?) translations into Sanskrit of John Locke’s An Essay Concerning Human Understanding and Bishop Berkeley’s A Treatise Concerning the Principles of Human Knowledge. Also some hilarious (and quite valid) complaints about miscommunication between English Orientalists and traditional pandits, with their different education systems and different notions of what topics are simple and what are advanced.

The journal’s motto:

श्रीमद्विजयिनीदेवीपाठशालोदयोदितः । प्राच्यप्रतीच्यवाक्पूर्वापरपक्षद्वयान्वितः ॥
अङ्करश्मिः स्फुटयतु काशीविद्यासुधानिधिः । प्राचीनार्यजनप्रज्ञाविलासकुमुदोत्करान् ॥

The metadata is terrible: there’s only an index of sorts at the end of the whole volume; each issue of the journal carries no table of contents (or if it did, they have been ripped out when binding each (June to May) year’s issues into volumes). Authorship information is scarce. Some translations have been abandoned. (I arrived at this journal looking at Volume 9 where an English translation of Kedārabhaṭṭa’s Vṛtta-ratnākara is begun, carried into three chapters (published in alternate issues), left with a “to be continued” as usual, except there’s no mention of it in succeeding issues.) Still, a lot of interesting stuff in there.

Among the British contributors/editors of the journal were Ralph T. H. Griffith (who translated the Ramayana into English verse: there are advertisements for the translation in these volumes) and James R. Ballantyne (previously encountered as the author of Iṅglaṇḍīya-bhāṣā-vyākaraṇam a book on English grammar written in Sanskrit: he seems to have also been an ardent promoter of Christianity, but also an enthusiastic worker for more dialogue between the pandits and the Western scholars), each of whom served as the principal of the college. (Later principals of the college include Ganganath Jha and Gopinath Kaviraj.) Among the Indian contributors to the journal are Vitthala Shastri, who in 1852 appears to have written a Sanskrit commentary on Francis Bacon’s _Novum Organum,_ (I think it’s this, but see also the preface of this book for context) Bapudeva Sastri, and others: probably the contributors were all faculty of the college; consider the 1853 list of faculty here (Also note the relative salaries!)

Had previously encountered a mention of this magazine in this book (post).

The issues I could find—and I searched quite thoroughly I think—are below. Preferably, someone needs to download from Google Books and re-upload to the Internet Archive, as books on Google Books have an occasional tendency to disappear (or get locked US-only). 1866 Vol 1 (1 – 12) 1866 vol 1 (1 – 12) 1866 Vol 1 (1 – 12) 1866 vol 1-3 (1 – 36) 1867 Vol 2 (13 – 24) 1867 Vol 2 (13 – 24) 1867 Vol 2 (13 – 24) 1868 Vol 3 (25 – 36) 1868 Vol 3 (25 – 36) 1868 Vol 3 (25 – 36) 1869 vol 4 (37 – 48) 1869 Vol 4 (37 – 48) 1869 vol 4 (37 – 48) 1870 vol 5 (49 – 60) 1870 vol 5 (49 – 60) 1870 vol 5 (49 – 60) 1871 Vol 6 (61 – 72) 1871 vol 6 (61 – 72) 1871 vol 6 (61 – 72) 1872 Vol 7 (73 – 84) 1872 Vol 7 (73 – 84) 1872 vol 7 (73 – 84) 1873 vol 8 (85 – 96) 1874 vol 9 (97 – 108) 1874 vol 9 (97 – 108) 1875 Vol 10 (109 – 120) 1875 vol 10 (109 – 120)

[New series] 1876 vol 1 1877 vol 2 1877 vol 2 1877 vol 2 1879 vol 3 1879 vol 3 1882 Vol 4 1882 vol 4 1882 vol 4 1883 Vol 5 1883 Vol 5 1883 vol 5 1884 vol 6 1885 vol 7 1885 vol 7 1886 Vol 8 1887 vol 9 1888 Vol 10 1890 vol 12 1891 vol 13 1892 vol 14 1895 Vol 17 1895 vol 17 1896 Vol 18 1897 vol 19 1898 Vol 20 1899 Vol 21 1899 Vol 21 1900 Vol 22 1901 Vol 23 1902 Vol 24 1904 Vol 25 1905 Vol 27 1907 vol 29 1908 Vol 30 1908 Vol 30 1911 Vol 33 Snippet View 1912 Vol 34 Snippet View 1913 Vol 35 Snippet View 1916 Vol 38 Snippet View 1916 Vol 37 Snippet View

Written by S

Tue, 2016-03-15 at 14:18:00

Posted in sanskrit

The same in every country

leave a comment »

(TODO: Learn and elaborate more on their respective histories and goals.)

The formula
\frac{\pi}{4} = 1 - \frac13 + \frac15 - \frac17 + \frac19 - \frac1{11} + \dots
(reminded via this post), a special case at x=1 of
\arctan x = x - \frac{x}3 + \frac{x}5 - \frac{x}7 + \dots,

was found by Leibniz in 1673, while he was trying to find the area (“quadrature”) of a circle, and he had as prior work the ideas of Pascal on infinitesimal triangles, and that of Mercator on the area of the hyperbola y(1+x) = 1 with its infinite series for \log(1+x). This was Leibniz’s first big mathematical work, before his more general ideas on calculus.

Leibniz did not know that this series had already been discovered earlier in 1671 by the short-lived mathematician James Gregory in Scotland. Gregory too had encountered Mercator’s infinite series \log(1+x) = x - x^2/2 + x^3/3 + \dots, and was working on different goals: he was trying to invert logarithmic and trigonometric functions.

Neither of them knew that the series had already been found two centuries earlier by Mādhava (1340–1425) in India (as known through the quotations of Nīlakaṇṭha c.1500), working in a completely different mathematical culture whose goals and practices were very different. The logarithm function doesn’t seem to have been known, let alone an infinite series for it, though a calculus of finite differences for interpolation for trigonometric functions seems to have been ahead of Europe by centuries (starting all the way back with Āryabhaṭa in c. 500 and more clearly stated by Bhāskara II in 1150). Using a different approach (based on the arc of a circle) and geometric series and sums-of-powers, Mādhava (or the mathematicians of the Kerala tradition) arrived at the same formula.

[The above is based on The Discovery of the Series Formula for π by Leibniz, Gregory and Nilakantha by Ranjay Roy (1991).]

This startling universality of mathematics across different cultures is what David Mumford remarks on, in Why I am a Platonist:

As Littlewood said to Hardy, the Greek mathematicians spoke a language modern mathematicians can understand, they were not clever schoolboys but were “fellows of a different college”. They were working and thinking the same way as Hardy and Littlewood. There is nothing whatsoever that needs to be adjusted to compensate for their living in a different time and place, in a different culture, with a different language and education from us. We are all understanding the same abstract mathematical set of ideas and seeing the same relationships.

The same thought was also expressed by Mean Girls:

Written by S

Tue, 2016-03-15 at 13:53:32

Posted in history, mathematics

The generating function for Smirnov words (or: time until k consecutive results are the same)

leave a comment »

1. Alphabet

Suppose we have an alphabet {\mathcal{A}} of size {m}. Its generating function (using the variable {z} to mark length) is simply {A(z) = mz}, as {\mathcal{A}} contains {m} elements of length {1} each.

2. Words

Let {\mathcal{W}} denote the class of all words over the alphabet {\mathcal{A}}. There are many ways to find the generating function {W(z)} for {\mathcal{W}}.


We have

\displaystyle \mathcal{W} = \{\epsilon\} + \mathcal{A} + \mathcal{A}\mathcal{A} + \mathcal{A}\mathcal{A}\mathcal{A} + \dots

so its generating function is

\displaystyle \begin{aligned} W(z) &= 1 + A(z) + A(z)^2 + A(z)^3 + \dots \\ &= 1 + mz + (mz)^2 + (mz)^3 + \dots \\ &= \frac{1}{1-mz} \end{aligned}


To put it differently, in the symbolic framework, we have {\mathcal{W} = \textsc{Seq}(\mathcal{A})}, so the generating function for {\mathcal{W}} is

\displaystyle W(z) = \frac{1}{1 - A(z)} = \frac{1}{1-mz}.


We could have arrived at this with direct counting: the number of words of length {n} is {W_n = m^n} as there are {m} choices for each of the {n} letters, so the generating function is

\displaystyle W(z) = \sum_{n \ge 0}W_n z^n = \sum_{n \ge 0} m^n z^n = \frac{1}{1-mz}.

3. Smirnov words

Next, let {\mathcal{S}} denote the class of Smirnov words over the alphabet {\mathcal{A}}, defined as words in which no two consecutive letters are identical. (That is, words {w_1w_2 \dots w_n} in which {w_i \in \mathcal{A}} for all {i}, and {w_i \neq w_{i-1}} for any {1 < i \le n}.) Again, we can find the generating function for {\mathcal{S}} in different ways.


For any word in {\mathcal{W}}, by “collapsing” all runs of each letter, we get a Smirnov word. To put it differently, any word in {\mathcal{W}} can be obtained from a Smirnov word {w} by “expanding” each letter {w_i} into a nonempty sequence of that letter. This observation (see Analytic Combinatorics, pp. 204–205) lets us relate the generating functions of {\mathcal{W}} and {\mathcal{S}} as

\displaystyle W(z) = S(\frac{z}{1-z})

which implicitly gives the generating function {S(z)}: we have

\displaystyle S(z) = W(\frac{z}{1+z}) = \frac{1}{1-m\frac{z}{1+z}} = \frac{1+z}{1 - (m-1)z}.


Alternatively, consider in an arbitrary word the first occurrence of a pair of repeated letters. Either this doesn’t happen at all (the word is a Smirnov word), or else, if it happens at position {i} so that {w_i = w_{i+1}}, then the part of the word up to position {i} is a nonempty Smirnov word, the letter at position {i+1} is the same as the previous letter, and everything after {i+1} is an arbitrary word. This gives

\displaystyle \mathcal{W} = \mathcal{S} + (\mathcal{S} \setminus \{ \epsilon \}) \cdot \mathcal{Z} \cdot \mathcal{W}

or in terms of generating functions

\displaystyle W(z) = S(z) + (S(z) - 1)zW(z)


\displaystyle S(z) = \frac{W(z) (1 + z)}{1 + zW(z)} = \frac{1 + z}{(1-mz)(1 + \frac{z}{1-mz})} = \frac{1+z}{1 - (m-1)z}


A minor variant is to again pick an arbitrary word and consider its first pair of repeated letters, happening (if it does) at positions {i} and {i+1}, but this time consider the prefix up to {i -1}: either it is empty, or the pair of letters is different from the last letter of the prefix, giving us the decomposition

\displaystyle \mathcal{W} = \mathcal{S} + m\mathcal{Z}^2 \cdot \mathcal{W} + (\mathcal{S}\setminus \{ \epsilon \}) \cdot (m-1)\mathcal{Z}^2 \mathcal{W}

and corresponding generating function

\displaystyle W(z) = S(z) + mz^2W(z) + (S(z) - 1)(m-1)z^2W(z)


\displaystyle S(z) = \frac{W(z)(1-z^2)}{1 + (m-1)z^2W(z)} = \frac{1-z^2}{1 - mz + (m-1)z^2} = \frac{(1-z)(1+z)}{(1-z)(1 - (m-1)z)}

which is the same as before after we cancel the {(1-z)} factors.


We could have arrived at this result with direct counting. For {n \ge 1}, for a Smirnov word of length {n}, we have {m} choices for the first letter, and for each of the other {(n-1)} letters, as they must not be the same as the previous letter, we have {(m-1)} choices. This gives the number of Smirnov words of length {n} as {m (m-1)^{n-1}} for {n \ge 1}, and so the generating function for Smirnov words is

\displaystyle S(z) = 1 + \sum_{n \ge 1} m (m-1)^{n-1} z^n = 1 + mz \sum_{n \ge 1} (m-1)^{n-1}z^{n-1} = 1 + \frac{mz}{1-(m-1)z}

again giving

\displaystyle S(z) = \frac{1 + z}{1 - (m-1)z}

4. Words with bounded runs

We can now generalize. Let {\mathcal{S}_k} denote the class of words in which no letter occurs more than {k} times consecutively. ({\mathcal{S} = \mathcal{S}_1}.) We can find the generating function for {\mathcal{S}_k}.


To get a word in {\mathcal{S}} we can take a Smirnov word and replace each letter with a nonempty sequence of up to {k} occurrences of that letter. This gives:

\displaystyle S_k(z) = S(z + z^2 + \dots + z^k) = S(z\frac{1-z^{k}}{1-z})


\displaystyle S_k(z) = \frac{1 + z\frac{1-z^{k}}{1-z}}{1 - (m-1)z\frac{1-z^{k}}{1-z}} = \frac{1 - z^{k+1}}{1 - mz + (m-1)z^{k+1}}.


Pick any arbitrary word, and consider its first occurrence of a run of {k+1} letters. Either such a run does not exist (which means the word we picked is in {\mathcal{S}_k}), or it occurs right at the beginning ({m} possibilities, one for each letter in the alphabet), or, if it occurs starting at position {i > 1}, then the part of the word up to position {i-1} (the “prefix”) is a nonempty Smirnov word, positions {i} to {i+k} are {k+1} occurrences of any of the {m-1} letters other than the last letter of the prefix, and what follows is an arbitrary word. This gives

\displaystyle \mathcal{W} = \mathcal{S}_k + m\mathcal{Z}^{k+1} \cdot \mathcal{W} + (\mathcal{S}_k \setminus \{ \epsilon \}) \cdot (m-1)\mathcal{Z}^{k+1} \cdot \mathcal{W}

or in terms of generating functions

\displaystyle W(z) = S_k(z) + mz^{k+1}W(z) + (S_k(z) - 1)(m-1)z^{k+1}W(z)


\displaystyle W(z)(1 - z^{k+1}) = S_k(z) (1 + (m-1)z^{k+1} W(z))


\displaystyle S_k(z) = \frac{W(z)(1-z^{k+1})}{1 + (m-1)z^{k+1}W(z)} = \frac{1-z^{k+1}}{1-mz + (m-1)z^{k+1}}


Arriving at this via direct counting seems hard.

5. Words that stop at a long run

Now consider words in which we “stop” as soon we see {k} consecutive identical letters. Let the class of such words be denoted {\mathcal{U}} (not writing {\mathcal{U}_k} to keep the notation simple). As before, we can find its generating function in multiple ways.


We get any word in {\mathcal{U}} by either immediately seeing a run of length {k} and stopping, or by starting with a nonempty prefix in {\mathcal{S}_{k-1}}, and then stopping with a run of {k} identical letters different from the last letter of the prefix. Thus we have

\displaystyle \mathcal{U} = m \mathcal{Z}^k + (\mathcal{S}_{k-1} \setminus \{\epsilon\}) \cdot (m-1)\mathcal{Z}^k


\displaystyle U(z) = m z^k + (S_{k-1}(z) - 1) (m-1) z^k

which gives

\displaystyle U(z) = z^k(1 + (m-1)S_{k-1}(z)) = z^k\left(1+(m-1)\frac{1-z^k}{1-mz+(m-1)z^k}\right) = \frac{m(1-z)z^k}{1 - mz + (m-1)z^k}


Alternatively, we can decompose any word by looking for its first run of {k} identical letters. Either it doesn’t occur at all (the word we picked is in {\mathcal{S}_{k-1}}, or the part of the word until the end of the run belongs to {\mathcal{U}} and the rest is an arbitrary word, so

\displaystyle \mathcal{W} = \mathcal{S}_{k-1} + \mathcal{U} \cdot \mathcal{W}


\displaystyle W(z) = S_{k-1}(z) + U(z) W(z)


\displaystyle U(z) = 1 - \frac{S_{k-1}(z)}{W(z)} = 1 - \frac{(1-z^k)(1-mz)}{1-mz + (m-1)z^k} = \frac{m(1-z)z^k}{1 - mz + (m-1)z^k}

6. Probability

Finally we arrive at the motivation: suppose we keep appending a random letter from the alphabet, until we encounter the same letter {k} times consecutively. What can we say about the length {X} of the word thus generated? As all sequences of letters are equally likely, the probability of seeing any string of length {n} is {\frac{1}{m^n}}. So in the above generating function {U(z) = \sum_{n} U_n z^n}, the probability of our word having length {n} is {U_n / m^n}, and the probability generating function {P(z)} is therefore {\sum_{n} U_n z^n / m^n}. This {P(z)} can be got by replacing {z} with {z/m} in the expression for {U(z)}: we have

\displaystyle P(z) = U(z/m) = \frac{(m-z)z^k}{m^k(1-z) + (m-1)z^k}

In principle, this probability generating function tells us everything about the distribution of the length of the word. For example, its expected length is

\displaystyle \mathop{E}[X] = P'(1) = \frac{m^k - 1}{m - 1}

(See this question on Quora for other powerful ways of finding this expected value directly.)

We can also find its variance, as

\displaystyle \mathop{Var}[X] = P''(1) + P'(1) - P'(1)^2 = \frac{m^{2k} - (2k-1)(m-1)m^k - m}{(m-1)^2}

This variance is really too large to be useful, so what we would really like, is the shape of the distribution… to be continued.

Written by S

Sun, 2016-01-03 at 03:06:23

Posted in mathematics

Converting a data URL (aka data URI) to an image on the commandline (Mac OS X)

leave a comment »

This is trivial, but was awfully hard to find via Google Search. Eventually had to give up and actually think about it. :-)

So, a data-URI looks something like the following:

data:image/png;base64,[and a stream of base64 characters here]

The part after the comma is literally the contents of the file (image or whatever), encoded in base64, so all you need to do is run base64 --decode on that part.

For example, with the whole data URL copied to the clipboard, I can do:

pbpaste | sed -e 's#data:image/png;base64,##' | base64 --decode > out.png

to get it into a png file.

Written by S

Sun, 2015-09-27 at 19:58:17

Posted in compknow