Panchanga Formulations & Root-Finding Mathematics
The rigorous mathematical formulations governing the Five Limbs (Pañca Aṅga) of Vedic calendrics, continuous boundary root-finding algorithms (Brent’s Method), and dynamic multi-Karana evaluation.
तिथयश्चार्कचन्द्राभ्यां ज्ञेया द्वादशभिर्लवैः। वारः सावनैर्दिनैः प्रोक्तो नक्षत्राणि भभोगतः॥
tithayaś cārkacandrābhyāṃ jñeyā dvādaśabhir lavaiḥ | vāraḥ sāvanair dinaiḥ prokto nakṣatrāṇi bhabhogataḥ ||
1. Limb 1: Tithi (Lunar Phase Elongation)
A Tithi is the temporal interval required for the Moon’s celestial longitude to advance by exactly 12 degrees ($12^\circ$) relative to the Sun. The synodic lunar month comprises $360^\circ / 12^\circ = 30$ Tithis, divided into two lunar fortnights:Śukla Pakṣa (Tithis 1–15, culminating in Pūrṇimā) andKṛṣṇa Pakṣa (Tithis 16–30, culminating in Amāvāsyā).
Tithi Number & Phase Fraction
Parameters & variables
Δλ- Solilunar Elongation: Angular separation between Moon and Sun along the ecliptic(0° to 359.999°)
Tithi_Number- Integer Index: 1 to 15 (Shukla Paksha), 16 to 30 (Krishna Paksha)(integer)
2. Limb 2: Nakṣatra & Pāda
The sidereal zodiac of $360^\circ$ is divided into 27 equal lunar mansions (Nakṣatras), each spanning an arc of $360^\circ / 27 = 13^\circ 20' = 13.3333^\circ$. Each Nakshatra is further subdivided into 4 quarters (Pādas) of $13^\circ 20' / 4 = 3^\circ 20' = 3.3333^\circ$, creating 108 padas matching the Navāṁśa D9 harmonic division.
Nakṣatra & Pāda Index
Parameters & variables
λ_Moon- Sidereal Moon Longitude: Apparent sidereal longitude measured from 0° Mesha(degrees)
Nakṣatra_Index- Asterism ID: 1 (Aśvinī) through 27 (Revatī)(1 to 27)
Pāda_Number- Quarter ID: 1, 2, 3, or 4 within the current Nakshatra(1 to 4)
3. Limb 3: Solilunar Yoga
Unlike Tithi (which measures the difference between lunar and solar longitudes),Yoga measures the sum of the Sun and Moon’s sidereal longitudes, divided into 27 equal segments of $13^\circ 20'$.
Solilunar Yoga Index
Parameters & variables
Σλ- Combined Longitude: Sum of sidereal Sun and Moon longitudes(degrees)
Yoga_Index- Yoga Number: 1 (Viṣkambha) to 27 (Vaidhṛti)(1 to 27)
4. Limb 4: Karaṇa (Half-Tithi Intervals)
A Karaṇa is equal to half a Tithi, spanning 6 degrees ($6^\circ$) of lunar elongation. In a 30-Tithi lunar month, there are exactly 60 Karaṇas composed of:
- 4 Fixed (Sthira) Karaṇas: Occur only once per month: Śakuni (Kṛṣṇa 14-2), Catuṣpada (Amāvāsyā-1), Nāga (Amāvāsyā-2), and Kiṃstughna (Śukla 1-1).
- 7 Movable (Cara) Karaṇas: Repeat cyclically 8 times across the remaining 56 half-tithis: Bava, Bālava, Kaulava, Taitila, Gara, Vaṇija, and Viṣṭi (Bhadrā).
Viṣṭi Karaṇa corresponds to the inauspicious mythological entity Bhadrā. Treatises on Muhurta (Muhūrta Cintāmaṇi) strictly prohibit auspicious beginnings (marriage, travel, foundation laying, commercial agreements) during Bhadrā.
5. Continuous Boundary Root-Finding via Brent’s Algorithm
Finding the exact second a Tithi, Nakshatra, or Yoga concludes requires locating the root $t^*$ of the continuous nonlinear angular function:
Root-Finding Objective Function
Continuous boundary crossing equation solved to sub-second precision
Parameters & variables
t- Julian Day Time (UT): Continuous time variable in Ephemeris Julian Date(Julian Days)
θ_step- Arc Step: 12° for Tithi, 6° for Karana, 13°20′ for Nakshatra/Yoga(degrees)
ε- Convergence Tolerance: 10⁻⁵ Julian Days (sub-second)(< 1 second)
Implementation reference
def find_boundary_transition(t_start, t_end, target_boundary, arc_func):
"""Brent's method root-finder with continuous circular phase unwrap."""
def objective(t):
val = arc_func(t) % 360.0
diff = (val - target_boundary) % 360.0
if diff > 180.0:
diff -= 360.0
return diff
return scipy.optimize.brentq(objective, t_start, t_end, xtol=1e-5)Panchanga limb sandbox
Illustration, not the engineMove either longitude and watch the three limbs that follow from them. This classifies a single instant; the engine additionally solves for the moment each limb ends, which is the figure an almanac actually publishes.
- Tithi — (Moon − Sun) mod 360, ÷ 12°
- Saptamī#7
- Śukla pakṣa (waxing) · elongation 82.70° · 89% elapsed
- Nakṣatra — Moon ÷ 13°20′
- Maghā
- #10 · pāda 3
- Yoga — (Sun + Moon) mod 360, ÷ 13°20′
- Harṣaṇa
- #14