Science-Related Programs Written by Jay Tanner in PHP v4 - v7.1.8
PHP Science Programs Collection

These PHP programs are some basic astronomy and science-related utilities.

U.S. Naval Observatory Earth Day/Night Viewer For Any Date and Time

This program calls a USNO API to compute and display a cylindrical Day/Night map of the Earth or a spherical view of the sunrise or sunset side of the Earth at any given moment within the 500 year period from 1700 to 2100.

Since the images originate on the USNO server, it may take several seconds to render and return an image depending on the server load and other unpredictable factors.  It will vary from time to time.

If the image is saved, it will still be saved at its full resolution.

RUN Demo            DOWNLOAD: usno_earth_day_night_viewer.7z
JD (Julian Day) Number Table For Any Year

This program computes a JD (Julian Day) number table for any given year within the range from the year −4714 to +9999 for both the old Julian and modern Gregorian calendars.

Applied calendar year convention:  Neg|Pos Year = BC|AD Year
There is no calendar year 0 (zero), by definition.

The year immediately following 1 BC (−1)  is 1 AD (+1)  and there is no calendar year zero in between when using this convention.

RUN Demo            DOWNLOAD: jd_number_table_for_any_year.7z
Basic Lunar Events Calculator

This program computes the basic geocentric lunar ephemeris statistics for any date, time and local time zone at any given moment within the 600-year span from 1600 to 2200. All computations are referred to the true ecliptic and equinox of the date.

It also computes ephemeris tables for any given month and comes with a set of 360 images of the moon at 1-degree intervals, used to display an image of the lunar phase to the nearest degree.

Geocentric coordinates, distance and phase image of the moon at any given moment:
Right Ascension
Distance in kilometers and miles
Phase Angle
Phase Description
Phase Image

Local dates, times, coordinates and distances of the quarter phases:
New Moon
First Quarter Moon
Full Moon
Last Quarter Moon

Local dates, times and coordinates of apogee - Moon at maximum orbital distance
Local dates, times and coordinates of perigee - Moon at minimum orbital distance

Ephemeris Model : NASA/JPL Development Ephemeris (DE405).
Applied Delta T : NASA polynomial expressions, resolved to nearest second.
Nutation Series : IAU 2000B Nutation Series.
Time Scale Used : Astronomical TT scale used for internal computations.

The DE405 ephemeris spans the 600-year range from 1600 Jan 01 to 2200 Dec 31
on the modern Gregorian calendar.

RUN Demo            DOWNLOAD: basic_lunar_events_calculator.7z
Basic DE405 Lunar Ephemeris Calculator

This program computes a basic DE405 lunar ephemeris for any given date in the 600-year range from 1600 to 2200.  It displays the phase of the moon computes the geocentric and topocentric lunar coordinates and distance for any given moment in the given range as well as the rising and setting times of the sun and moon.

It also computes all lunar quarter phases, apogees and perigees for the given month as well as radial and orbital velocities and several other useful numerical lunar statistics.

The complete package contains this PHP program script, the DE405 data file and a set of lunar phase images at 1-degree intervals from 0 to 360 degrees, so it is a rather large file, at about 15.8 meg as a compressed 7z archive.

RUN Demo            DOWNLOAD: de405_lunar_ephemeris_calculator.7z
U.S.A. Daylight Saving Time Schedule Calculator

This program computes the United States daylight saving time schedule for any given year from 1975 onward.

Between 1975 and the present, the rules for Daylight Saving Time in the USA have changed a few times, so this program takes those changes into account to give the historically correct starting and ending dates of Daylight Saving Time as far back as 1975.  Before 1975, there was no uniform federal schedule and the dates when Daylight Saving Time started and ended were inconsistently applied from state to state.

The program will display the rule used for the selected year or an error message if the given year is outside the valid range.

RUN Demo            DOWNLOAD: usa_daylight_saving_time.7z
EU Summer Time Schedule Calculator

This program computes the EU (European Union) summer time schedule for any given year from 2002 onward.  The program applies the rule implemented by the EU in 2002, but it does NOT cover historical years prior to that year.

RUN Demo            DOWNLOAD: eu_summer_time.7z
Integer Base (radix) Inter-Converter

This program converts any positive or negative integer X, given in any base from 2 to 36, into its equivalent in any other base, also from 2 to 36.

Since this version only works with integers, rather than generate an error, any decimal value will be truncated without rounding.

Arbitrary-precision arithmetic is used so the program can handle numbers out to hundreds or even thousands of digits with exact accuracy.

RUN Demo            DOWNLOAD: integer_base_interconverter.7z
Factorial Calculator

This program computes the arbitrary-precision factorial value for any integer value from 0 to 9999, to the exact digit, using the native PHP arbitrary-precision arithmetic to compute exact integer values.

Factorial values can quickly become very, very large, with hundreds or even thousands of digits. For example, the value of 9999 factorial consists of 35656 digits!

RUN Demo            DOWNLOAD: factorial_calculator.7z
Distance to Sphere Horizon Calculator

This program computes both the straight line-of-sight distance to the sea-level horizon and the surface or sailing distance to the horizon point.

The distance to the eye can be reckoned from the center of the sphere or from the surface, where distance from the surface means the minimum radar distance from the eye to the closest point on the sphere.

RUN Demo            DOWNLOAD: sphere_distance_to_horizon.7z
Sphere Properties Calculator

Let the basic properties of a uniform sphere be:

R = Radius = Distance from any point on the surface to the center of sphere
C = Circumference = Perimeter = Distance measured around the equator
A = Area of Surface
V = Volume

Given any ONE known (R, C, A, V) property of the sphere, this program will compute the other three unknown properties.

RUN Demo            DOWNLOAD: sphere_properties_calculator.7z
Standard Deviation Calculator

This program computes the sum, arithmetic mean, standard deviation and the population and sample variances for a given numerical data set representing a population or sample derived therefrom.

Simply copy/paste the numerical data into the text input area and the program does all the number-crunching work. The numerical data points can be delimited by spaces, commas or semicolons.  Any number of data points are allowed, so a data set can consist of hundreds or even 1000 or more data points.

RUN Demo            DOWNLOAD: standard_deviation_calculator.7z