4 ms·
A popular mnemonic for remembering the formulae of the basic units of Sanskrit metre is probably the first ever recorded example of De Bruijn Sequence. The phra
by yantrams 6y ago
A popular mnemonic for remembering the formulae of the basic units of Sanskrit metre is probably the first ever recorded example of De Bruijn Sequence. The phrase "Ya-Maa-Taa-Raa-Ja-Bhaa-Na-Sa-La-Gam" encodes all 8 possible combinations of syllables of length 3.
The basic unit of Sanskrit metre is called Gana and is composed of 3 syllables. Since a syllable can be either short (I) or long (U), we have 2^3 = 8 Ganas in total corresponding to UUU, UUI, UIU etc. To know the composition of a specific Gana say for example Ja Gana, one has to find the index of "Ja" in the aforementioned phrase and extract the next two syllables as well so Ja Gana equals Ja-Bhaa-Na => IUI (because Ja is short, Bhaa is long and Na is short again).
Code in Python if my explanation wasn't clear
mnemonic = "Ya-Maa-Taa-Raa-Ja-Bhaa-Na-Sa-La-Gaam"
def symbol(syllable):
if syllable.count("a") == 1:
return "I"
else:
return "U"
def ganaSymbol(ganaName):
mnerray = mnemonic.split("-")
ganaIndex = mnerray.index(ganaName)
return "".join([symbol(syllable) for syllable in mnerray[ganaIndex : ganaIndex + 3]])
Metres are then defined in terms of Ganas and the number of lines in a stanza, for example Utpala Mala metre can be defined simply as Na-Ja-Bhaa-Ja-Ja-Ja-Raa, 4 which means a stanza in that meter should comprise of 4 lines, with each line having 21 syllables corresponding to Na-Ja-Bhaa-Ja-Ja-Ja-Raa sequence
utpalaMala = "Na-Ja-Bhaa-Ja-Ja-Ja-Raa"
def printMetre(metreGanas, numLines):
print("\n".join(["".join([ganaSymbol(ganaName) for ganaName in metreGanas.split("-")])]*numLines))
Edits: Formatting
- mangamadaiyan 6y agoFunnily enough, I learned of this mnemonic from TAOCP (I think; too lazy to go check now).
- yantrams 6y agoInteresting to know that. I've heard the books on Combinatorics in TAOCP are super fun with many interesting mathematical nuggets. About time I get a copy of those volumes.