भारत · ग्रहगणित
स्थान उज्जयिनी 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/ss-grahana.js

ग्रहण: the lunar and solar eclipse of the Sūrya-Siddhānta (chapters 4, 5 and 6.13), by the text's own

567 lines · 0 exports

लेख · the header

The header, as the file states it

ss-grahana.js — ग्रहण: the lunar and solar eclipse of the Sūrya-Siddhānta (chapters 4, 5 and 6.13), by the text's own arithmetic — its 24-entry sine table on R = 3438 with linear interpolation (sphuta.js), the greatest declination's R-sine 1397 (2.28), its rising-times (ss-udaya.js) and its numbers. No spherical trigonometry is used anywhere here; the square roots are the text's own (mūla, pada). Numbers [text]: 6500 and 480 yojanas (4.1 sārdhāni ṣaṭ-sahasrāṇi; saha-aśītyā catuḥ-śatam); the Earth 1600 (1.59 śatāny aṣṭau dvi-guṇāni); tithi = 15 (4.3, 5.10); sixty (4.13 ṣaṣṭyā, 4.14, 4.18); 270′ the Moon's greatest latitude (1.68, one-eightieth of the circle's minutes); orbits 324,000 and 4,331,500 (12.85-12.86, for 4.3's alternative); seventy (4.25, 5.11 saptati); seven sevens = 49 (5.11 sapta-saptaka); jyā of one sign = 1719 (5.7); a twelfth of the Moon and three minutes of the Sun (6.13). 4.1-4.3 discs: yojanas × true ÷ mean daily motion (4.2a); the Sun's carried to the Moon's orbit × Sun ÷ Moon revolutions (4.2b) or × Moon's orbit ÷ Sun's orbit (4.3a); ÷ 15 → minutes (4.3b). `discs` 4.4-4.5 sūcī = 1600 × the Moon's true ÷ mean motion; tamas = sūcī − (the Sun's true diameter − 1600) × 480 ÷ 6500; ÷ 15 → the shadow in minutes ["śravaṇa" in 4.4 read as the Sun's true diameter: reading]. `discs` 4.6-4.8 the parva: Sun and Moon equal (amāvāsyā) or six signs apart (pūrṇimā) to the minute, reached by repeated correction, the node of that moment — spanda-ganita's exact first spanda of the turn. `parvaNear` 2.57,1.68 the Moon's latitude = jyā(Moon − node) × 270 ÷ R. `moonLatitude` 4.9-4.11 eclipsed and eclipser (Sun–Moon; Moon–shadow); channa = half the sum of the discs − the latitude; total when it exceeds the eclipsed; no eclipse when the latitude exceeds the half-sum. `channa`, `sambhava` 4.12-4.13 the two padas √(half-sum² − latitude²), √(half-difference² − latitude²); × 60 ÷ the difference of the daily motions → sthityardha and vimardārdha in nāḍīs. `ardhas` 4.14-4.15 the motions × those nāḍīs ÷ 60 taken off for the first contact and added for the last (the node the other way, "anyathā"); the latitude there; the half-durations again, until fixed. `lunarEclipse` 4.16-4.17 middle at the end of the true tithi; sparśa = middle − sthityardha, mokṣa = + ; nimīlana, unmīlana by the vimardārdha when total. 4.18-4.21 the grāsa at a time: (sthityardha − nāḍīs since sparśa) × motion difference ÷ 60 = koṭi; the latitude the bhuja; their root the śravas; half-sum − śravas = grāsa; after the middle count back from mokṣa (4.21); in a solar eclipse the koṭi × mean ÷ true sthityardha (4.19). `grasaAt` 4.22-4.23 the inverse: half-sum − grāsa = śravas; √(śravas² − latitude²) = koṭi; × true ÷ mean sthityardha for the Sun; × 60 ÷ motion difference → nāḍīs from the middle. `timeForGrasa` 4.24-4.25 valana: the deflection at the eclipsed body of the observer's north (the north point of the horizon) from the pole's (ākṣa), and of the ecliptic's pole from the pole's (āyana); jyā ÷ 70 → aṅgulas. `valanaAt` Default (owner, 2026-10-27: "what is perfect for the model"): the exact angles of those two triangles, computed with this build's own sine — ākṣa tan V = jyā H · jyā φ ÷ (koṭi δ · koṭi φ + jyā δ · jyā φ · koṭi H) (pole – body – north point) āyana tan η = koṭi α · jyā ε ÷ (koṭi δ · koṭi ε + jyā δ · jyā ε · jyā α) (pole – body – ecliptic pole) The text's rules — arc(jyā nata × jyā akṣa ÷ R), and the declination of the eclipsed + 3 signs — are these when the body is a quadrant from the north point and on the ecliptic at δ = 0: { valana: "text" }. 12.80-12.90 the orbits (KAKSHYA): each the brahmāṇḍa (12.90) ÷ its kalpa revolutions, exactly; the printed integers are those values rounded, except Budha's śīghra orbit, printed 1,043,209 for 1,043,207.798 (a slip of 1.2). The stars' orbit is 60 × the Sun's exact 4,331,500.2 = 259,890,012 (12.80 with 12.89). 6 (the figure) the discs' exact overlap: the common chord and the covered area of the eclipsed disc. `overlapAt` 4.26 the aṅgula: by the phala DIVIDE (chindyāt) the latitude and the measures. The phala is a reading (see ANGULA_READINGS): this edition has "dinamadhyārdhaṃ", a second e-text "dinamadhyardhaṃ" (= adhyardha, 1½). 5.1-5.2 no lambana when the Sun is at the madhya-lagna; no nati when akṣa and the northern declination of the meridian point agree ("harija" = lambana here, as 5.14 and 5.16 use it). 5.3 udayajyā = jyā(lagna by one's own risings) × 1397 ÷ lambajyā. `parallaxAt` 5.4-5.6 madhya-lagna by the Laṅkā risings; natāṃśa = akṣa (always south, 3.14) and its declination, summed when alike, differenced otherwise; madhyajyā; phala = (madhyajyā × udayajyā ÷ R)²; dṛkkṣepa = √(madhyajyā² − phala); dṛggati = √(R² − dṛkkṣepa²). 5.7-5.8 (asphuṭa: the natāṃśa's sine and cosine); cheda = jyā(1 sign)² ÷ dṛggati [reading "ekajyā-varga", as the second e-text reads; this edition's "ekajyārdha-gata" gives no ghaṭikās]; lambana = jyā(madhya-lagna ~ Sun) ÷ cheda, ghaṭikās, east or west. 5.9 Sun beyond the madhya-lagna: subtract from the tithi-end; short of it: add; again and again until fixed. 5.10-5.11 nati = dṛkkṣepa × (the mean motions' difference) ÷ (15 R); or dṛkkṣepa ÷ 70; or × 49 ÷ R. 5.12-5.13 nati south or north as the madhyajyā; with the Moon's latitude summed when alike, differenced otherwise; with that latitude everything of chapter 4. `solarEclipse` 5.14-5.17 the lambana again at the tithi-end ∓ sthityardha; its difference from the middle's (harijāntara) added to the half-duration in the normal case of each kapāla (east: sparśa's greater, mokṣa's smaller; west: the reverse), subtracted where it is the other way; when the kapālas differ, the two lambanas joined and added; the vimardārdha likewise. `harijantara` 6.13 a twelfth of the Moon eclipsed is seen; three minutes of the Sun are not. `perceptible` Every longitude is the text's (sidereal) one; declinations, risings and lagnas use it made sāyana by the ayanāṃśa (3.10). Time is days since the Kali epoch (midnight at Laṅkā); a site is { latitude, deshantara } in degrees (deśāntara east +, optional palabha); the meridian is placed from mean time as panchanga.js does. Motions are arcminutes per civil day, so the text's nāḍīs here are sixtieths of the civil day; the clock "ghaṭī after sunrise" is in nāḍīs of the turn (3.46-3.48). This is the text's eclipse, not the sky's: how far it is from the sky is for the vedha to say. withSine("madhava"): the same with Mādhava's sine (sphuta.js, on R = 3438) in place of the table; measured in ss-madhava.test.js. The default is the text's table. Browser: window.SSGrahana (needs Sphuta, SpandaGanita, SSUdaya, KalaDvara); node: module.exports.
आवश्यक · requires

What it loads

required by
निर्यात · exports

What it exports

पाठ · the verses it cites

SS verses named in the header

none in the registry

नलिका · channels

The channels it runs in

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

Every function, what it calls, who calls it

45 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.

KAKSHYA(()lines 100–110exported
calls nothing in the registry
called by nothing in the registry
mod(a, m)lines 119–119
calls nothing in the registry
wrap180(a)lines 120–120
arcOf(x)lines 121–121
calls nothing in the registry
bhuktiAtTau(tau)lines 125–129exported

2.47-2.49: true daily motions (arcmin per civil day) at τ spandas of the turn; the node has only its mean motion.

calls nothing in the registry
called by bhukti, baseOf
bhukti(t)lines 131–131exported

True daily motions at days t since the Kali epoch.

discsFrom(b, opts)lines 134–143exported

4.1-4.5 from the true motions b: discs of Sun and Moon and the Earth's shadow at the Moon, in arcminutes. opts.via: "bhagana" (4.2b, default) or "kaksha" (4.3a) to carry the Sun's diameter to the Moon's orbit.

calls nothing in the registry
discs(t, opts)lines 144–144exported
called by nothing in the registry
moonLatitude(moon, node)lines 147–147exported

2.57 with 1.68: the Moon's latitude in arcminutes (north +) from the Moon and its node (degrees).

calls nothing in the registry
called by latFnOf
channa(grahya, grahaka, beta)lines 151–151exported

4.10: the part covered = half the sum of the eclipsed's and the eclipser's measures − the latitude.

calls nothing in the registry
called by sambhava
sambhava(grahya, grahaka, beta)lines 153–156exported

4.11: an eclipse is possible when the latitude is below the half-sum; total when the covered part reaches the eclipsed.

4.12-4.13: the two padas and the half-durations in nāḍīs (sixtieths of the day the motions are counted in). The vimardārdha exists only in a total eclipse (4.17), which is exactly when its pada is real [theorem].

calls nothing in the registry
called by contactSide
parvaNear(nearDays, kind)lines 170–179exported

The pūrṇimā ("purnima", 15) or amāvāsyā ("amavasya", 30) nearest civil day `nearDays`: spanda-ganita's exact first spanda of the turn at which Sun and Moon are equal (or half a circle apart) — SS 4.7; 4.8 reaches the same spanda.

siteOf(site)lines 183–190exported

3.13-3.14: akṣajyā and lambajyā from the palabhā and its hypotenuse; their arcs are "always south".

meridianAsus(t, site, A)lines 193–196exported

Asus of the meridian (its right ascension × 60) at t: mean Sun (sāyana) + its hour angle from mean time, as panchanga.js.

calls mod
ayanamsha(t)lines 197–197
calls nothing in the registry

2.60-2.63 for a krānti-jyā: the half-day in asus at a palabhā.

calls arcOf
called by bodyState

5.3-5.11 at days t for the site, with the true Sun's sidereal longitude `sunSid` (degrees). opts.asphuta: 5.7a's approximate dṛkkṣepa and dṛggati (the natāṃśa's sine and cosine). opts.stated: 3.44's risings.

parallaxAt(t, site, opts)lines 236–236exported

5.3-5.11 at t for a site, with the true Sun of sphuta.js at t.

called by lambanaAt, natiAt
lambanaAt(t, site, opts)lines 237–237exported
called by nothing in the registry
natiAt(t, site, opts)lines 238–238exported
called by nothing in the registry
harijantara(Lc, Lm, side)lines 244–249exported

5.15-5.17 as worded: the harijāntara (ghaṭikās) to apply to the half-duration of `side` (−1 sparśa, +1 mokṣa), from the contact's lambana Lc and the middle's Lm (signed, + east). One kapāla: the difference of the magnitudes, added in the normal case (east: sparśa's greater, mokṣa's smaller; west: the reverse), subtracted otherwise; two kapālas: the two joined and added.

calls nothing in the registry
called by contactSide

One side of the eclipse: the half-duration `kind` ("sthiti" or "vimarda") recomputed with the latitude at the contact again and again (4.14-4.15) and, for the Sun, the harijāntara (5.14-5.17). mode "fixed": the lambana and latitude are taken at the apparent contact until nothing changes [reading of "prāgvat … punaḥ"]; "once": 5.14 as a single step at the tithi-end ∓ the mean half-duration.

called by finish
baseOf(parva, opts)lines 282–285

── the eclipse ───────────────────────────────────────────────────────────────────────────────────

sunAt(B, t)lines 287–287

4.14: places at another moment by the motions; 4.8, 4.15: the node the other way ("anyathā"), being westward (1.33)

calls nothing in the registry
moonAt(B, t)lines 288–288
calls nothing in the registry
called by latFnOf, bodyState
nodeAt(B, t)lines 289–289
calls nothing in the registry
called by latFnOf
bodyState(E, t)lines 297–307

The eclipse's state of the eclipsed body at t: sāyana longitude, hour angle (asus, west +), half-day and unnata.

clock(t, site)lines 311–332exported

The clock at the site: civil date and local mean time; the ghaṭīs since sunrise and to sunset in nāḍīs of the turn (1.11-1.12, what a kapāla calibrated on the stars counts), and in the Sun's own asus (its hour angle, 2.59-2.62), which run about 59 asus a day slower.

context(site, opts)lines 379–385
lunarEclipse(nearDays, site, opts)lines 388–398exported

The lunar eclipse at the pūrṇimā nearest `nearDays` (SS 4). A site adds the horizon, the valana and the aṅgulas.

solarEclipse(nearDays, site, opts)lines 402–425exported

The solar eclipse at the amāvāsyā nearest `nearDays` for a site (SS 4 with 5). opts.nati: "5.10" (default), "5.11" (÷ 70) or "5.11b" (× 49 ÷ R); opts.contactLambana: "fixed" (default) or "once"; opts.asphuta: 5.7a.

grasaAt(E, t)lines 429–440exported

4.18-4.21 (4.19 for the Sun): the grāsa (arcminutes) of an eclipse at days t.

calls nothing in the registry
called by overlapAt, angulaAt
timeForGrasa(E, g, side)lines 443–460exported

4.22-4.23: the instant on `side` ("sparsha" before the middle, "moksha" after) at which the grāsa is `g` arcminutes. The latitude is that of the instant found, recomputed until fixed. null if the grāsa is never reached.

calls nothing in the registry
called by finish
sinD(d)lines 464–464

── 4.24-4.26: valana and aṅgulas ───────────────────────────────────────────────────────────────── this build's own trigonometry (its sine and arc; no other)

calls nothing in the registry
asinD(x)lines 465–465
atan2D(y, x)lines 466–466
calls arcOf
equatorialOf(lam, betaDeg)lines 469–472exported

right ascension and declination (degrees) of a tropical λ, latitude β (degrees), by the build's sine

calls sinD, mod, atan2D, asinD
called by valanaAt
valanaAt(E, t, opts)lines 475–494exported

4.24-4.25: the valana of the eclipsed body at t — ākṣa and āyana in degrees (north +), their join, and jyā ÷ 70 aṅgulas. opts.valana: "sphere" (default: the exact angles, see the header) or "text" (4.24-4.25 as written).

Chapter 6's figure, exactly: the two discs (radii in arcminutes) with their centres the śravas apart — the common chord and the covered part of the eclipsed disc by area; beside the text's linear grāsa (4.20). null when they do not meet.

calls asinD
called by overlapAt
overlapAt(E, t)lines 506–510exported
called by nothing in the registry
angulaAt(E, t, opts)lines 513–524exported

4.26: the eclipse's measures in aṅgulas at t, the minutes DIVIDED by the phala (chindyāt). null below the horizon. opts.reading: "adhyardha" (default), "dinamadhyardha" or "dinardha" (ANGULA_READINGS).

called by finish
called by nothing in the registry