Function: calendar-bahai-verify-calculations

calendar-bahai-verify-calculations is an interactive and byte-compiled function defined in cal-bahai.el.gz.

Signature

(calendar-bahai-verify-calculations)

Documentation

Verify Bahá’í calendar calculations against official reference dates.

This function compares the astronomical calculations for Naw-Rúz and the Twin Holy Birthdays against official dates from the Bahá’í World Centre for the period 172-221 BE (2015-2064 CE).

The verification tests:
1. Naw-Rúz dates - calculated from the vernal equinox relative to
   sunset in Tehran.
2. Birth of the Báb dates - the first day following the eighth new
   moon after Naw-Rúz.
3. Birth of Bahá’u’lláh dates - the second day following the eighth
   new moon after Naw-Rúz.

Results are displayed in the *Bahá’í Calendar Verification* buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-bahai.el.gz
(defun calendar-bahai-verify-calculations ()
  "Verify Bahá’í calendar calculations against official reference dates.
This function compares the astronomical calculations for Naw-Rúz and
the Twin Holy Birthdays against official dates from the Bahá’í World
Centre for the period 172-221 BE (2015-2064 CE).

The verification tests:
1. Naw-Rúz dates - calculated from the vernal equinox relative to
   sunset in Tehran.
2. Birth of the Báb dates - the first day following the eighth new
   moon after Naw-Rúz.
3. Birth of Bahá’u’lláh dates - the second day following the eighth
   new moon after Naw-Rúz.

Results are displayed in the *Bahá’í Calendar Verification* buffer."
  (interactive)
  (let* ((nawruz-results (calendar-bahai--verify-nawruz))
         (twin-results (calendar-bahai--verify-twin-birthdays))
         (buf (get-buffer-create "*Bahá’í Calendar Verification*")))
    (with-current-buffer buf
      (erase-buffer)

      (insert "This report verifies the astronomical calculations against\n")
      (insert "official dates from the Bahá’í World Centre (172-221 BE).\n\n")

      ;; Naw-Rúz results
      (insert "───────────────────────────────────────────────────────────────\n")
      (insert "NAW-RÚZ VERIFICATION\n")
      (insert "───────────────────────────────────────────────────────────────\n")
      (insert (format "  Total years tested: %d\n" (plist-get nawruz-results :total)))
      (insert (format "  Correct:            %d\n" (plist-get nawruz-results :correct)))
      (insert (format "  Errors:             %d\n"
                      (length (plist-get nawruz-results :errors))))
      (when (plist-get nawruz-results :errors)
        (insert "\n  Discrepancies:\n")
        (dolist (err (plist-get nawruz-results :errors))
          (insert (format "    %d: expected %S, calculated %S\n"
                          (nth 0 err) (nth 1 err) (nth 2 err)))))
      (insert "\n")

      ;; Twin Holy Birthdays results
      (insert "───────────────────────────────────────────────────────────────\n")
      (insert "TWIN HOLY BIRTHDAYS VERIFICATION\n")
      (insert "───────────────────────────────────────────────────────────────\n")
      (insert (format "  Total years tested:      %d\n"
                      (plist-get twin-results :total)))
      (insert (format "  Birth of Báb correct:    %d\n"
                      (plist-get twin-results :bab-correct)))
      (insert (format "  Birth of Bahá’u’lláh correct: %d\n"
                      (plist-get twin-results :baha-correct)))
      (insert (format "  Errors:                  %d\n"
                      (length (plist-get twin-results :errors))))
      (when (plist-get twin-results :errors)
        (insert "\n  Discrepancies:\n")
        (dolist (err (plist-get twin-results :errors))
          (insert (format "    %d %s: expected %S, calculated %S\n"
                          (nth 0 err) (nth 1 err) (nth 2 err) (nth 3 err)))))
      (insert "\n")

      ;; Summary
      (insert "───────────────────────────────────────────────────────────────\n")
      (insert "SUMMARY\n")
      (insert "───────────────────────────────────────────────────────────────\n")
      (let ((total-errors (+ (length (plist-get nawruz-results :errors))
                             (length (plist-get twin-results :errors)))))
        (if (zerop total-errors)
            (progn
              (insert "  All calculations match official dates!\n\n")
              (insert "  The astronomical algorithms correctly compute:\n")
              (insert "  • Naw-Rúz from the vernal equinox/sunset in Tehran\n")
              (insert "  • Twin Holy Birthdays from the 8th new moon after Naw-Rúz\n"))
          (insert (format "  ✗ Total discrepancies: %d\n" total-errors))
          (insert "  Review the errors above for details.\n"))))

    (display-buffer buf)
    ;; Return results for programmatic use
    (list :nawruz nawruz-results :twin-birthdays twin-results)))