KDE Core/Astronomical Calendars/Hindu
Introduction
Hindu Calendars are by far the nearest approaches to the actual machinery of astronomical phenomena governing life on our planet. (Hashim Amir Ali)
The are more than 30 variations of the calendars used in India, the best known of which is the classical Hindu Calendar Surya Siddhanta which is said to have been revealed to Asura Maya the Assyrian at the end of the last Golden Age (2,163,154 BCE). The Hindu lunisolar calendar is similar to the Chinese calendar, but varies in terms of application of fixed ancient methods to approximate true sun and true moon, based on sidereal year. Hindu longitudes are sidereal, having their origin near Piscium, the 6th brightest star in Pisces. However, having sidereal longitudes doesn't really affect the calculations. The calendar is lunisolar in the sense that it uses lunar months to approximate the sidereal year. The epoch used for Hindu calendars dates to January 23, -3101 in the Gregorian Calendar. The era in the Indian calendar is called the Vikram Era, or the Vikram Samvat, which began in 57 BCE.
There are two types of Hindu Lunisolar Calendars:
- Amanta - one which is based on new moon ending of the lunar month
- Parimanta - the other is based on full moon ending of the lunar month
We would be designing the Amanta Lunisolar Calendar for KCalendarSystem.
The Month
The amanta month runs from new moon to the next new moon. Each amanta month and hence the lunar year are expressed in integral number of civil days. The lunar month is either 29 or 30 civil days long but always comprises of 30 lunar days. In general, the month is named after the solar month in which the moment of its defining initial new moon falls. The month is divided into two halves, the sudi and the vadi. The sudi half is also known as the sukla paksha or the bright half-month, covering the time period from new moon to the next full moon. The vadi half, also known as the krishna paksha or the dark half-month, covers the period from the full moon to the next new moon.
There are twelve months in Hindu lunar Calendar:
- Chaitra (चैत्र, चैत)
- Vaishakh (वैशाख, बैसाख)
- Jyeshtha(ज्येष्ठ, जेठ)
- Ashadha (आषाढ, आषाढ़)
- Shravana (श्रावण, सावन)
- Bhadrapada (भाद्रपद, भादो)
- Ashwin (आश्विन)
- Kartik (कार्तिक)
- Margashirsha (मार्गशीर्ष, अगहन)
- Paush (पौष)
- Magh (माघ)
- Phalgun (फाल्गुन)
Leap Months
The lunar calendar year is shorter than the solar sidereal year and hence leap months are occasionally added at intervals to keep the lunar calendar and the solar calendar in sync. When a solar month completely covers a lunar month, that is when there are two new moons (one falling at the beginning and the other falling at the end of the solar month), the lunar month that begins at the first new moon is treated as a leap month and is prefixed with the title adhika. An adhika month generally occurs at average intervals of 2 years 8.4 months.
Missing Months
Very rarely, the lunar month can completely cover a solar month, i.e, there is no new moon falling in that solar month and hence no lunar month naming after it. This missing month is called the kshaya or decayed month. When a kshaya month occurs in a lunar year, there will always be two adhika months (one before and on after the kshaya month).
Days
In the Hindu calendar, the day starts with local sunrise. It is allotted five properties, called angas. They are:
- the tithi (one of 30 divisions of a synodic month) active at sunrise
- the vaasara, vaar (ravi-vaar, som-vaar, etc.) or weekday
- the nakshatra (one of 27 divisions of the celestial ecliptic) in which the moon resides at sunrise
- the yoga (one of 27 divisions based on theecliptic longitude of the sun and moon) active at sunrise
- the karana (divisions based on tithis) active at sunrise.
Together these are called the panchangas.
Vaar refers to the days of the week and bear striking similarities with the names of the week in many western cultures:
No. | Name of weekday | Celestial Object |
---|---|---|
1 | Ravi vaar रविवार | Sun |
2 | Soma vaar सोमवार | Moon |
3 | Mangala vaar मंगलवार | Mars |
4 | Budha vaar बुधवार | Mercury |
5 | Guru vaar गुरुवार or Bruhaspati vaar बृहस्पतिवार | Jupiter |
6 | Shukra vaar शुक्रवार | Venus |
7 | Shani vāsara शनिवार | Saturn |
Day numbers are determined by the tithi, the time required by the longitude of the moon to increase by 12 degrees over the longitude of the Sun. Sometimes we call it a lunar day. There are 29 or 30 days in a lunar month. Each day is assigned the number of the tithi in effect at sunrise,. However, days are not always counted serially from 1 to 29 or 30. To understand why, it is important to note the fact that the value of a tithi varies from 19.48 hours to 26.78 hours. A short tithi, may begin after sunrise and end before the next sunrise. In this case, a number is omitted from the day count and hence we have skipped a kshaya day. Similarly, a longer tithi may span two sunrises, i.e., there is no tithi ending in that day. Then a day number is carried over to the second day and is treated as a leap day, suffixed by the term adhika.
Research Sources
- Calendrical Calculations: Third Edition - Nachum Dershowitz and Edward M. Reingold
- Notes and Errata on Calendrical Calculations: Third Edition - 25th May 2011
- Astronomical Algorithms: First Edition - Jean Meeus
- Practical Astronomy with your Calculator: Third Edition - Peter Duffet-Smith
- How to compute planetary positions - Paul Schlyter
- Indian Calendars - Leow Choon Lian/Professor Helmer Aslaken
Astro Library
Most of the astronomical functions have already been described in the implementation of previous astronomical Calendars. A few functions were appended to the previously described Astro Library to implement the Hindu calendar, namely:
astrosolar.h
double precession(double time)
Calculates the precession value.
double bisectionSearch(double a, double b, bool c, bool d)
Returns the result of bisection search between the two values a and b depending upon the conditions c and d.
double solarLongitudeAtOrAfter(double longitude, double time)
Computes the solar longitude at or after a given moment of time.
KCalendarSystem API
To implement the Chinese calendar, certain changes had to be made in the KCalendar System API in order to incorporate features requiring leap months, namely:
QString monthName(double month, int year, MonthNameFormat format = LongName)
Gets specific calendar type month for a given date. The monthName() method is overloaded to use a double type value of the month returned by calculations.
bool julianDayToDate(int jd, int &year, double &month, double &day) const
Method to convert Julian day to calendar specific date.
bool dateToJulianDay(int year, double month, double day, int &jd) const
Method to convert calendar specific date to Julian day.
int daysInMonth(int year, double month) const
Returns the number of days in the given month of year. The double data type implements functionalities for leap months.
The Hindu Calendar
The header file defining the implementation of Hindu Lunisolar Calendar is kcalendarsystemhindu.h. It has defined two classes:
KCalendarSystemHindu
Class definition in the public domain, publicly inherited from KCalendarSystem. It re-implements the virtual functions defined in the KCalendarSystem class. The re-implemented functions are defined in the public domain of the class.
virtual QString calendarType() const
Returns the calendar system type.
virtual QDate epoch() const
Returns a QDate holding the epoch of the calendar system. Hindu epoch is defined on Julian Day 599466. (Kali Yug - January 23, -3101 in Gregorian Calendar).
virtual QDate earliestValidDate() const
Returns the earliest date valid in this calendar system implementation, i.e. epoch + 3044*The length of mean sidereal year, as this marks the beginning of the Vikrama Era
virtual QDate latestValidDate() const
Returns the latest date valid in this calendar system implementation, i.e. 9999*The length of mean sidereal year - 1
virtual bool isValid(int year, int month, int day) const
Returns whether a given date is valid in this calendar system.
virtual bool isValid(const QDate &date) const
Returns whether a given date is valid in this calendar system.
virtual bool isLeapYear(int year) const
Returns whether a given year is a leap year.
virtual bool isLeapYear(const QDate &date) const
Returns whether a given year(taken from the QDate) is a leap year.
virtual QString monthName(double month, int year, MonthNameFormat format = LongName) const
Gets specific calendar type month name for a given month number If an invalid month is specified, QString() is returned. The double data type is used to incorporate functionalities requiring leap months.
virtual QString monthName(const QDate &date, MonthNameFormat format = LongName) const
Gets specific calendar type month name for a given date.
virtual QString weekDayName(int weekDay, WeekDayNameFormat format = LongDayName) const
Gets specific calendar type week day name. If an invalid week day is specified, QString() is returned.
virtual QString weekDayName(const QDate &date, WeekDayNameFormat format = LongDayName) const
Gets specific calendar type week day name.
virtual int weekDayOfPray() const
Returns the weekday of pray for this calendar system, 7th day of the Hindu Week.
virtual bool isLunar() const
Returns whether the calendar is lunar. (False)
virtual bool isLunisolar() const
Returns whether the calendar is lunisolar. (True)
virtual bool isSolar() const
Returns whether the calendar is solar. (False)
virtual bool isProleptic() const
Returns whether the calendar is proleptic, i.e, supports dates before the epoch. (False)
KCalendarSystemHinduPrivate
Class definition in the private domain, publicy inherited from KCalendarSystemPrivate. It re-implements the virtual functions defined in the KCalendarSystem class. The re-implemented functions are defined in the public domain of the class.
virtual void loadDefaultEraList()
Gives the Era name of the Hindu Calendar, i.e. the Vikrama Era
virtual KLocale::CalendarSystem calendarSystem() const
Returns the calendar type.
virtual int monthsInYear(int year) const
Returns the number of months in the year used by this calendar system.
virtual int daysInMonth(int year, int month) const
Returns the number of days in a month used by this calendar system.
virtual int daysInYear(int year) const
Returns the number of days in a year used by this calendar system.
virtual int daysInWeek() const
Returns the number of days in a week used by this calendar system, i.e, 7.
virtual bool isLeapYear(int year) const
Checks whether a year is a leap year or not.
virtual bool hasLeapMonths() const
Returns true is this calendar system has leap months. The Hindu calendar has leap months.
virtual bool hasYearZero() const
Returns true is this calendar system uses year 0. The Hindu calendar doesn't have a year 0.
virtual int maxDaysInWeek() const
Returns the maximum number of days in a week in this calendar system, i.e, 7.
virtual int maxMonthsInYear() const
Returns the maximum number of months in a year in this calendar system, i.e. 13.
virtual int earliestValidYear() const
Returns the earliest valid year in this calendar system, i.e., year 1.
virtual int latestValidYear() const
Returns the latest valid year in this calendar system, i.e., year 9999.
virtual QString monthName(double month, int year, Locale::DateTimeComponentFormat format, bool possessive) const
Gets specific calendar type month name for a given month number If an invalid month is specified, QString() is returned.
virtual QString weekDayName(int weekDay, KLocale::DateTimeComponentFormat format) const
Gets specific calendar type weekday name for a given month number If an invalid weekday is specified, QString() is returned.
double meshaSankranti(int year)
Computes the solar longitude at or after Mesha Sankranti.
double siderealSolarLongitude(double time)
Computes the sidereal solar longitude.
int siderealZodiac(double time)
Returns sidereal zodiac based on sidereal solar longitude.
int hinduSunrise(int date)
Returns the time of dawn at the Hindu locale.
int hinduCalendarYear(double time)
Returns the Hindu calendar year at the given time.
void julianDayToHinduDate(int jd, int &year, double &month, bool &leapMonth, double &day, bool &leapDay)
Function used to convert Julian day to Hindu date.
void hinduDateToJulianDay(int year, double month, bool leapMonth, double day, bool leapDay, int &jd)
Function used to convert Hindu date to Julian day.
Astronomical Implementation
Re-implementations of the functions dateToJulianDay() and julianDayToDate() using the functions defined in the Astro Library.
bool julianDayToDate(int jd, int &year, double &month, double &day) const
Returns the date implemented in this calendar system from Julian day. It implements the previously defined julianDayToHinduDate() function.
bool dateToJulianDay(int &jd, int year, double month, double day) const
Returns the Julian day from the date in this calendar system. It implements the previously defined hinduDateToJulianDay() function.
The calculations for implementing the Hindu Calendar have been derived from the public domain Lisp code/Mathematical functions of Calendrical Calculations by Edward M. Reingold on the Illinois Institute of Technology website, and from the book Astronomical Algorithms by Jean Meeus