भारत · ग्रहगणित
स्थान उज्जयिनी Ujjayinī · change it on a tool⌕ search the कोश ⌘Kप्रहर — · —:—:—ours, from sunriseउज्जयिनी —:—:—UTC + λ/15 h, λ = 75.7682° E (D13)IST Error −26.9 minlocal mean time − IST = 4λ − 330 min (K12)engine 3f94072the site ↗

yantra/patha/spanda-ganita.js

स्पन्द-गणित: the Sūrya-Siddhānta's Sun and Moon, and every limb of the pañcāṅga, EXACT on the

250 lines · 0 exports

लेख · the header

The header, as the file states it

spanda-ganita.js — स्पन्द-गणित: the Sūrya-Siddhānta's Sun and Moon, and every limb of the pañcāṅga, EXACT on the spanda lattice, with time counted in spandas of the star-wheel's turn. Time. SS 1.11-1.12: sixty nāḍīs are one turn of the star-wheel; 1.34-1.37: in a yuga the wheel turns 1,582,237,828 times while 1,577,917,828 civil days pass. So days ÷ yuga-days = turns ÷ yuga-turns, and a body's mean place is frac(R·(1811/4 + τ/1,582,237,828)) with τ the turns since the Kali epoch — time IS the turn. τ is counted here in spandas of the turn: 656,100,000,000 to a turn (30⁸ = 2⁸·3⁸·5⁸; owner D1/D1a, the pure turn clock D1c), a BigInt. Space. The circle is the same lattice: N = 656,100,000,000 arc-spandas; 1′ = 30,375,000, 1″ = 506,250. Every limb is an exact integer partition of N (the owner's council, 2026-09-28): tithi N/30 = 21,870,000,000 (= 2 ghaṭīs of the turn = a muhūrta = 30⁷), karaṇa N/60 = 10,935,000,000 (= 1 ghaṭī), nakṣatra and yoga N/27 = 24,300,000,000, pāda N/108 = 6,075,000,000 (= 200 prāṇas). 108 = 4 × 27 = 9 × 12 joins nakṣatra and rāśi; N is divisible by 108² = 11,664 but not by 108³. The true place is rational at every step of the text: the mean place from integers (1.53-1.54, 1.57-1.58); the sine by the 24-entry table and linear interpolation (2.17-2.22, 2.31-2.32); the epicycle varying with it (2.38); the arc by inverse interpolation (2.33); the sign by the kendra (2.45). So the places here are exact fractions, and the end of a limb is the FIRST spanda of the turn at which the place reaches the cell's edge, found by integer bisection — exact, with nothing rounded. SS 4.7 defines the end of amāvāsyā as Sun and Moon equal "in sign, degree, minute and so on"; 4.8 reaches it by repeated correction, which `parvaByIteration` also does and which lands on the same spanda. This is the text's own model computed without error; how close the model is to the sky is a separate question. Two sines (withSine): "madhava" (the default since 2026-10-07) is Mādhava's sine (Kerala, 14th c.), as Nīlakaṇṭha's school records it in Kaṭapayādi words (katapayadi.test.js decodes and checks every one): radius 3437′44″48‴, and Rsin x = x − (x/q)³[c₁ − (x/q)²[c₂ − (x/q)²[c₃ − (x/q)²[c₄ − (x/q)² c₅]]]] with q = 5400′ and c₁ … c₅ = nirviddhāṅganarendraruṅ 2220′39″40‴, sarvārthaśīlasthira 273′57″47‴, kavīśanicaya 16′05″41‴, tunnabala 33″06‴, vidvān 44‴. It is a polynomial with rational coefficients, so it stays exact. Its arc (the inverse) is not a Mādhava rule: here it is the first arc-spanda whose Mādhava sine reaches the value, by integer bisection. "table" is the SS table above, the text as written. The epicycles, the paridhi rule 2.38 and the sign rule 2.45 are the text's in both. True daily motion (SS 2.47-2.49): the motion of the kendra × the tabular sine-difference ÷ 225 × the epicycle ÷ 360, added from Karka, subtracted from Makara. Within a 225′ step the tabular difference ÷ 225 IS the derivative of the table's interpolated sine [theorem]; the rule leaves out only the epicycle's own variation (2.38) and the slope of the arc (2.33), so the 4.8 iteration with it is nearly Newton's method on the text's own model. `gati` computes it; parvaByIteration uses it when asked ({ rate: "text" }). Mādhava's quadrant is exact to the third: 5400′ − c₁ + c₂ − c₃ + c₄ − c₅ = 12,375,888‴ = 3437′44″48‴, his radius [theorem; tested]. Browser: window.SpandaGanita (needs Sphuta); node: module.exports.
आवश्यक · requires

What it loads

required by
निर्यात · exports

What it exports

पाठ · the verses it cites

SS verses named in the header

  • SS 1.11verse
    prāṇādiḥ kathito mūrtastruṭyādyo amūrtasaṃjñakaḥ । ṣaḍbhiḥ prāṇairvināḍī syāttatṣaṣṭyā nāḍikā smṛtā ।।
  • SS 4.7verse
    tulyau rāśyādibhiḥ syātāṃ amāvāsyāntakālikau । sūryendū paurṇamāsyante bhārdhe bhāgādikau samau ।।
  • SS 2.47verse
    svamandabhuktisaṃśuddhā madhyabhuktirniśāpateḥ । dorjyāntarādikaṃ kṛtvā bhuktāvṛṇadhanaṃ bhavet ।।
नलिका · channels

The channels it runs in

not on a channel
कार्य · the functions

Every function, what it calls, who calls it

34 top-level functions read from the source; the doc line is the comment above each; calls and callers are resolved across the registry’s modules by name. Line numbers are the file’s at engine 3f94072.

gcd(a, b)lines 56–56

── exact rationals [n, d], d > 0 ─────────────────────────────────────────────────────────────

calls nothing in the registry
called by build, Q
add(a, b)lines 58–58exported
calls Q
called by build, jyaQ, arcQ, places, argOf, past, gati
sub(a, b)lines 59–59exported
mul(a, b)lines 60–60exported
div(a, b)lines 61–61exported
cmp(a, b)lines 62–62exported
calls nothing in the registry
floor(a)lines 63–63exported
calls nothing in the registry
modQ(a, m)lines 64–64
calls floor, div, Q, sub
called by build, mandaQ, places, argOf, past, gati
toNum(a)lines 65–65exported
calls nothing in the registry
called by nothing in the registry
meanArcmin(rev, tau, westward)lines 69–74exported

frac(R·(1811/4 + τ/(RISINGS·SPT))) × 21600, exact.

calls Q
called by build, places, gati
sunApogeeArcmin(tau)lines 76–81exported

The Sun's apogee: 387 turns in a kalpa (1.41), with 1,955,880,000 years gone at the Kali epoch (1.47).

calls Q
called by build, places, gati
jyaQ(m)lines 86–90exported

2.31-2.32: R-sine of an arc of 0…5400′.

calls floor, div, Q, add, mul, sub
called by build
arcQ(y)lines 92–95exported

2.33: arc in minutes of an R-sine 0…3438.

calls cmp, Q, add, div, mul, sub
called by build
madhavaRaw(m)lines 102–108

Rsin of an arc m (arcminutes, rational, 0…5400) by Mādhava's polynomial; returned unreduced (num, den > 0).

calls nothing in the registry
madhavaJya(m)lines 109–109exported
calls Q, madhavaRaw
called by nothing in the registry
madhavaArc(y)lines 115–120exported
calls cmp, madhavaRaw, Q
called by build
bhujaQ(kendra)lines 124–127

The bhuja (0…5400′) of an arc in arcminutes, 2.29-2.30.

calls floor, sub, Q
called by build, mandaQ, gati
mandaQ(mean, mandocca, pair)lines 129–135exported

2.29-2.45 for the Sun or Moon: the manda equation in arcminutes, signed.

calls modQ, sub, bhujaQ, Q, div, mul, floor
called by build, places
places(tau)lines 137–142exported

True Sun and Moon (arcminutes, exact) at τ spandas of the turn.

toSp(a)lines 147–147

Arc in arcminutes → arc-spandas (exact rational).

calls mul, Q
called by build, limbs
argOf(kind, p)lines 148–152
calls modQ, sub, add
called by build, limbs, past
limbs(tau)lines 154–159exported

Every limb at τ, as integer cells of N (1-based).

calls places, floor, div, mul, toSp, argOf, Q
called by build
past(kind, tau, edge)lines 161–161exported

Signed distance (arcminutes) of a limb's argument past the edge `edge` (arcminutes), in (−10800, 10800].

firstAtEdge(kind, edge, lo, hi)lines 163–167exported

The FIRST spanda of the turn at which the limb's argument reaches `edge`, given lo before it and hi after.

calls cmp, past, Q
called by build, tithiEnd
tauOfDays(days)lines 171–171exported

Turn-spandas from civil days since the Kali epoch (a float: the whole days exact, the fraction to the nearest spanda), and back (exact rational of days).

calls nothing in the registry
daysOfTau(tau)lines 172–172exported
calls Q
called by nothing in the registry
turnClock(tau)lines 175–179exported

Split a turn-spanda count: whole turns since the epoch, then the pāda of the turn (1…108, 200 prāṇas each) and ghaṭī / vināḍī / prāṇa / spanda within the turn.

calls nothing in the registry
called by build

End of the tithi `index` (1…30) nearest civil day `nearDays`: the first spanda of the turn at which it ends.

amavasya(nearDays)lines 193–193exported
calls tithiEnd
called by nothing in the registry
purnima(nearDays)lines 194–194exported
calls tithiEnd
called by nothing in the registry
gati(tau)lines 199–222exported

SS 2.47-2.49: true motions of the Sun and Moon, in arcminutes per turn of the star-wheel. The kendra's motion × the tabular sine-difference of its step (bhogya-khaṇḍa) ÷ 225 × the epicycle ÷ 360, added from Karka (kendra 90°…270°), subtracted from Makara. With the Mādhava sine the slope is the polynomial's own derivative.

SS 4.8: from a first estimate, correct the time by the remaining elongation over the rate of elongation, again and again, until the correction is under a spanda; then the integer spanda reached. The rate is the elongation gained over the next turn (default) or the text's true motions of 2.47-2.49 ({ rate: "text" }).

called by build