sankhya
sankhya (Sanskrit: सांख्य — enumeration/analysis) is an ancient mathematical systems, historical calendar, and archaeoastronomy library for the AGNOS project.
Faithful implementations of computational traditions from eight civilizations, 10+ calendar systems, and archaeoastronomy tools — with cross-civilizational epoch correlation. Every algorithm cites its primary source. No other library in any language covers this scope.
Modules
| Module | Civilization | Era | Highlights |
|---|---|---|---|
mayan |
Maya | 2000 BCE+ | Vigesimal (base-20), Long Count calendar, Tzolkin, Haab, Venus tables, Calendar Round search |
babylonian |
Babylon | 2000–300 BCE | Sexagesimal (base-60), Saros cycle, Plimpton 322 triples, Heron's sqrt, lunar calendar, cuneiform display |
egyptian |
Egypt | 2000–1000 BCE | Unit fractions (Rhind Papyrus), doubling multiplication, stellar decans, Sothic cycle, hieroglyphic display |
vedic |
India | 800 BCE+ | Nikhilam multiplication, Sulba Sutra geometry, Katapayadi, Meru Prastara, Devanagari display |
chinese |
China | 500 BCE+ | Rod numerals, Chinese Remainder Theorem, magic squares, Sexagenary 60-year cycle, Unicode rod display |
greek |
Greece | 600 BCE–300 CE | Golden ratio, Sieve of Eratosthenes, Euclidean GCD, Archimedes' pi, Antikythera, isopsephy |
roman |
Rome | 500 BCE+ | Roman numeral conversion (I–MMMCMXCIX), canonical validation, arithmetic |
islamic |
Islamic Golden Age | 750–1258 CE | Al-Khwarizmi algebra, Khayyam cubics, completion of the square, Hijri calendar |
gregorian |
Global | 1582 CE+ | Proleptic Gregorian calendar, JDN conversion, leap years |
coptic |
Egypt/Ethiopia | 284 CE+ | 13-month Alexandrian calendar, Anno Martyrum |
persian |
Iran | 622 CE+ | Solar Hijri (Jalaali), 2820-year leap cycle, Nowruz |
hebrew |
Israel | 3761 BCE+ | Lunisolar, Metonic cycle, molad, dehiyyot, 6 year types |
aztec |
Mesoamerica | 1200–1521 CE | Tonalpohualli (260-day), Xiuhpohualli (365-day), Calendar Round |
epoch |
Cross-civilizational | — | Precession, precessional ages, Seven Sages, cycle alignment, unified convert() API |
astro |
Archaeoastronomy | — | Coordinate systems, star catalog, precession, heliacal rising, monument alignment |
Quick Start
use LongCount;
use babylonian;
use greek;
use roman;
// Convert days to Mayan Long Count
let lc = from_days.unwrap; // 13.0.0.0.0 (Dec 21, 2012)
assert_eq!;
// Babylonian square root (Heron's method, from YBC 7289 tablet)
let sqrt2 = babylonian_sqrt.unwrap;
assert!;
// Sieve of Eratosthenes
let primes = sieve;
assert_eq!;
// Roman numerals
assert_eq!;
assert_eq!;
Calendar Conversion
use ;
use ;
// Convert any date to every calendar system sankhya knows
let date = GregorianDate ;
let all = convert.unwrap;
println!; // 3 Nisan 5785 AM
println!; // 12 Farvardin 1404 AP
println!; // 23 Paremhat 1741 AM
println!; // Tonalpohualli date
Archaeoastronomy
use astro;
// Was Stonehenge aligned to the summer solstice?
let results = monument_alignment;
// Returns: SummerSolsticeSunrise match at ~50° azimuth
// Where was Thuban (the pyramid builders' pole star) in 2800 BCE?
let pos = star_position_at;
// Returns: Dec > 85° (near the celestial pole)
Features
| Feature | Default | Description |
|---|---|---|
avatara |
off | Saptarishi archetype profiles on MultiCalendarDate via avatara divine engine |
itihas |
off | Historical context: eras, civilizations, and events on MultiCalendarDate |
varna |
off | Script rendering: cuneiform, hieroglyphic, Devanagari, Greek alphabetic, CJK rod numerals |
logging |
off | Structured tracing via tracing-subscriber |
Building
Requirements
- Rust 1.89+ (MSRV)
- Dependencies: hisab, serde, thiserror, tracing
- Optional: avatara (archetype profiles), itihas (historical context), varna (script rendering)
License
GPL-3.0-only. See LICENSE.