CHAKRA · study room

The mathematics of many calendars

Everything the observatory computes, explained and made playable. The formulas below are not illustrations of the code — they are the code, and each section links to the exact function on GitHub.

1 · Kepler's ellipse and the equal-area clock

A planet does not circle the Sun; it sweeps an ellipse with the Sun at one focus. Two numbers fix the shape: the semi-major axis a (size) and the eccentricity e (squash). The orbit's radius at true anomaly ν is:

r(ν) = a·(1 − e²) / (1 + e·cos ν) perihelion r = a(1−e) · aphelion r = a(1+e)

Kepler's second law is the part that makes it a clock: the line from Sun to planet sweeps equal areas in equal times — so a planet races through perihelion and lingers at aphelion. Drag the eccentricity and watch the swept wedge keep its area while its shape changes.

sim 1 · equal areas in equal times
e

2 · Kepler's equation — where the clock gets hard

Position on the ellipse is easy if you know the true anomaly ν; but time gives you the mean anomaly M, which grows uniformly. The bridge is the eccentric anomaly E, tied to M by a transcendental equation that has no closed-form solution — you must iterate:

M = E − e·sin E (Kepler, 1609 — in degrees: M = E − (180/π)·e·sin E) Newton's step: E ← E − (E − (180/π)·e·sin E − M) / (1 − e·cos E)

Six iterations reach machine precision for planetary eccentricities. This exact loop runs inside every position the observatory shows you.

sim 2 · watch Newton converge
e

3 · From the Sun's frame to your sky

The engine computes each planet heliocentrically, then shifts to Earth's point of view by adding the Sun's geocentric vector — a one-line change of origin. Ecliptic coordinates become the sky you see through two rotations:

geocentric = heliocentric_planet + geocentric_Sun (vector add) ecliptic λ,β → equatorial α,δ : rotate by the obliquity ε ≈ 23.44° equatorial → horizon alt,az : rotate by hour angle H = LST − α and latitude φ sin(alt) = sinφ·sinδ + cosφ·cosδ·cosH

Local sidereal time is Greenwich sidereal time plus your east longitude — which is why the observatory insists on knowing where you stand. Every telescope in the world points with these same three lines.

4 · Precession and the ayanāṁśa

Earth's axis wobbles like a slowing top, once around in ~25,772 years, so the equinox point drifts backward along the zodiac ~50.3″ every year. Western tropical astrology stays anchored to the moving equinox; Indian sidereal astronomy stays anchored to the stars. The gap between the two zero-points is the ayanāṁśa — this engine uses the official Lahiri (Citrāpakṣa) value, defined so that the star Spica (Citrā) sits at exactly 180° sidereal.

sidereal longitude = tropical longitude − ayanāṁśa(t) Lahiri here: ayan(y) = 23.853° + 0.0139552°·(y − 2000) ← linear fit, ±0.01° 1900–2100
sim 3 · two zodiacs drifting apart
year

Outer ring: tropical (0° Aries = equinox, fixed on screen). Inner ring: sidereal, sliding as the centuries pass. The gold marker is Spica, pinned at sidereal 180°. Around 285 CE the rings agree — that is the epoch both systems implicitly share.

5 · The tithi — a clock made of two hands

The pañcāṅga's day-unit is not the Sun's alone: a tithi is the time for the Moon to gain 12° of ecliptic longitude on the Sun. Thirty tithis make one lunation; the first fifteen (śukla pakṣa) brighten toward full, the next fifteen (kṛṣṇa pakṣa) darken toward new. Every festival row in the almanac is ultimately this subtraction:

elongation e = λ☾ − λ☉ (mod 360°) tithi index = ⌊e / 12°⌋ karaṇa = ⌊e / 6°⌋
sim 4 · drag the sun and moon hands

6 · Synodic beats — why conjunctions keep time

Two planets on different periods lap each other on a rhythm of their own — the synodic period. It is exactly the beat frequency of two waves, and it is why great conjunctions, launch windows and several festival cycles all tick:

1/S = 1/P₁ − 1/P₂ Jupiter (11.862 y) & Saturn (29.457 y) → S ≈ 19.86 y
sim 5 · two periods, one beat
P₁ P₂

7 · Eclipse geometry — the node windows

The Moon's orbit is tilted 5.1° to the ecliptic, so most new moons miss the Sun and most full moons miss Earth's shadow. Eclipses happen only when syzygy occurs near a node — the crossing points of the two planes. The engine scans every new and full moon and measures the Sun's angular distance from the nearest node:

solar eclipse possible : |λ☉ − node| < 18.4° central if < 11.8° lunar eclipse possible : |λ☉ − node| < 12.2° total-ish if < 9.5° nodes regress a full circle in 18.61 years → eclipse seasons ~173 days apart Saros: 223 synodic ≈ 242 draconic ≈ 239 anomalistic months ≈ 18 y 11 d

Those four windows are how this site found all four eclipses of 2026 with no tables — the dates in the almanac are outputs of this inequality, and the test suite pins them.

Ayanāṁśa systems — one sky, several zero-points

Sidereal traditions agree on the method and differ on the anchor. The differences are fractions of a degree — enough to move a lagna across a sign boundary, which is why the choice is named on every serious chart.

systemanchor / definitionvalueused by

Values other than Lahiri are shown as their conventional offsets from Lahiri and are approximate to ~1′; consult each school's ephemeris for chart-grade values. CHAKRA computes with Lahiri throughout — the ayanāṁśa India's Calendar Reform Committee (1955) adopted for the national pañcāṅga, defined by Spica at sidereal 180°.

Dṛk vs vākya — computed sky vs memorised sky

Dṛk-gaṇita ("observation-computation") derives positions from current astronomical theory — what this engine does. Vākya-gaṇita encodes pre-computed motions in memorised Sanskrit/Tamil mnemonic sentences (vākyas), a brilliant compression technology from the era before cheap paper: a panchāṅgam-maker could reconstruct the Moon's position from verses alone. Vākya almanacs (still printed in Tamil Nadu and Kerala) drift slowly from the true sky; dṛk almanacs track it. Where a festival date differs between two printed pañcāṅgas, this is very often the reason.

Sūrya Siddhānta — the classical engine

The Sūrya Siddhānta (compiled by ~500 CE, revised for a millennium after) is the great classical treatise of Indian mathematical astronomy: mean motions over vast cycles, epicyclic corrections (manda and śīghra), eclipse computation, and trigonometry built on the sine (jyā) — a function India gave the world. Its planetary mean motions are startlingly accurate; its epicycle geometry plays the role Kepler's ellipse plays here. Traditional schools that still compute by its methods form the "Saura" tradition. This engine is its philosophical descendant with modern elements: same questions, newer coefficients.

Jaimini — a different question, not a different sky

Honesty requires a distinction: Jaimini names a school of predictive interpretation (chara daśā, kārakas, argalā — from the Jaimini Sūtras), not a different ephemeris. Jaimini and Parāśari astrologers read the same computed sky; they disagree about what it means, not where the planets are. CHAKRA computes positions and the classical yoga/daśā structures; interpretation — Jaimini, Parāśari or otherwise — is a cultural layer this instrument deliberately leaves to humans.

Amānta vs pūrṇimānta — the same month, two labels

South and West India end the lunar month at new moon (amānta); the North ends it at full moon (pūrṇimānta). The dark fortnight between them belongs to different month-names in the two conventions — so Janmāṣṭamī falls in Śrāvaṇa kṛṣṇa by amānta but Bhādrapada kṛṣṇa by pūrṇimānta, on the very same civil day. CHAKRA's festival engine computes amānta and says so on each row; when a printed calendar seems to disagree with it by "a month", check the convention before suspecting the mathematics.

amānta month = new moon → new moon, named for the saṅkrānti inside it no saṅkrānti inside → adhika māsa (intercalary; carries no festivals)

Hijrī reckonings — why two devout neighbours differ by a day

The Islamic year is purely lunar. Three legitimate ways to run it coexist: sighting (month begins with the seen crescent — regional by nature), Umm al-Qura (Saudi astronomical criterion), and tabular (arithmetic 30-year cycle of 19 common + 11 leap years). Within tabular practice, Sunni and Shia (Ithnā-ʿAsharī) conventions choose different leap-year sets in the 30-year cycle — so the two arithmetic calendars, both internally exact, drift a day apart and rejoin. CHAKRA computes both and shows the divergence live:

leap years / 30 · Sunni (Kuwaiti): 2 5 7 10 13 16 18 21 24 26 29 leap years / 30 · Shia (Ithnā-ʿAsharī): 2 5 8 10 13 16 19 21 24 27 29

The Hebrew calendar — Hillel II's fixed arithmetic

Once observational, the Hebrew calendar was fixed in arithmetic form (tradition credits Hillel II, ~358 CE): a 19-year Metonic cycle of 12 leap months, the molad mean-conjunction clock ticking in 1/25920-day parts (ḥalakim), and four postponement rules (deḥiyyot) that nudge Rosh Hashana to keep festivals off forbidden weekdays. Because it is arithmetic, it can be computed exactly forever — this engine does, calibrated to published civil dates, and the C port reproduces it byte-for-byte.

How this science was built — a 3,000-year relay

Dates below mark the runner, not the starting line; every entry leans on centuries before it. The last column notes what of each survives, literally, in this repository's code.

  • ~1400–1000 BCE
    Vedāṅga Jyotiṣa
    India's first calendrical treatise: 5-year yuga, 27 nakṣatras, tithi arithmetic for fixing ritual time.
    → the nakṣatra ring and tithi definition in panchanga()
  • ~700–300 BCE
    Babylonian arithmetic astronomy
    Zig-zag functions, the Saros eclipse cycle, the zodiac's 12×30° grid — positional astronomy's first great data pipeline.
    → the 360° longitude grid everywhere; Saros in the CYCLES table
  • ~150 BCE
    Hipparchus measures precession
    Comparing his star catalogue with older ones, he finds the equinox itself moves — the discovery that later splits tropical from sidereal.
    → ayan() exists because of this
  • 499 CE
    Āryabhaṭa's Āryabhaṭīya
    Sine tables, Earth's rotation proposed, eclipse theory without demons — computation as explanation.
    → the jyā/sine lineage under every S() and C() call
  • ~500–1000 CE
    Sūrya Siddhānta matures
    Mean motions plus manda/śīghra epicycles; the canonical engine of the pañcāṅga tradition.
    → same job as ELEM + kepler(), older coefficients
  • 628 CE
    Brahmagupta's Brāhmasphuṭasiddhānta
    Rules for zero and negatives inside an astronomy book — the arithmetic this code runs on was published as astronomy.
    → every signed longitude difference
  • ~820–1030 CE
    The zīj era — al-Khwārizmī to al-Bīrūnī
    Islamic astronomers industrialise tables (zījes), refine trigonometry, and al-Bīrūnī writes the first great comparative study of the world's calendars.
    → this repo's multi-calendar ambition is al-Bīrūnī's project, executable
  • 1150 CE
    Bhāskara II's Siddhānta-Śiromaṇi
    Peak medieval synthesis: instantaneous motion (proto-calculus), refined eclipse limits, planetary theory.
    → eclipse windows in checkEcl() descend from these limit analyses
  • ~1380–1500 CE
    Kerala school — Mādhava's series
    Infinite series for sine, cosine and π, two centuries before Europe; born of the demand for ever-better pañcāṅga accuracy.
    → Math.sin() is the industrial descendant
  • 1543 · 1609 · 1619
    Copernicus → Kepler
    Heliocentrism, then the death of the epicycle: ellipses, equal areas, and P² ∝ a³.
    → helio(), kepler(), and the true-orbit orrery mode
  • 1687
    Newton's Principia
    One inverse-square law explains Kepler, the tides, precession, and — eventually — how to leave.
    → the physics licence behind everything above
  • 1752 · 1582
    Gregorian reform reaches the world
    Ten-then-eleven dropped days, a better leap rule; civil time becomes arithmetic.
    → greg2jdn()/jdn2greg() implement exactly this
  • 1955
    India's Calendar Reform Committee
    Under Meghnad Saha: one national pañcāṅga standard, the Lahiri ayanāṁśa, dṛk computation over vākya tables.
    → ayan() is this committee's number
  • 1957 →
    The spacecraft era
    The same two-body mathematics, run forward instead of backward: launch windows from synodic periods, transfers from Kepler.
    → see the Spacecraft tab; the equations do not change

Launch windows are synodic periods

You cannot leave for Mars whenever you like: Earth and Mars must be in the right relative geometry, and that geometry repeats on their synodic period — about 780 days. This is the same beat arithmetic as the great conjunction (Mathematics · §6), pointed at engineering instead of omens. Miss a window, wait 26 months: every Mars mission in history has obeyed this line of the CYCLES table.

1/S = 1/P_Earth − 1/P_target Earth–Mars: S ≈ 2.135 y ≈ 780 d Earth–Venus: S ≈ 584 d · Earth–Jupiter: S ≈ 399 d

The Hohmann transfer — Kepler, weaponised gently

The cheapest path between two circular orbits is half of an ellipse that kisses both: perihelion at the inner orbit, aphelion at the outer. Its size is fixed by the two radii, its flight time by Kepler's third law, and the required phase angle — how far ahead the target must be at launch — falls straight out of the arithmetic. Choose a target; everything below is computed from the same orbital elements the orrery uses.

a_t = (r₁ + r₂)/2 t_flight = ½ · a_t^{3/2} years (r in AU, Kepler III with GM☉=4π²) phase angle φ = 180° − 360° · ( t_flight / P_target )
sim 6 · plan a transfer from Earth
target

Dashed: the transfer half-ellipse. The gold arc is the phase angle φ — where the target must be when you light the engine. Radial scale ∝ √AU so Mercury and Saturn can share a screen.

How India actually flies it

Chandrayaan and Mangalyaan could not afford a giant single burn, so they used Kepler as a ratchet: repeated perigee burns raised the apogee orbit by orbit until the ellipse reached the Moon — or escaped to the Mars transfer. Each burn happens at perigee because that is where a unit of Δv buys the most energy (the Oberth effect: kinetic energy grows with the square of speed). Gravity assists are the same idea borrowed from a moving planet. Nothing in this paragraph needs mathematics beyond this page — the ellipse equation, vis-viva, and patience.

vis-viva: v² = GM·(2/r − 1/a) raise a by burning where v is already greatest (perigee)

The same code, both directions

Calendar-making runs the two-body problem backward (when was the sky like this?); mission design runs it forward (when will it be?). One table of correspondences:

mission questioncalendrical twinfunction here
When does the window open?When is the next conjunction?CYCLES · synodic entries
Where is the target at arrival?Where is the graha at the muhūrta?grahas(), kepler()
Flight time on the transfer ellipseTime between tithis on the lunar ellipsehelio(), solveElong()
Arrival epoch in mission elapsed timeArrival date in ten calendarstour.html → calendars()

Books that built this page

workwhy it matters here
Paul Schlyter, Computing Planetary Positions (online tutorial)The direct source of this engine's orbital elements and perturbation series. If you read one thing to audit chakra-core.js, read this.
Jean Meeus, Astronomical Algorithms (2nd ed., 1998)The standard reference for higher-precision methods; our Julian-day and calendar conversions follow its conventions.
E. Burgess (tr.), Sūrya Siddhānta (1860)The classical Indian engine in English — mean motions, epicycles, eclipse limits.
Āryabhaṭa, Āryabhaṭīya (499 CE; Shukla & Sarma tr.)Sine tables, rotation of the Earth, rational eclipse theory.
Bhāskara II, Siddhānta-Śiromaṇi (1150)Medieval synthesis; instantaneous motion anticipating calculus.
al-Bīrūnī, The Chronology of Ancient Nations (1000 CE; Sachau tr.)The founding text of comparative calendrics — this site's multi-tradition ribbon is its executable homage.
Dershowitz & Reingold, Calendrical Calculations (4th ed., 2018)The definitive algorithmic treatment of world calendars; our Hebrew and tabular-Hijrī arithmetic is cross-checkable against it.
Calendar Reform Committee (M.N. Saha, chair), Report (Govt. of India, 1955)Where the Lahiri ayanāṁśa and the national pañcāṅga standard come from.
N.C. Lahiri, Indian Ephemeris / Advance EphemerisThe working tables of the dṛk tradition this engine emulates.
Sewell & Dikshit, The Indian Calendar (1896)Classic conversion tables and the clearest statement of amānta/pūrṇimānta mechanics.
B.V. Raman; K.S. KrishnamurtiPrimary sources for the Raman and KP ayanāṁśa schools quoted in the comparison table.

Code map — every claim, one click from its proof

functioncomputes

All in src/chakra-core.js · exercised by the live test console and the 98-assertion node suite · ported byte-compatibly to C in lib/.

Seed a conversation with any AI

Self-contained prompts, tuned to get a good explanation on the first try. Copy one into your assistant of choice; add numbers from the observatory for a concrete session. The same prompts appear contextually inside Observatory Pro via the ✦ button.