computational thinking in the indic...

45
Computational Thinking in the Indic Tradition K Gopinath IISc

Upload: phamngoc

Post on 06-Mar-2018

219 views

Category:

Documents


3 download

TRANSCRIPT

Computational Thinking in the IndicTradition

K GopinathIISc

Note

● Some of the photos or images are taken from sources on the web.

● I ack. specifically here:– Trivedi, Visual Computer 1989 (for the temple images)

● Other images – Chand Baori (stepwell), Abhaneri, Rajasthan

● Author: Doron, September 2003

– Kandaariya mandir (Khajuraho): ASI monument number N-MP-15 ● Author:Kanika.mishra, 12 April 2015

– Maadhava shloka● Authors: K Ramasubrahmanyam, MD Srinivas

– Melakartas ● Author:Basavarajtalwar, 4 November 2009

● Others inlined

● Happy to ack. any that have been missed!

Motivation● A “computational perspective” on enquiry

– Mathematics/astronomy obvious

– Other areas of enquiry show substantial influence eg.● (generative) linguistics● music (raga “simplistically” a generative system over an

alphabet with certain rules)● architecture (space-filling curves, “fractals”, composition,

juxtaposition)● poetry (chandas, codes, binary notation)● rasa theory (“state transition” models?)

“Computation ≈ Enquiry” an “Indic meme”?● दृग्गणिणितैक्य drg.ganitaikya, the concordance between “observed”

and the “computed”. Also, models useful but only contingent.– Much earlier, Vrddha Garga (pre700 BCE?) saysदर््शर्शन ं गणिणितं चैव युगपद् योगसाधकम् | (Observation and calculation when theygo together is effective).

● Bhaaskara

(1114–1185)

from Karnataka

● Emphasized also in

Kerala school of

Mathematics

CS Two fundamental aspects

● develop techniques that make the elucidation of the computational structure ofnature and the mind easier.

● create new computing algorithms and machines that have powerful cognitive andcomputational abilities: this includes development of new techniques ofrepresenting and manipulating knowledge, inference and deduction.

Considered also by

● Grammarians

● Logicians

However, some contemporary developments in formal logic, linguistics, andcomputer science a rediscovery of the work of these masters.

● Qn of a correct history of ideas

● Qn of significance to Sanskritists as well as cognitive and computer scientists:Are there other rules in ancient Indian logic and grammar that may be of use inmaking further advance in cognitive and computer sciences? [Bhate & Kak]

– Grammar ~ computation!

Composition/Iteration/Recursion● Recursive nature of number system understood at least 2 millennia back

– एदश... = ए + द*10 + श*100... = ए + 10*(द + 10*(श+…))– A number’s value is computable based on “subnumbers” within it

– Hence, mult/div algs developed then as we do them now

– Not avlbl in Greek/European system till Fibonacci introduced about 1200 CE from Indic sources

● Recursive nature of Sanskrit grammar much earlier (eg. Paanini)

● Numerical iteration– Taitt. 1, 100, …, 10^20

– Buddhist counting: Lalitavistaara (koti 10^7… tallakshana 10^53)

– Jaina exampl: vargita-samvargita

● More interesting: iteration on algebraic forms!– Jaina example: composition of exponentiation for fast growing functions

– Brahmagupta: composition of algebraic forms

– Bakshali: composition of algbraic formula for faster convergence: “telescoping”

– Convergent series for pi: iteration over algebraic structures for faster convergence

Invention of zero?

● Often Indians are said to have invented zero

● Poor way of explaining the actual contrib

● 1st stage: number concept (one, two, …)

● 2nd stage: notation: | || ||| etc.

● 3rd stage: use of a base – Egypt: symbols for 1, 10, 100, 1000, 10000, …

● 123: (100) (10) (10) (1) (1) (1)

– Greeks: To reduce many repeats, special symbols for 5, 50, 500, ...:

– Romans: added subtractive principle: 9 = 10-1, 40=50-10, …

– Ionians, Arabs, Hebrews: map numbers (1..9, 10, 20, 30, ...) to alphabet

● 4th stage: China: 6705 => 6 (1000) 7(100) 5 (1) (abacus friendly)– Need special cases…

● 5th stage: India: 6705!– Mayan civ. had bases 20, 360! instead of 20, 400, ...

● मनुष्य 1१● मन ुषग ंध्वर्व 100 १००● दवेग ंधवर्व 10000 १०^४● िपितृ 10^6 १०^६

● आजानज दवे 10^8 १०^८

● कर््मर्व दवे 10^10 १०^१०

Happines levels: त ैत्तरीय ● देव 10^12 १०^१२● इन्द्र 10^14१०^१४● बृहस्पतिति 10^16 १०^१६● प्रजापतिति 10^18 १०^१८● (2^64=9223372036854775808)

Approx 9*10^18. For a 64bmachine,OVERFLOW here!

● ब्रह्म 10^20 १०^२०

Jainas...● Vargita-samvargita (vs): Let x^x be x`

– (x`)` = (x^x)^(x^x). Example for x=2:

– First vs: 2` = 2^2 = 4

– 2nd vs: (2`)` = 4^4 = 2^8 = 256

– 3rd vs: ((2`)`)` = (2^8) ^ (2^8) = 256 ^ 256● 617 digits! Needs around 2048+ bits!

– 4th ? (((2`)`)`)` = ? approx. 10^260 digits!

– Jaganya-pariita-asamkyhaata

– Primitive recursive function (can be written using doloops with fixedbounds) but extremely fast growing

● Knuth (‘76): a||b = a^(a^(a^(a^(a^…)) b times;– a|||b = a||(a||(a||…)) b times; similarly a||||b, etc. Primitive recursive!

● Ackerman’s function (1928)– First known non-primitive recursive function

– Cannot be realized with do loops

The Two A’s of Computational Thinking(from J. Wing'06)

● Abstraction– C.T. operates in terms of multiple layers of abstraction

simultaneously

– C.T. defines the relationships the between layers

● Automation– C.T. thinking: mechanizing abstraction layers and their

relationships

– Mechanization: due to precise & exacting notations and models

– some “machine” below (human or computer, virtual or physical)

● Computational Thinking– Abstraction, Mechanization, Recursion & Bootstrapping

● They give us the ability and audacity to scale.

● Interestingly, many of these handled in our tradition

Algorithmic Thinking

● Considerable tradition in India in ``algorithmic''thinking, so can see many elements of an informal``programming'' style written in cryptic Sanskrit.Examples– Multiplication, div, sqroot, ...

– kuttaka

– chakravala

– solutions of a knight's tour on 4x8 board given by VedantaDesikan (13th c.) in ``Paaduka Sahasram''

● Backtracking algs?

● ``From the system of nine heavens [marked] with ninefigures [God] cast the Indian numerals onto the earthboard'' – Nizami(?-1203 CE) Persia

● pati-ganita (arithmetic; ``board-computations'' for thedust board, or sandbox: perms/combinations, quadraticeqns, summing series) vs

● bija-ganita (algebra; ``seed-computations'' for themanipulation of equations involving an unknown or bija:solving eqns up to 2nd order in 1+ unknowns, andindeterminate eqns of 1st and 2nd degree.) (from Ency. Brit.)

● Multiplication in India:– ``Precursor'' to a Turing Machine?

Multiplication● Align “lsb” of one (B:b1b2) with the

“msb” of the other (A:a1a2a3)): b2 with a1

● Multiply B and a1

– Can rub a1 out!

– Carry? Extend to left & add!

● Shift B right

● Multiply B and a2

– Carry? Add to prev existing

– A2 also gone

● Shift B right

● Multiply B and a3

– a3 also gone but now result avlbl

Division/Sqroot● Division considered simple and just assumed

by Aaryabhata and other great mathematiciansof that time– In Europe division alg only about 10 centuries later

based on the Indian methods

● Square roots use a “division” like method– Odd places: varga, even places: avarga

– Cube roots too!Always divide the non-square (even) place bytwice the square root[already found]. Havingsubtracted the square[of the quotient] fromthe square (odd) place,the quotient gives the[digit in the] next placein the square root

(Aryabhata’s Root Extraction MethodsAbhishek Parakh)

History of Generative Linguistics• Only started around 1920's in the West

– Most forcefully by Chomsky in '50s

• Also directly inspired by Sanskrit– Earlier western linguists due to their ignorance critiqued Paanini

as being arcane, not realizing that a complete grammar of asophisticated language needs many rules to capture it ascomplete as possible.

– “We can now assert, with the power of hindsight, that Indian linguists in the fifth century B.C. knewand understood more than Western linguists in the nineteenth century A.D. Can one not extendthis conclusion and claim that it is probable that Indian linguists are still ahead of their Westerncolleagues and may continue to be so in the next century? Quite possible; all we can say is that itis difficult to detect something that we have not already discovered ourselves.” Frits Staal

• With CS, this aspect becoming clear.– The very success of Asthadhyayi suggests that aspects of its

structure will have implications for further advance in computerscience, knowledge representation, and linguistics. [Bhate & Kak]

Some terms...

● भावना (composition)

● प ुनःकरणम् (iteration)

● प ुनर््वर्वर््तर्तनम् (recursion)

● साधारणीकरणम् (generalization)

● अन ुवृत्त्तित्ति (factoring)

● प्रस्तार (enumeration)

● नष्टम् उद्द्दिद्दिष्टान्क Lookup and Indexing

● न ेतिति नेित नेित (Diagonalization?)

Sqroot and approxs in IndicTradition

● Possibly geometric methods (in Sulbasutra)

● Number theoretic and algorithmic methods ofcomposition and recursion (bhaavanaa andchakravaala)

● Iteration on algebraic forms– Bakshali

– Approx to pi

Sqroot(2) by श ूल्बकार (बौधायन, ...)

1.4142157 computed value with this approx1.4142136 the actual value

● Connection with Vedic altars

● Seidenberg

Generalization of sqroot problem● Solve N*y*y+1=x*x

– If N*y*y much larger than 1, then with an integer/rational solutionfor x, y, sqroot(N) = x/y

● For example for sqroot(2): 2*y*y+1=x*x● say x betw 100 & 1000 for a desired accuracy● sqroot(2) = 1.4142135623730951

– 2*2*2+1=3*3. Hence, 1st simple (non-)solution 3/2 (=1.5)

– Use composition (next slide!) to get

– 2*12*12+1=17*17. Hence 2nd (non-)solution 17/12 (=1.41666…)

– Iterate one more time: 2*408*408+1=577*577.● 3rd solution 577/408 (= 1.4142156862745099)● Error about 2 parts in million

● Continued fraction form for sqrt(2): 1+1/2,1+1/(2+1/(2+1/2)), 1+1/(2+1/(2+1/(2+1/(2+1/2))))

Composition and Recursion

● Composition: Brahmagupta’s “bhaavanaa”– Compose 2 algebraic forms to produce another

– Brahmagupta's identity: (x12-N*y12)(x2

2-N*y22) =

(x1x2+Ny1y2)2-N(x1y2+x2y1)2

● Chakravaala: a recursive procedure based onbhaavanaa to solve N*y*y + 1 = x*x startingwith simpler N*y*y+z=x*x

CALCULATING pi

Claims of using “octagon-doubling” or “hexagon-doubling”seem a bit doubtful as thecomputation is unstable

– pi ~ (2**k)*side

– k increases and side decreasesrapidly

function pisqrt(n)

a=1.0

for i in 1:n

a = (1.0/a)*(sqrt(a*a + 1.0) - 1.0)

end

return (2^(n+1))*a*2

NEED BETTER METHODS!

julia> pisqrt(8)

3.141602510241972

julia> pisqrt(9)

3.1415951177183654

julia> pisqrt(10)

3.1415932696317452

julia> pisqrt(11)

3.1415928083796847

julia> pisqrt(12)

3.141592690962969

julia> pisqrt(13)

3.141592675570453

julia> pisqrt(14)

3.1415926909629683

Recitation

vakya, pada, krama,jata, mala, sikha, rekha,dhvaja, danda, ratha,ghana

● संहिहित● वाक● पद● क्रम: 12, 23, 34,...● जट: 122112, 233223,

344334,...

● माल● िशिख● रखे● ध्वज● दंड● रथ● घन: 1221123321123,

2332234432234,...

● Also क्रममाल and पुष्पमाल– 2(n-1) errors correctable in

4n symbols

Codes or Vikratis● Kashyap/Bell formulate Krama-maala as a rate 1/4 linear

block code over a finite Galois field

– why these specific codes?

● Req

– Preserve order of words

● Errors to be detected:

– Add/delete of a syllable/word in a word/sentence

– Avoid “long jumps” ● A (in verse x) similar to B (in verse y) ;● Consider chanting of ...AC... ; ...BD...● Problem: during chanting mistakenly ...AD... or ...BC...● Handled by codes such as avichakra ratha (Kashyap)

RV 1.1.1. ... C ratnadhatamam (A)

– RV 1.20.1 ... E ratnadhatamah (B) D

– Chanting st A chained to C and B to E to prevent jump from C to B and E to A

Chand Baori (Rajasthan)

Kandaariya Mahadev

Melakarta scheme with Katapayaadinaming, indexing, lookup!

● यमाताराजभानसलगाम ्01110100 01

● Earliest known de Bruijn(1946) seq (a “memorywheel”): sequence ofletters drawn from somealphabet such that everycombination of n lettersoccurs exactly once if weallow wraparound (0 laghu1 guru)

de Bruijn seqs

K.Trivedi: Hindu Temples: Models of aFractal Universe, Visual Computer (’89)

Dineshkannambadi

“fractalization”

Conclusions...

● A computational perspective helps understandIndic tradition in many disciplines…– A “meme”?

● Without this, it seems to be just a jumble of“tricks” as described by those outside thetradition.

Sanskrit World● “The extent and diversity of literature produced in Sanskrit, the long

temporal span of its use, and the breadth of the use of the languagethroughout the Indian subcontinent and Southeast Asia areunparalleled. Indeed, extant literature in Sanskrit constitutes thelargest body of literature in the world prior to the invention of theprinting press”

– Scharf/Heyman, “Linguistic Issues in Encoding Sanskrit”, 2012● “Extant manuscripts in Sanskrit number over 30 million - one hundred

times those in Greek and Latin combined - constituting the largestcultural heritage that any civilization has produced prior to theinvention of the printing press.” Pawan Goyal, Gérard Huet, Amba Kulkarni, PeterScharf, Ralph Bunker, COLING 2012

● 30M manuscripts extant compared to 1/2M of Greek/Latin– David Pingree’s estimate; 10M-20M estimate more common

● Much of Sanskrit literature is non-religious● Indic system was the most productive economic system till 1000CE

when it was disrupted; same with S&T● Indic science and mathematics needs to be properly assessed and

made better known...