The "kaTapayaadi" scheme applied to Melakarta Ragas

The "ka-Ta-pa-ya" scheme
and its application to
mELAkarta raagas of Carnatic music

The ka-Ta-pa-ya scheme:
The "ka-Ta-pa-ya" rule used by ancient Indian mathematicians and grammarians
is a tool to map names to numbers. Writing the consonants of the Sanskrit 
alphabet as four groups with "ka, Ta, pa, ya" as the beginning letters of
the groups we get 

		1   2   3  4   5   6   7   8  9    0
		ka kha ga gha ~ma cha Cha ja jha ~na
		Ta Tha Da Dha  Na ta  tha da dha  na
		pa pha ba bha  ma
		ya ra  la va   Sa sha sa  ha

Now, each letter of the group is numbered from 1 through 9 and 0 for the tenth
letter. Thus, ka is 1, sa is 7, ma is 5, na is 0 and so on. So to indicate 
the number 356 for example one would try and come up with a word involving
the third, fifth and sixth letters of the groups like "gaNitam" or "lESaca".
However, in the Indian tradition, the digits of a number are written left to 
right in the increasing order of their place value - exactly opposite the way 
we are used to writing in the western way. Therefore 356 would be indicated 
using letters in the 6th, 5th, and 3rd positions of the group e.g. "triSUlaM".

There apparently were upto 4 flavors of this scheme in use in ancient
India. These differ in how to interpret the conjoint consonant. The popular
scheme was to use only the last consonant. And any consonant not attached
to a vowel is to be disregarded. These rules should be used while decoding
a phrase in "katapayadi" scheme.

The following phrase found in "sadratnamAla" a treatise on astronomy,
       bhadram budhi siddha janma gaNita Sraddha@h mayadbhUpagi@h
when decoded yields
       4 2 3 9 7 8 5 3 5 6 2 9 5 1 4 1 3
which when reversed gives
       3 1 4 1 5 9 2 6 5 3 5 8 7 9 3 2 4
which is readily recognised as the digits in "pi" (except that the 17th
digit is wrong - it should be 3) :-)!

(source: The article "The Katapayadi Formula and Modern Hashing Technique"
by Anand V Raman, appearing in "Computing Science in Ancient India", edited
by T.R.N.Rao and Subhash Kak, published by the Center for Advanced Computer
Studies, University of South Western Louisiana, Louisiana LA 70504)
mELakarta raagas:
The raagas of Carnatic music are said to be derived from a definite set of
72 ragas known as mELakarta or janaka or sampoorNa raagas.

Before we go any further let me remind you that in an octave there are 12
tones each separated by a half note. These 12 tones are named as the 7 notes
and variations on some of those 7 notes. These names and their western music
equivalents are as follows:

    1. shaDjamam              S      Doh   C

    2. Suddha rishabham       R1           C# or Db 
                                        (read as C-sharp or D-flat)

    3. chatuSruti rishabham   R2           
       Suddha gAndhAram       G1     Re    D

    4. shaTSruti rishabham    R3
       sAdhAraNa gAndhAram    G2           D# or Eb

    5. antara gAndhAram       G3     Me    E

    6. Suddha madhyamam       M1     Fa    F

    7. prati madhyamam        M2           F# or Gb

    8. pancamam               P      Sol   G

    9. Suddha dhaivatam       D1           G# or Ab

   10. chatuSruti dhaivatam   D2
       Suddha nishaadam       N1     La    A

   11. shaTSruti dhaivatam    D3
       kaiSika nishaadam      N2           A# or Bb

   12. kAkali nishaadam       N3     Ti    B

The properties of the janaka raagas are :
a) they contain all the 7 notes of an octave (hence the name saMpoorNa)
   exactly once in the scale.
b) the tones of the notes must all be in ascending order in the 
   aarOhaNa. i.e You cannot pick S, R3, G1 ... because the tone of R3
   is higher than the tone of G1. Also the ArOhaNa/avarOhaNa cannot have 
   jumps back and forth like S, G3, R1, ... or S, N2, P, D1 ... etc..
c) the avarOhaNa should contain the same notes as ArOhaNa in the reverse

Given these properties/rules, we can easily surmise that there cannot be 
more than 72 sampoorNa raagas. Because of the need for ascending order of 
tones the permissible combinations of R,G and D,N are limited to 6 each, viz. 
R1G1, R1G2, R1G3, R2G2, R2G3, R3G3 and D1N1, D1N2, D1N3, D2N2, D2N3, D3N3.
There are two varieties of M viz. M1, M2. So the number of possible different
sampoorNa raagas is 6 x 6 x 2 = 72. So if these 72 are arranged in a regular
order, we can figure out the scale of a janaka raaga if its number in the
list is given. Now, from our "kaTapayaadi" scheme if we can name the raaga
in such a way that the name yields the number, then we have further reduced
the memorising!

Application of "kaTapayaadi" to mELakarta raagas
That is exactly what venkaTamakhi of the 18th century is purported to have done. 
He applied the "kaTapaya" scheme to name the janaka raagas to fit their place 
in the mELakarta list. Some of these already had suitable names and some had 
unsuitable names that were in common use. He changed those names a little to 
fit the naming scheme. Thus "kalyANi" becomes "mEcha kalyANi","SankarAbharaNam" 
becomes "dheera SankarAbharaNam" etc.

Under this naming scheme, the number of a janaka raaga is obtained by decoding 
the first two letters using the "kaTapaya" scheme. For the naming scheme used
for the mELakarta raagas, apart from the decoding rules mentioned above for,
conjoint consonants, in case one of the consonants is from the 'ya' group, 
the first consonant is to be considered instead of the last. And finally, 
to get back to our familiar western notation, reverse the decoded digits.

For example:
"kharaharapriya" : kha = 2 and ra = 2 i.e 22 reversing the digits : 22
"shaNmukhapriya" : sha = 6 and mu = 5 i.e 65 reversing the digits : 56
"naThabhairavi"  : na = 0 and Tha = 2 i.e 02 reversing the digits : 20
"divyamaNi"      : di = 8 and  va = 4 i.e 84 reversing the digits : 48

Once you get the number, figuring out the notes is easy. The 72 raagas are
arranged such that the first 36 raagas contain M1 and the next 36 contain M2. 
In each half, the various possible combinations of R,G and D,N 
occur cyclically with the R,Gs varying slower than the D,Ns. 
i.e: for the first six raagas 
     R1G1 occurs with each of D1N1, D1N2, D1N3, D2N2, D2N3, D3N3
     for the next six raagas 
     R1G2 occurs with each of D1N1, D1N2, D1N3, D2N2, D2N3, D3N3
and so on.

So given a janaka raaga number you perform the following calculation:
1. if NUM is from 1-36, raaga has M1, from 37-72 raaga has M2.
2. if NUM is greater than 36 subtract 36 from it.
3. divide NUM by 6; 
   a. if remainder=0
      i. the sixth D,N combination occurs.
     ii. the quotient gives which of the R,G combinations occurs.
   b. if remainder is not zero
      i. the remainder gives which of the D,N combinations occurs.
     ii. the quotient+1 gives which of the R,G combinations occurs.

Taking the example of "shaNmukhapriya":
	From the "kaTapaya" rule its number is 56.
	56 is greater than 36. So      M2 occurs.
	20 divided by 6 : quotient=3, remainder=2
	so 3+1=4th RG combination :    R2G2 occurs.
	and 2nd DN combination :       D1N2 occurs.
So shaNmukhapriya has the notes: 
	S R2 G2 M2 P D1 N2 S

Another example : "varuNapriya"
	From the "kaTapaya" rule its number is 24.
	24 is less than 36. So         M1 occurs.
	24 divided by 6 : quotient=4, remainder=0
	so 4th R,G combination:        R2G2 occurs.
	and 6th D,N combination:       D3N3 occurs.
thus varuNapriya has the notes: 
	S R2 G2 M1 P D3 N3 S