logo To Foot
© J R Stockton, ≥ 2009-08-13

Astronomy / Astronautics 3.

No-Frame * Framed Index * Frame This
Links within this site :-

JavaScript Calculations

For a general JavaScript calculator, in different versions, see Gravity 0, JavaScript/HTML/VBS Quick Trials, JavaScript Demos.

N.B. Developed in MSIE 4/6; now maintained in Firefox 3.0; occasionally checked in some other browsers.

General JavaScript functions are coded in include1.js and include3.js, and are shown in JavaScript Include Files.

Most values entered can now have spaces, e.g. as thousands separators; eval() is used in userIn(). Inputs can be expressions such as 29028*0.3048. Comment is allowed.

Some of these assume a spherical body. For Earth, use a circumference of 40,000 km or better (that matches the originally-intended size of the metre).

See JavaScript Date and Time Introduction ff. for details, and in Leap Seconds.

Functions Commonly Used on This Page

Note the scroll bar.

Depression of Horizon from Altitude


On Earth, the depression in degrees is close to the square root of the height in kilometres.

Elevation of Object from Position

Use consistent length units; approximate Earth size in kilometres is preloaded.

The initial value of Altitude is roughly correct for ISS; the Viewing Distance for the Glasgow-London latitude difference.

Drawing a matching diagram is left as an exercise for the reader.

Calculate one from the other two :-

The Viewing Distance calculation is iterative.

Mapping between an Orb and a Circle

A distant Orb is viewed, from directly above Longitude 0 on its Equator; its North is at the top. Its surface is seen as a circle, in which one can use centred Cartesian (X, Y) or Polar (r, θ) co-ordinates.

 Orb, after Dracos, with co-ords
- - - in the View - - - on the Orb    

Set the radius of the circle and the accuracy; enter a pair of values, and press the button under them to calculate the others. Angles are in degrees. It appears that X = xi = ξ and Y = eta = η.

Date Arithmetic

Gregorian. Press any button to calculate its line from the other two entries. Not d/m/y; year>99.


Use Days ± = 0 to check.

Time Conversion

Set current time
to both boxes

Set either box, press to convert from it

In UK summer, GMT is 01:00:00 less than Civil Time

For UNIX time_t to/from GMT, see in JavaScript Date and Time 2 : Demonstrations.

Leap Seconds Caveat.


The input is the argument, string or number, for JavaScript's new Date() giving at least year, month, and day; allowable notations are dependent on your browser (Date field separator /, integer seconds, optional Offset indicator). It can be a number, but not an expression, corresponding to the number of milliseconds since 1970-01-01 00:00:00 UTC; but caveat Leap Seconds.

Input :-  

( If your computer is correctly set )

I believe that these are strictly correct in all locations; but check. See in JavaScript Date and Time 2 : Demonstrations for running clocks and another converter, and Julian/Gregorian Calendar Date Conversion for conversions between Calendars and CMJD.

Adding and Subtracting Stellar Magnitudes

Magnitude is logarithmic; the brightest stars are about Mag 0 and the dimmest visible are about Mag 6. A difference of 5 magnitudes represents a factor of 100 in brightness, so +1 Mag is a factor of about 0.398. Avoid negative brightness. Doubling the distance reduces the magnitude by close to 1.5.


  Input a space-separated list of stellar magnitudes.
  To change between adding and subtracting stars,
  use an isolated + or - sign. Default is addition.

Travel Calculations

At 1 g in a Newtonian universe it takes a year or so to reach the speed of light. The Solar System is only about a light-day across; the nearest stars are several light-years away. Therefore, at 1 g the Newtonian approximation is good for local and interplanetary travel; but for interstellar travel the journey is substantially relativistic.

Distance from Acceleration and Time

Starting from rest :
  unit :
  unit :
Distance covered

Maximum speed

Month = 30.5 days, Year = 365.2425 days

For Newtonian travel, mid-point turn-over in order to stop halves the distance and speed.

Time for Distance at Acceleration

Starting from rest :
  unit :
  unit :

Month = 30.5 days, Year = 365.2425 days

Time unit :
Speed unit :



Speeds should match, but are differently calculated
Relativistic results have more rounding errors than Newtonian
Relativistic formulae, unverified, from :-
news:r.a.s.s 20041202 M-ID <41AF6646.BA2133B7@popd.ix.netcom.com>
news:u.s.a 20041209 M-ID <cp95t4$f2e$1@news8.svr.pol.co.uk>

Parallax and Resolution

For telescope resolution, use Baseline for Wavelength and Distance for Aperture; watch the units. Visible light is about 600 nm wavelength; enter about 6E-7 m. Accepts expressions :-

Astronomy / Astronautics Pages :- 1, 2, 3, 4
Gravity Index
Home Page
Mail: no HTML
© Dr J R Stockton, near London, UK.
All Rights Reserved.
These pages are tested mainly with Firefox 3.0 and W3's Tidy.
This site, http://www.merlyn.demon.co.uk/, is maintained by me.