Coding Schemes in Ancient India, by Vibhor Rastogi and Sumit Sanghai

Since the time of Panini, Indian mathematicians have used letters of the Devanagari script to represent numbers. Pingala used an octal coding scheme to represent the meter of a Sanskrit verse, and it played an important role in the transfer of Vedic knowledge from one generation to another. Later, coding schemes were developed by Indian astronomers to encode complex numbers which they encountered in their daily research. One such system, called the Katapayadi, was used in India during the ninth century C.E.

Katapayadi

In the Katapayadi scheme, each consonant belonging to the Devanagari script is mapped to a digit in the decimal system (0-9).

1 2 3 4 5 6 7 8 9 0

k Ka ga Ga { ca C ja Ja Wa

X Y R Z Na ta Ta d Da na

pa P ba Ba ma

ya r la va Sa \a sa h

The table above shows that k X pa ya all map to 1, and hence the name Katapayadi. Each digit corresponds to a group of letters and any of them can be used to represent that digit. To obtain a number from a Sanskrit word, all vowels are ignored and if two or more consonants occur successively (e.g. ) ), then only the last constant (in this case r ) is considered.

Each Sanskrit word now corresponds to a unique number in the decimal system. For example, the word m::Dava represents 594. However, Indian mathematicians used the reverse decimal system (i.e., the first digit is least significant), and thus the word corresponds to the number 495.

Encoding complex numbers

Since, vowels do not count as any digit, they can be inserted anywhere in a word without affecting the encoded number. Thus, the system is very flexible and complicated numbers can be represented through meaningful Sanskrit words and verses that are easy to memorize. Consider the following Sanskrit verse devised by Indian mathematicians around the 10th century C.E.: Bhadrambuddhi siddha JanMaganita Shraddha Mayadbhupagi

It represents the number 314159265358979324 (again in the reverse decimal system) which form the first 17 digits of pi. The origin of Katapayadi is unknown. The oldest text that uses the scheme is Grahacaranibandhana, which was written in 683 C.E. Variants of this scheme were also known to Aryabhatta and Bhaskara, and Katapayadi was used extensively by south Indian mathematicians such as Madhava.

For example, the following verse was constructed in Kerala around the 15th century C.E.: Vidvams Tunnabalah Kavlsanicayah Sarvarthasllasthiro Nirviddhanganarendraru (The wise ruler whose army has been struck down gathers the best of advisers and remains firm in his conduct; then he shatters the king whose army has not been destroyed).The verse represents five numbers: 44, 3306, 160514, etc., which encode expressions in base-60. For example, 160514 represents 16/60 + 05/(60)^2 + 41/(60)^3. These expressions were used by the Indian mathematicians to compute trigonometric functions such as sine, using expansions equivalent to modern Taylor series.

The elegance of the Katapayadi scheme lies in its simplicity and malleability which enabled the mathematicians to come up with meaningful and memorizable verses to represent any number.

Melakarta Ragas in Carnatic Music

The Katapayadi system was also used in the 18th century to aid in the memorization of the notes of Melakarta ragas in Carnatic Music. Each raga consists of 7 swaras, i.e., notes (from Sa to Ni). The notes Sa and Pa are fixed and occur in all the ragas. The notes Re, Ga can be chosen from a set of 4 frequencies (6 possible combinations), similarly Dha, Ni. The note Ma can be either shuddha (pure) or prati (higher frequency). These variations account for a total of 6 x 6 x 2 = 72 ragas. These ragas are listed in a table such that the first 36 ragas use the shuddha Ma and the last 36 use the prati Ma. All other notes of a raga are identical to the notes of the raaga 36 places above/below it. Furthermore, each half of the table is divided into 6 sections. In each section, the notes Re. Ga are fixed to one of the 6 combinations, and the notes Dha, Ni vary over the 6 possible combinations.

Now, given a raga’s serial number in the table, notes can be obtained easily. For example, we know that the 5th raga contains the shuddha Ma. Also, it used the 1st combination of Re, Ga and the 5th combination of Dha, Ni. Thus, if one could construct the number corresponding to the raga given its name, one would know all the notes belonging to the raga. This is where our Indian musicians ingeniously used the flexible Katapayadi scheme. Each raga was named such that the number obtained from its first two syllables, according to the Katapayadi scheme, was the raga’s serial number. Thus, notes can be constructed just from the name instead of having to search them in a table. For example, the Manavati raga gives the number 05 (na, ma) from which the musical notes can be derived as above.

Sources: (i) The Ancient Katapayadi Scheme and the Modern Hashing Method, Anand Raman.(ii) Indian Binary Numbers and the Katapayadi Notation, Subhash Kak.

Vibhor Rastogi (vibhor@cs.washington.edu) and Sumit Sanghai (sumit.sanghai@gmail.com) are PhD students in the Computer Science Department at the University of Washington.

Email This Post Email This Post

 

Leave a Reply