Skip to main content
A · Canonical textChapter 2

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.

Sūrya SiddhāntaCh. 14 (Mānādhyāya), v. 12
A · Canonical text

तिथयश्चार्कचन्द्राभ्यां ज्ञेया द्वादशभिर्लवैः। वारः सावनैर्दिनैः प्रोक्तो नक्षत्राणि भभोगतः॥

tithayaś cārkacandrābhyāṃ jñeyā dvādaśabhir lavaiḥ | vāraḥ sāvanair dinaiḥ prokto nakṣatrāṇi bhabhogataḥ ||

Translation:Tithis are known from the longitudinal separation of the Sun and Moon in spans of twelve degrees (12°). The civil weekday is known from sunrises, and the Nakshatras from the Moon's traversing of the twenty-seven stellar segments.

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

Δλ = (λ_Moon - λ_Sun) mod 360°
Tithi_Number = ⌊ Δλ / 12° ⌋ + 1
Fraction_Elapsed = (Δλ mod 12°) / 12°
Because the Moon moves in an eccentric orbit (varying between 11.8°/day at apogee and 15.3°/day at perigee), a Tithi's actual duration varies from approximately 19 to 26 hours. A Tithi active at local sunrise is the civil Tithi of that Vedic day.
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

Nakṣatra_Index = ⌊ λ_Moon / 13.3333° ⌋ + 1
Pāda_Number = ⌊ (λ_Moon mod 13.3333°) / 3.3333° ⌋ + 1
Determined strictly from the Moon's apparent sidereal longitude (Nirayana) using Lahiri Ayanamsha.
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

Σλ = (λ_Sun + λ_Moon) mod 360°
Yoga_Index = ⌊ Σλ / 13.3333° ⌋ + 1
There are 27 Yogas starting from Viṣkambha (1) through Vaidhṛti (27). Specific Yogas (Vyatīpāta #17 and Vaidhṛti #27) represent inauspicious astrological conjunctions that require specialized Muhurta exclusions.
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 (Bhadrā) Classical Inauspiciousness:

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

Complexity: O(log((b-a)/ε)) superlinear convergence
f(t) = (λ(t) mod θ_step) - target_boundary = 0
Pūjāvāni solves this using Brent's method (combining bisection, secant method, and inverse quadratic interpolation) guaranteed to converge monotonically within 8–12 iterations to a tolerance of ε < 10⁻⁵ Julian Days (≈ 0.86 seconds).
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 engine

Move 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