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

पञ्चाङ्ग of the sovereign engine: sunrise and sunset on the turn about the dhruva, the five limbs with

366 lines · 0 exports

प्रमाण: पाठ SS (the five limbs on the text's own Sun and Moon; the ghaṭī of the turn, SS 1.11–12) · गणित
लेख · the header

The header, as the file states it

panchanga.js — पञ्चाङ्ग of the sovereign engine: sunrise and sunset on the turn about the dhruva, the five limbs with प्रमाण: पाठ SS (the five limbs on the text's own Sun and Moon; the ghaṭī of the turn, SS 1.11–12) · गणित their end times, the lunar month named by the text's rule, saṅkrānti, and the rising sign. Text (editions/surya-siddhanta-full-edition.html): 2.64 a nakṣatra is 800′, a tithi 720′; 2.65 yoga = (Sun + Moon) ÷ 800′; 2.66 tithi = (Moon − Sun) ÷ 720′; 2.67-2.69 karaṇa = half a tithi: four fixed ones (Śakuni, Nāga, Catuṣpada, Kiṃstughna, in the verse's order) from the second half of the dark fourteenth, then seven movable ones from Bava, each eight times a month; 2.58-2.63 declination and the day-half through cara; 3.10 declination, shadow and cara from the place corrected by the ayanāṃśa; 14.10 the year is twelve solar months from Meṣa; 14.15-14.16 lunar months are named by the nakṣatra at the full moon: from Kārttika, two nakṣatras each starting at Kṛttikā, three for the fifth (Phālguna), the eleventh (Bhādrapada) and the twelfth (Āśvina); 14.18 the civil day is sunrise to sunrise. End times are found by bisection on the true places (to a few milliseconds), where the text divides the remaining arc by the daily motions (2.65-2.66) — the same quantity, without the linear approximation. Sunrise (on the text's table, the default) by the text's own rule — 2.60-2.63 and 3.42, as vedha-lekha.js; with Mādhava's sine, a measured frame, or opts.sunrise "sphere": the instant the Sun's centre meets the horizon on the sphere (the text has no refraction; pass `dip` in arc-minutes to include one). Method "dhruva" finds it on the turn, using the true Sun's right ascension; method "surya-siddhanta" uses the true longitude instead, which is what the text's bhujāntara (2.46) does and drops the part of the day's inequality that comes from the obliquity. Times are days since the Kali epoch, midnight at Laṅkā (the SS ahargaṇa); a site is { latitude, deshantara } in degrees, deśāntara east of the Laṅkā–Ujjayinī meridian positive. Names other than the text's are marked in NAMES_SOURCE. Lagna (default "text", the table; "madhava" selectable): each point's own rising, 3.42 at the point and the cara of its declination (2.61-2.63), with Mādhava's sine on R = 3438 — the sphere's ascendant to 0.05″ with the text's obliquity, and no trigonometry (ss-madhava.test.js); { lagna: "text" } the same rule by the SS table (within 0.29°); { lagna: "text-linear" } 3.46-3.48 as worded, in proportion within a sign (within 1.1° at Ujjayinī); { lagna: "sphere" } (or any opts.epsilon) the sphere's formula. Browser: window.Panchanga (needs window.Sphuta, window.Dhruva, window.KalaDvara; window.SSUdaya for the text's lagna); 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 1.12verse
    nāḍīṣaṣṭyā tu nākṣatraṃ ahorātraṃ prakīrtitam । tattriṃśatā bhavenmāsaḥ sāvano arkodayaistathā ।।
नलिका · channels

The channels it runs in

कार्य · the functions

Every function, what it calls, who calls it

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

mod(a, m)lines 37–37
calls nothing in the registry
wrap180(a)lines 38–38
NADI_DAYS(()lines 66–66exported

One nāḍī = 1/60 of the star-wheel's turn, in civil days: savana / (60 x nakshatra days of the yuga), SS 1.11-1.12, 1.34-1.37.

calls nothing in the registry
called by nothing in the registry
placesAt(t)lines 69–69exported

── places ──────────────────────────────────────────────────────────────────────────────────────

calls nothing in the registry
ayanamshaAt(t, opts)lines 72–75exported

The ayanāṃśa at t: opts.ayanamsha (a number) overrides; else this instance's own rule (ayanamshaFn, given to withPlaces by a tier: ss-tier.js), else the text's SS 3.9-3.10.

calls nothing in the registry
atan2Text(y, x)lines 77–81

atan2 in degrees by the text's own sine (sphuta.js jya and its inverse), the quadrant from the signs.

calls nothing in the registry
called by build, meridianAt
epsOf(opts, t)lines 84–84

The obliquity at t: opts.epsilon (a number) overrides; else this instance's own (epsilonFn, given by a measured tier: the true obliquity it measured), else the text's (SS 2.28).

calls nothing in the registry
sunHourAngle(t, site, opts)lines 87–97exported

Hour angle of the true Sun (degrees, 0 at the meridian, increasing westward) at the site.

The text's own rule (2.60-2.63, 3.42; council G-3, as vedha-lekha.js): the Sun's asus since rising — the meridian's asus on the turn less the Sun's right ascension plus its half-day — is 0 at sunrise and the whole day (twice the half-day) at sunset; the sine is this instance's (the 24 jyās by default).

textRule(site, opts)lines 119–119

Which rule a sunrise follows: the text's (default on the text's table, with no measured frame) or the sphere's (opts.sunrise "sphere"; Mādhava's sine; a measured ramc or obliquity; a dip; opts.sunriseMethod).

calls nothing in the registry
called by build, sunEvent
sunrise(N, site, opts)lines 139–139exported
sunset(N, site, opts)lines 140–140exported
limbsAt(t)lines 143–152exported

── the five limbs ──────────────────────────────────────────────────────────────────────────────

tithiName(i)lines 153–153exported
calls nothing in the registry
called by build, panchanga
karanaName(k)lines 154–158exported
calls nothing in the registry
called by build, panchanga
nextChange(t0, key, maxDays = 3)lines 160–166exported

First instant after t0 at which limb `key` changes, by bracketing then bisection (to ~10 ms).

calls limbsAt
called by build, panchanga
prevChange(t0, key, maxDays = 3)lines 168–174exported

Previous instant before t0 at which limb `key` changed.

calls limbsAt
called by build
syzygyNear(t, target, direction)lines 177–191exported

Instant (near t, within ±searchDays) when the elongation equals `target` degrees (0 new moon, 180 full moon).

called by build, lunarMonth
sankrantisBetween(t1, t2)lines 193–208exported

The Sun's sign changes (saṅkrānti) between t1 and t2.

calls placesAt
called by build, lunarMonth

The name of an amānta month from the saṅkrāntis inside it (rāśi indices, 0 = Meṣa … 11, in time order) and, when it holds none, the rāśi index of the next saṅkrānti after it: the month holding the Meṣa saṅkrānti is Caitra, and so on; none → adhika, named after the next month; two → kṣaya, the second name dropped [standard rule; no local text states it]. The one rule that lunarMonth and the year bu

calls nothing in the registry
called by build, lunarMonth
lunarMonth(t)lines 229–241exported

The amānta lunar month containing t: from the new moon before it to the next. Name: the month in which the Sun enters Meṣa is Caitra, and so on; a month with no saṅkrānti is adhika and takes the name of the month after it; a month with two is kṣaya and the second name is dropped [standard rule; no local text states it]. SS 14.15-14.16 is where the names come from (the Moon's nakṣatra at the full m

UM()lines 245–245
calls nothing in the registry
UT()lines 246–246
calls nothing in the registry

The places, the ayanāṃśa and the sāyana right ascension of the meridian (degrees) at t, on the turn: the mean Sun's right ascension carried by the local hour (12 h at local midnight).

ramcOf(t, site, opts)lines 257–257exported

{ A: the ayanāṃśa (degrees), ramcDeg: the sāyana right ascension of the meridian on the turn } — one meridian for lagnaAt and meridianAt.

called by build
lagnaHow(opts)lines 258–262
calls nothing in the registry
lagnaAt(t, site, opts)lines 267–282exported

Sidereal rising sign (lagna) at t: the ecliptic point on the eastern horizon, found on the turn about the dhruva — by SS 3.42 at the point with 2.61-2.63 (the table by default, "text"; Mādhava's sine with "madhava"), by 3.42-3.48 as worded ("text-linear"), or by the sphere ("sphere", or any opts.epsilon); site.palabha if the owner measured it, else from the latitude by the same sine.

meridianAt(t, site, opts)lines 287–298exported

The madhya-lagna at t: the ecliptic point on the meridian (SS 3.49), by 3.42 at the point — the sidereal λ whose right ascension is the meridian's (ramcOf). Mādhava's sine by default; the text's table with { lagna: "text" } or "text-linear". { lagna: "sphere" } (or any opts.epsilon) also takes Mādhava's sine: the point on the meridian needs no horizon, and this module adds no library trigonometry

civilDayOf(t, site, opts)lines 304–313exported

The civil day holding the instant t at the site (SS 14.18, 1.36: sunrise to sunrise): { N, sunrise, sunset, nextSunrise, vara, polar, rule } with sunrise(N) ≤ t < sunrise(N + 1); the vāra is Kali day N's (1.51), so it changes at sunrise, not at midnight. Where the Sun does not rise or set (polar), N is the local civil date floor(t + deśāntara/360), the three times are null and polar is true.

called by build
panchanga(N, site, opts)lines 316–350exported

The full pañcāṅga of civil day N (sunrise to the next sunrise) at the site.

checkSite(site)lines 352–357
calls nothing in the registry