Chandasutram
Chandasutram
Algorithms
A Focus on reigniting Bharatiya thought on Binary system
Of the various gifts the hindus gave the world, the knowledge of ganit
(mathematics ) is supreme. They gave the concept of Sunya (zero), the decimal system (base 10),
sexadecimal (base 60) system. The Binary system, which forms the basis of computation and
calculation in computers seems to be the superlative discovery of modern mathematics. It is
astonishing to find the Binary system in the Vedanga of Chandas so clearly given by Maharishi
Maharishi Pingala. As with any ancient Vedic knowledge, the Binary system has been hidden in
the Chandasutram. The hindus unique method is of using Sanskrit aksharas (alphabets) for
writing numbers left to right, with the place value increasing to the right. These are read in the
reverse order from right to left – ‘Ankanam vamato gatih’. The binary numbers are also written in
the same manner as decimal numbers and read from right to left. We present the relevant sutras
from Maharishi Pingala’s Chandasutram. The algorithms are written as sutras. The algorithms are
recursive in nature, a very high concept in modern computer programming language. We fix the
date of this Vedanga based on the date of the Vedas. The life period of Maharishi is thus
dependent on the period of the Vedas. For this we take the internal evidence of astronomy in the
Vedas to get its date.
The Vedangas are for the proper study and interpretation of the
Vedas. The six vedangas are 1. Shiksha ( phonetics), 2. Kalpa (ritual), 3.
Vyakarana (grammar), 4. Nirukta (etymology), 5. Chandas (meter), 6. Jyotisha
( astronomy).
Of these Chandas is for the study of Vedic meter. This gives the
very important algebraic Vedic Science of encoding and metrics. This is the
Patha (foot) of the Vedas. This gives the cryptic astronomical, algebraical,
geometrical and the method of Vedic interpretation. This has been in use in
Tamil language grammar Tholkappiam. The science of metrics in Tamil is
named as Yappilakanam. Almost all the technical terms of Chandasutram
have similar word meaning in Tamil.
Vedas are in different Chandas (meters). One meaning of Chandas is that it is knowledge
which is to be guarded in secret and propagated with care. The Vedas are also described as
chandas. The whole of Sama Veda consists of chandas. There is word in Tamil referring tamil
language as Chandahtamil. Of the six vedangas Chandashastra forms a part essential to
understand the Vedas. These Chandas have been studied in great detail.
The sutras are a wonder of Sanskrit literature. There is no other language in this world
which has anything like the Sutras. Many technicalities are used throughout these sutras. In
translations from a rich and comprehensive language to a poor and ill-equipped tongue, it is
extremely difficult to bring out the force, the dignity, the sweetness, the majesty and the flow of
the original language. The translators, however learned they may be and however brilliant their
intelligence may be, have to remember the great gulf which separates their intelligence with that
of the great Maharishi Pingala who is their original author.
At best the translator can only explain and illustrate what he understands and conceives to
be the meaning of the original author. It may be the correct interpretation of the author or what
may have been understood to be the meaning by the translator. In the case of the works of the
Maharishis, I may not be very wrong if I say that none of the commentators or the translators
could ever hope to come up to their standard. However, a man can do at best what he honestly
knows to be the meaning; and I can assure that in the translation of these difficult sutras I have
taken the greatest care to bring out the correct meaning of Maharishi Pingala in his inimitable
work Chandasastra.
Everyone cannot compose a sutra. A sutra, to be a sound one, must have certain
characteristic features and unless these conditions are satisfied they cannot pass muster under the
heading of a sutra. In English, so far as my humble knowledge and practical experience go, it
looks impossible to frame a sutra as the Maharishis have composed and conceived it. The defects
of languages cannot be set right by ordinary men, and it is hopeless to make such attempts.
Maharishi Pingala, through his great love for the people, framed these sutras and they
have to be interpreted on certain principles which the Maharishis have laid down for our
guidance. The brevity of a sutra is its distinguishing feature, and it can easily be committed to
memory even by the ordinary students. Somehow or other, Sanskrit language seems to have a
close affinity to strengthen and improve memory.
Have we ever seen a Professor or Lecturer who is able to repeat a few sections of any
book of his branch of learning? Is there any English knowing person who can repeat a play of
Shakespeare or a few pages of any dictionary?
In Sanskrit, Dasopanishads are easily committed to memory. There are Dwivedis and
Thrivedis who easily commit to memory one, two and three Vedas and repeat them with an ease
which surprises the listeners. There are Chaturvedis who have commited to memory all the the
four Vedas. There are many who have committed to memory the Sanskrit lexicon "Amara" and
quote its stanzas offhand with the greatest ease. Bhagavata, Ramayana, Maha Bharata and other
extensive works are easily committed to memory. Kavyas and Natakas. Epics and Dramas form
no exception. Astrological literature, whether it be stronomical calculation or astrological
Phalabhaga has been committed to memory.
The discussion of the learned Pandits is a source of great delight to the audience. They
bring neither books, nor notes, nor papers, nor any references when they come for great
assemblies where their knowledge in the several branches of Sanskrit will be tested and where
they receive due rewards. The greatest Hindu Pandit has hardly anything which deserves the
name of a library, whereas the poorest equipped English reader keeps up a decent library. Are not
then the heads of these Pandits more valuable than the heads of the greatest English scholars who
have to refer to books for constant renewal of their memories ?
Sutra should :
Contain Alpaksharam – minimum number of words
Be Asamdigdham – Unabiguous
Contain Sravat – gist of the topic for which it is meant
Be Vishvatomukham – universally valid or be general
Not have Astobham – unmeaningful words
Anavadyam – be devoid of any fault
Like mathematical formulae, Sutras have a great deal of information in very few words.
Sutras are very easy to commit to memory. To verbally communicate the algorithms they are a
unique way to put it in sutras (aphorisms).
Evolution of Chandas can be inferred from the following Mundayoka Upanishad (I 1,5)
The study of Vedas (Rig, Yajur, Sama, Atharvana) and Vedangas (Siksha, Kalpa,
Vyakaranam, Niruktam, Chandas and Jyotisam) is mentioned. Thus Chandas
(Metrics) is a Vedanga.
The date of Maharishi Pingala Chandsutram can be based on date of Vedas. The date of
Vedas varies from 8000 BCE to 3500 BCE depending upon astronomical notings, approximate
time period of composition of Vedas, as per Max Muller (not on evidences but on his own
assumptions). The common assigned date for Pingala Chadasutram is around 200 BCE. This
raises a question as to why Vedic seers should take 7800 or 3300 years to formulate
Chadasastram. Since the Vedas are already there in metric form, it stands to reason that these
rules of chandas should have been first codified and based on these rules, hymns should have
been developed. So the age of Maharishi Pingala should be placed not at 200 BCE but much
earlier along with age of the Vedas. Such highly refined literature with astronomical data and
information could not have been produced by a hoard of barbarians or wandering nomads as has
been recorded by present day learned archaeologists and historians. No scholar can ignore a
subject just because it is beyond his comprehension. Just by making it that their methodology is
scientific, mathematical evidences cannot be ignored. Just because nobody has interpreted the
Chandasutram in the lines of binary system, it does not mean that this is not there. Since the
sutras are very abstruse and short it takes a lot of effort to decipher and interpret them.
The following algorithms are for the binary system in Pingala Chandasutram.
Chandasutram by Maharishi Pingala contains 18 parichchedas (Sub-chapters) in 8
Adhyayas (main chapters). The 1st parichcheda of six slokas are not sutras. The rest of
Chandasutram is composed of sutras.
In this Maharishi Pingala states that “Maa, Ya, Raa, Sa, Taa, Ja, Bhaa, Na, La, Ga”
mentioned in the fourth sloka is in itself a sutra, containing ten varnas and specifies that the same
is kept on the top of all sutras because it is the basis for “chando varga padartas and pratyayas”.
Three technical terms are given here Viramam, Matra, Pratyaya. The term pratyaya indicates vast
and remarkable meaning. The astonishing wonderful intelligence of Maharishi Pingala is imbibed
in various Pratyayas. In fact, the Pratyayas is a collection of extraordinarily ingenious and clever
solutions to problems.
The 2nd paricheda gives the pratyahara sutras (general rules). The application of these
sutras are universal throughout Chandasutram. If an exception is there, it will be given with it’s
range of applicability.
Thus to find the index of the sequence GGGLLG, split it in 3 letter sequence as
GGG 0 0 0 1 maa
LLG 1 1 0 4 sa
And this is read using ‘ankanam vamato gatih’ - in reverse gives 41 as the index of GGGLLG
with the code word ma sa or 1 4. Using this ma and sa coin a word name of the chandas. The
reverse process of this gives the sequence for 4 1. The total sequence need not be in multiples of
3. The single or two aksharas at end of grouping is completed using the la (1) and ga (0). This
method is the same as the current katapayadi sankya (number) assigned to the melakarta ragas of
karnatic music, but in another decimal form. Note that, this is the mirror image of the current
Boolean binary representation. A wonderful error-correcting code is given in this. Error-
correcting code is a sequence that contains encoded information designed to flag errors in
transmission. Each important aspect of a chandas is encoded in the Vedic hymn. Here the rhythm
of the hymn and the name of the chandas provide a check on each other.
The 8th Adhyaya gives the following 16 sutras which relate to the Pingala Pratyaya system
1. Prastarah - Algorithms to produce all possible combinations of n binary digits,
8.20 dvikau glau
8.21 misrau ca
8.22 pruthagla mishrah
8.23 vasavastrik
2. Nashtam - Algorithms to recover the missing row,
8.24 l-arddhe
8.25 sa-eke-ga
1. Algorithm : Prastarah means spreading or expanding. Pingala gives the matrix which
n
shows all the possible combinations of n laghu-guru. There are 2 possible combinations of n
n
digit binary number. This will result in 2 * n matrix of all the possible combinations. Pingala
gives a recursive algorithm.
G 0
L 1
8.21 misrau ca
The prastara of 2 akshara (binary digits) is got by mixing 1 akshara prastara with itself.
We mix G-L with G and then mix G-L with L. The result is a prasthara of 22 * 2
Pingala Boolean
GG 00 00
LG 10 01
GL 01 10
LL 11 11
The current Boolean notation is the mirror image of this matrix with all 2 digit numbers
in ascending order. In Pingala notation the high bits are written to the right of the previous bit.
This is same as writing decimal numbers in ancient days. The decimal numbers are written with
highest place to the right of a previously written digit. But the reading of the numbers is from
right to left as per the dictum ‘Ankanam vamato gatih’
Pingala Boolean
GGG 000 000
LGG 100 001
GLG 010 010
LLG 110 011
GGL 001 100
LGL 101 101
GLL 011 110
LLL 111 111
Thus these sutras give the size of the prastara of triak or 3 bits based the on the previous 3 sutras.
8.23 vasavastriak
This process is to be repeated for higher order prastara. To get all the combinations of 4
akshara, we should know the combinations of 3 akshara, for which 2 akshara combination
is necessary and this is got from 1 akshara combination.
Pingala Boolean
GGGG 0000 0000
LGGG 1000 0001
GLGG 0100 0010
LLGG 1100 0011
GGLG 0010 0100
LGLG 1010 0101
GLLG 0110 0110
LLLG 111 0 0111
GGGL 0001 1000
LGGL 1001 1001
GLGL 0101 1010
LLGL 1101 1011
GGLL 0011 1100
LGLL 1011 1101
GLLL 0111 1110
LLLL 1111 1111
Thus Maharishi Pingala’s algorithm follows naturally from the observation that the list of (n-1)
syllable patterns is twice nested within the list of n-syllable patterns. The computer scientist
Donald E.Knuth credits this as ‘the first ever explicit algorithm for combinatorial sequence
generation’ meaning Maharishi Pingala was the first to develop a process for systematically
listing patters with a given property. Maharishi Pingala’s algorithm is recursive – it generates the
entire list of n-syllable patterns from the list of (n – 1) syllable patterns. So a list of patterns of
any given length can be generated using the same routine. This includes a final stage 1 syllable
which is enumerated.
[The Art of Computer Programming, Vol. 4, Fasc 4. Addison Wesley, Upper Saddle River, N.J,
2006. Generating all trees – history of combinatorial generation]
2. Algorithm : Nashtam
8.24 l-arddhe
8.25 sa-eke-ga
These two sutras are to recover the nasht (lost or corrupted row).
Given a row index this is used to get guru-laghu combination or the binary combination.
pratilomagunam dvih-l-adyam – In the reverse starting from the l-adyam (first laghu)
multiply by dvih ( 2 ).
The 8.27 sutra is to be reconstructed as anuvritti. The word dvih is not there in this, but has to be
taken from the sutra 8.26. The start is always 1 and we start from a L.
1 x 2 = 2 this is L so multiply by 2
2 x 2 = 4 this is G So subtract 1 = 3
3 x 2 = 6 this is G So subtract 1 = 5
To get the decimal value of a number in any base, these set of rules can be used.
4. Algorithm : Sankhya
’Sankhya’ stands for the number of possible combinations of n bits. Here Pingala gives a method
which appears to be strange and complicated, but is based on a very ingenious method of
simplification of the purva or power or exponent. This results in the reduction of number of
operations needed for calculating sankhya.
For example
211 = 210 x 2 = (25 ) 2 x 2 = (24 x 2 ) 2 x 2 = [(22) 2 x 2 ] 2 x 2
The form requires just 3 multiplication by the same number ie squaring and 2 multiplications by
the number, here in this case 2. In Vedic mathematics Ganita Sutras the method of squaring any
number of digit numbers is given as straight squaring. And this simplifies to find the binary of the
exponent and using it to know when to raise to power 2 (square) or multiply by 2.
Example
16 2 (Even, divide by 2 and write 2)
8 2 (Even, divide by 2 and write 2)
4 2 (Even, divide by 2 and write 2)
2 2 (Even, divide by 2 and write 2)
1
0 0 ( Odd, subtract 1 and write 0)
This algorithm for calculating nth power of 2 is a recursive algorithm and its complexity is
O(log2n), whereas the complexity of calculating power by normal multiplication is O(n).
5. Algorithm : Adhvayoga
This sutra gives the adhvayoga of all the chandas (adhva) with
number of syllables less than or equal to n.
To get adhvayoga, multiply the last one (tat antanam) by 2 (dvih) and then
subtract once 2 (ekone dvah). That is
The sutra 8.34 means “complete it using the two far ends pare’
Start with 1 in a cell. Under this cell draw two cells. Then fill all the cells which are at the far
ends, in each row by 1. Meru is constructed like this:
1
1 1
1 2 1
1 3 3 1
1 4 4 1
1 5 5 1
1 6 6 1
1 7 7 1
1 8 8 1
The next sutra 8.35 says to complete a cell using above 2 cells, filling again the end cells.
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 1 1 5 1
0 0
1 6 1 1 6 1
5 5
1 7 2 2 7 1
1 1
1 8 2 2 8 1
8 8
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 1 1 5 1
0 0
1 6 1 2 1 6 1
5 0 5
1 7 2 3 3 2 7 1
1 5 5 1
1 8 2 5 7 5 2 8 1
8 6 0 6 8
[To contact the author of this article use e-mail id: [email protected] or visit web-site:
http://www.vedicmaths-institute.com]