├── .gitignore ├── astronomy ├── index.js └── moshier │ ├── index.js │ ├── plan404 │ ├── index.js │ ├── neptune.js │ ├── venus.js │ ├── mercury.js │ ├── earth.js │ └── moonlat.js │ ├── deflection.js │ ├── vearth.js │ ├── epsilon.js │ ├── aberration.js │ ├── lonlat.js │ ├── refraction.js │ ├── siderial.js │ ├── light.js │ ├── diurnal.js │ ├── constant.js │ ├── fk4fk5.js │ ├── altaz.js │ ├── sun.js │ ├── julian.js │ ├── precess.js │ ├── planet.js │ ├── body.js │ ├── star.js │ ├── processor.js │ ├── util.js │ ├── delta.js │ ├── moon.js │ ├── nutation.js │ ├── kepler.js │ ├── constellation.js │ └── transit.js ├── index.js ├── shortcut.js ├── hello.js ├── hello.html ├── package.json ├── README.md ├── common.js ├── styles.css ├── load.js ├── gruntfile.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | node_modules/* 3 | .grunt/* 4 | -------------------------------------------------------------------------------- /astronomy/index.js: -------------------------------------------------------------------------------- 1 | $ns = ephemeris.astronomy = {}; 2 | -------------------------------------------------------------------------------- /astronomy/moshier/index.js: -------------------------------------------------------------------------------- 1 | $ns = ephemeris.astronomy.moshier = {}; 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Ephemeris namespace 3 | */ 4 | $ns = ephemeris = {}; 5 | -------------------------------------------------------------------------------- /astronomy/moshier/plan404/index.js: -------------------------------------------------------------------------------- 1 | $ns = ephemeris.astronomy.moshier.plan404 = {}; 2 | -------------------------------------------------------------------------------- /shortcut.js: -------------------------------------------------------------------------------- 1 | $e = ephemeris; 2 | 3 | $copy = $e.copy; 4 | $is = $e.is; 5 | $make = $e.make; 6 | $def = $e.define; 7 | $assert = $e.assert; 8 | $moshier = $e.astronomy.moshier; 9 | $const = $e.astronomy.moshier.constant; 10 | $processor = $moshier.processor; 11 | $julian = $moshier.julian; 12 | $util = $moshier.util; 13 | -------------------------------------------------------------------------------- /hello.js: -------------------------------------------------------------------------------- 1 | const ephemeris = require('./build/ephemeris-0.1.0.js') 2 | 3 | var date = { year: 1986, month: 1, day: 1, hours: 1, minutes: 52, seconds: 0 }; 4 | 5 | $const.tlong = -71.10; // longitude 6 | $const.glat = 42.37; // latitude 7 | 8 | $processor.init(); 9 | 10 | var body = $moshier.body.sun; // + mercury, venus, moon, mars, jupiter, saturn, uranus, neptune, pluto, chiron, sirius 11 | 12 | $processor.calc(date, body); 13 | 14 | console.log(JSON.stringify(body.position, '', 2)); -------------------------------------------------------------------------------- /astronomy/moshier/deflection.js: -------------------------------------------------------------------------------- 1 | $ns.deflectioon = {}; 2 | 3 | $ns.deflectioon.calc = function (p, q, e, result) { 4 | var C; // double 5 | var i; // int 6 | 7 | C = 1.974e-8/($const.SE*(1.0+$const.qe)); 8 | for( i=0; i<3; i++ ) { 9 | $const.dp[i] = C*($const.pq*e[i]/$const.SE - $const.ep*q[i]/$const.SO); 10 | p[i] += $const.dp[i]; 11 | } 12 | 13 | result = result || {}; 14 | 15 | result.sunElongation = Math.acos ( -$const.ep )/$const.DTR; 16 | result.lightDeflection = $util.showcor( p, $const.dp ); 17 | 18 | return result; 19 | }; -------------------------------------------------------------------------------- /astronomy/moshier/vearth.js: -------------------------------------------------------------------------------- 1 | $ns.vearth = { 2 | jvearth: -1.0, 3 | vearth: [] 4 | }; 5 | 6 | $ns.vearth.calc = function (date) { 7 | var e = [], p = [], t; // double 8 | var i; // int 9 | 10 | if( date.julian == this.jvearth ) { 11 | return; 12 | } 13 | 14 | this.jvearth = date.julian; 15 | 16 | /* calculate heliocentric position of the earth 17 | * as of a short time ago. 18 | */ 19 | t = 0.005; 20 | $moshier.kepler.calc ({julian: date.julian - t}, $moshier.body.earth, e, p); 21 | 22 | for( i=0; i<3; i++ ) { 23 | this.vearth [i] = ($moshier.body.earth.position.rect [i] - e[i])/t; 24 | } 25 | }; -------------------------------------------------------------------------------- /hello.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ephemeris", 3 | "version": "0.1.0", 4 | "description": "Pure javascript implementation of ephemeris calculations for sun, planets, comets, asteroids and stars.", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/bittnkr/ephemeris" 8 | }, 9 | "main": "index.js", 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "keywords": [ 14 | "ephemeris", 15 | "Moshier" 16 | ], 17 | "author": "mivion", 18 | "license": "GPL-2", 19 | "devDependencies": { 20 | "grunt": "^1.0.1", 21 | "grunt-cli": "^1.2.0", 22 | "load-grunt-tasks": "^3.5.0", 23 | "grunt-contrib-concat": "^1.0.1", 24 | "grunt-contrib-uglify": "^1.0.1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /astronomy/moshier/epsilon.js: -------------------------------------------------------------------------------- 1 | $ns.epsilon = { 2 | /* The results of the program are returned in these 3 | * global variables: 4 | */ 5 | jdeps: -1.0, /* Date for which obliquity was last computed */ 6 | eps: 0.0, /* The computed obliquity in radians */ 7 | coseps: 0.0, /* Cosine of the obliquity */ 8 | sineps: 0.0 /* Sine of the obliquity */ 9 | }; 10 | 11 | $ns.epsilon.calc = function (date) { 12 | var T; // double 13 | 14 | if (date.julian == this.jdeps) { 15 | return; 16 | } 17 | T = (date.julian - 2451545.0)/36525.0; 18 | 19 | /* DE403 values. */ 20 | T /= 10.0; 21 | this.eps = ((((((((( 2.45e-10*T + 5.79e-9)*T + 2.787e-7)*T 22 | + 7.12e-7)*T - 3.905e-5)*T - 2.4967e-3)*T 23 | - 5.138e-3)*T + 1.9989)*T - 0.0175)*T - 468.33960)*T 24 | + 84381.406173; 25 | this.eps *= $const.STR; 26 | 27 | this.coseps = Math.cos( this.eps ); 28 | this.sineps = Math.sin( this.eps ); 29 | this.jdeps = date.julian; 30 | }; -------------------------------------------------------------------------------- /astronomy/moshier/aberration.js: -------------------------------------------------------------------------------- 1 | $ns.aberration = {}; 2 | 3 | $ns.aberration.calc = function (p, result) { 4 | var A, B, C; // double 5 | var betai, pV; // double 6 | var x = [], V = []; // double 7 | var i; // int 8 | 9 | /* Calculate the velocity of the earth (see vearth.c). 10 | */ 11 | $moshier.vearth.calc ($moshier.body.earth.position.date); 12 | betai = 0.0; 13 | pV = 0.0; 14 | for( i=0; i<3; i++ ) { 15 | A = $moshier.vearth.vearth [i]/$const.Clightaud; 16 | V[i] = A; 17 | betai += A*A; 18 | pV += p[i] * A; 19 | } 20 | /* Make the adjustment for aberration. 21 | */ 22 | betai = Math.sqrt( 1.0 - betai ); 23 | C = 1.0 + pV; 24 | A = betai/C; 25 | B = (1.0 + pV/(1.0 + betai))/C; 26 | 27 | for( i=0; i<3; i++ ) { 28 | C = A * p[i] + B * V[i]; 29 | x[i] = C; 30 | $const.dp[i] = C - p[i]; 31 | } 32 | 33 | result = result || {}; 34 | 35 | $util.showcor (p, $const.dp, result); 36 | for( i=0; i<3; i++ ) { 37 | p[i] = x[i]; 38 | } 39 | 40 | return result; 41 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Note: Need any help to support this project. Contributors are welcome!** 2 | 3 | Pure javascript implementation of ephemeris calculations for sun, planets, comets, asteroids and stars. 4 | 5 | This implementation based on Steve Moshier (http://www.moshier.net). 6 | 7 | Licensed under GPL version 2 (http://www.gnu.org/licenses/gpl-2.0.html). 8 | 9 | Please contribute in this project. 10 | 11 | ### Example 12 | ``` 13 | 14 | 30 | ``` 31 | -------------------------------------------------------------------------------- /common.js: -------------------------------------------------------------------------------- 1 | $ns.copy = function (target /*, source ... */) { 2 | if (target) { 3 | for (var i = arguments.length - 1; i > 0; i --) { 4 | var source = arguments [i]; 5 | if (source && source.hasOwnProperty) { 6 | for (var key in source) { 7 | if (source.hasOwnProperty (key)) { 8 | target [key] = source [key]; 9 | } 10 | } 11 | } 12 | } 13 | } 14 | return target; 15 | }; 16 | 17 | $ns.is = function (object, type) { 18 | var typeName = Object.prototype.toString.call (object).slice (8, -1); 19 | return ( 20 | object !== undefined && 21 | object !== null && 22 | type.name === typeName 23 | ); 24 | }; 25 | 26 | $ns.make = function (context, path) { 27 | if ($is (context, String)) { 28 | path = context; 29 | context = document; 30 | } 31 | 32 | if (path) { 33 | var paths = path.split ('.'); 34 | var key = paths.shift (); 35 | context [key] = context [key] || {}; 36 | context = $make (context [key], paths.join ('.')); 37 | } 38 | return context; 39 | }; 40 | 41 | $ns.define = function (context, path, object) { 42 | $copy ($make (context, path), object); 43 | }; 44 | 45 | $ns.assert = function (variable, value) { 46 | if (variable != value) { 47 | throw 'Assertion failed: ' + variable + ' != ' + value + '!'; 48 | } 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | font: 8pt Tahoma; 3 | } 4 | 5 | html { 6 | padding: 0; 7 | margin: 0; 8 | } 9 | 10 | canvas { 11 | margin: 0; 12 | padding: 0; 13 | border-top: 1px solid gray; 14 | border-left: 1px solid gray; 15 | border-bottom: 1px solid white; 16 | border-right: 1px solid white; 17 | background: white; 18 | } 19 | 20 | td { 21 | vertical-align: middle; 22 | /*width: 200px;*/ 23 | } 24 | 25 | input[type=button] { 26 | border-style: outset; 27 | border-width: 1px; 28 | border-color: white; 29 | } 30 | 31 | input[type=button]:active { 32 | border-style: inset; 33 | border-width: 1px; 34 | border-color: white; 35 | } 36 | 37 | textarea { 38 | padding: 0; 39 | margin: 0; 40 | border-style: inset; 41 | border-width: 1px; 42 | box-sizing: border-box; 43 | width: 100%; 44 | resize: none; 45 | /*height: 70px;*/ 46 | } 47 | 48 | textarea:disabled { 49 | background-color: lightgray; 50 | } 51 | 52 | select { 53 | width: 100%; 54 | } 55 | 56 | thead tr td { 57 | text-align: center; 58 | font-weight: bold; 59 | } 60 | 61 | body table { 62 | width: 100%; 63 | } 64 | 65 | body { 66 | width: 800px; 67 | margin: auto; 68 | padding: 0; 69 | background: #dcdcdc; 70 | } 71 | -------------------------------------------------------------------------------- /astronomy/moshier/lonlat.js: -------------------------------------------------------------------------------- 1 | $ns.lonlat = {}; 2 | 3 | $ns.lonlat.calc = function (pp, date, polar, ofdate, result) { 4 | var s = [], x, y, z, yy, zz, r; // double 5 | var i; // int 6 | 7 | result = result || {}; 8 | 9 | /* Make local copy of position vector 10 | * and calculate radius. 11 | */ 12 | r = 0.0; 13 | for( i=0; i<3; i++ ) { 14 | x = pp [i]; 15 | s [i] = x; 16 | r += x * x; 17 | } 18 | r = Math.sqrt(r); 19 | 20 | /* Precess to equinox of date J 21 | */ 22 | if( ofdate ) { 23 | $moshier.precess.calc ( s, date, -1 ); 24 | } 25 | 26 | /* Convert from equatorial to ecliptic coordinates 27 | */ 28 | $moshier.epsilon.calc (date); 29 | yy = s[1]; 30 | zz = s[2]; 31 | x = s[0]; 32 | y = $moshier.epsilon.coseps * yy + $moshier.epsilon.sineps * zz; 33 | z = -$moshier.epsilon.sineps * yy + $moshier.epsilon.coseps * zz; 34 | 35 | yy = $util.zatan2( x, y ); 36 | zz = Math.asin( z / r ); 37 | 38 | // longitude and latitude in decimal 39 | polar[0] = yy; 40 | polar[1] = zz; 41 | polar[2] = r; 42 | 43 | // longitude and latitude in h,m,s 44 | polar [3] = $util.dms (polar[0]); 45 | polar [4] = $util.dms (polar[1]); 46 | 47 | result [0] = polar [0]; 48 | result [1] = polar [1]; 49 | result [2] = polar [2]; 50 | result [3] = polar [3]; 51 | result [4] = polar [4]; 52 | 53 | return result; 54 | }; -------------------------------------------------------------------------------- /astronomy/moshier/refraction.js: -------------------------------------------------------------------------------- 1 | $ns.refraction = {}; 2 | 3 | /* Atmospheric refraction 4 | * Returns correction in degrees to be added to true altitude 5 | * to obtain apparent altitude. 6 | */ 7 | $ns.refraction.calc = function (alt) { 8 | var y, y0, D0, N, D, P, Q; // double 9 | var i; // int 10 | 11 | if( (alt < -2.0) || (alt >= 90.0) ) { 12 | return 0.0; 13 | } 14 | 15 | /* For high altitude angle, AA page B61 16 | * Accuracy "usually about 0.1' ". 17 | */ 18 | if( alt > 15.0 ) 19 | { 20 | D = 0.00452*$const.atpress/((273.0+$const.attemp)*Math.tan( $const.DTR*alt )); 21 | return D; 22 | } 23 | 24 | /* Formula for low altitude is from the Almanac for Computers. 25 | * It gives the correction for observed altitude, so has 26 | * to be inverted numerically to get the observed from the true. 27 | * Accuracy about 0.2' for -20C < T < +40C and 970mb < P < 1050mb. 28 | */ 29 | 30 | /* Start iteration assuming correction = 0 31 | */ 32 | y = alt; 33 | D = 0.0; 34 | /* Invert Almanac for Computers formula numerically 35 | */ 36 | P = ($const.atpress - 80.0)/930.0; 37 | Q = 4.8e-3 * ($const.attemp - 10.0); 38 | y0 = y; 39 | D0 = D; 40 | 41 | for( i=0; i<4; i++ ) { 42 | N = y + (7.31/(y+4.4)); 43 | N = 1.0/Math.tan ($const.DTR * N); 44 | D = N*P/(60.0 + Q * (N + 39.0)); 45 | N = y - y0; 46 | y0 = D - D0 - N; /* denominator of derivative */ 47 | 48 | if( (N != 0.0) && (y0 != 0.0) ) { 49 | /* Newton iteration with numerically estimated derivative */ 50 | N = y - N*(alt + D - y)/y0; 51 | } else { 52 | /* Can't do it on first pass */ 53 | N = alt + D; 54 | } 55 | 56 | y0 = y; 57 | D0 = D; 58 | y = N; 59 | } 60 | return D; 61 | }; -------------------------------------------------------------------------------- /astronomy/moshier/siderial.js: -------------------------------------------------------------------------------- 1 | $ns.siderial = {}; 2 | 3 | $ns.siderial.calc = function (date, tlong) { 4 | var jd0; // double /* Julian day at midnight Universal Time */ 5 | var secs; // double /* Time of day, UT seconds since UT midnight */ 6 | var eqeq, gmst, jd, T0, msday; // double 7 | /*long il;*/ 8 | 9 | /* Julian day at given UT */ 10 | jd = date.universal; // UT 11 | jd0 = Math.floor(jd); 12 | secs = date.julian - jd0; // UT 13 | if( secs < 0.5 ) { 14 | jd0 -= 0.5; 15 | secs += 0.5; 16 | } else { 17 | jd0 += 0.5; 18 | secs -= 0.5; 19 | } 20 | secs *= 86400.0; 21 | 22 | /* Julian centuries from standard epoch J2000.0 */ 23 | /* T = (jd - J2000)/36525.0; */ 24 | /* Same but at 0h Universal Time of date */ 25 | T0 = (jd0 - $const.j2000)/36525.0; 26 | 27 | /* The equation of the equinoxes is the nutation in longitude 28 | * times the cosine of the obliquity of the ecliptic. 29 | * We already have routines for these. 30 | */ 31 | $moshier.nutation.calclo(date); 32 | $moshier.epsilon.calc (date); 33 | /* nutl is in radians; convert to seconds of time 34 | * at 240 seconds per degree 35 | */ 36 | eqeq = 240.0 * $const.RTD * $moshier.nutation.nutl * $moshier.epsilon.coseps; 37 | /* Greenwich Mean Sidereal Time at 0h UT of date */ 38 | /* Corrections to Williams (1994) introduced in DE403. */ 39 | gmst = (((-2.0e-6*T0 - 3.e-7)*T0 + 9.27701e-2)*T0 + 8640184.7942063)*T0 40 | + 24110.54841; 41 | msday = (((-(4. * 2.0e-6)*T0 - (3. * 3.e-7))*T0 + (2. * 9.27701e-2))*T0 42 | + 8640184.7942063)/(86400.*36525.) + 1.0; 43 | 44 | /* Local apparent sidereal time at given UT */ 45 | gmst = gmst + msday*secs + eqeq + 240.0*tlong; 46 | /* Sidereal seconds modulo 1 sidereal day */ 47 | gmst = gmst - 86400.0 * Math.floor( gmst/86400.0 ); 48 | /* 49 | * il = gmst/86400.0; 50 | * gmst = gmst - 86400.0 * il; 51 | * if( gmst < 0.0 ) 52 | * gmst += 86400.0; 53 | */ 54 | return gmst; 55 | }; 56 | -------------------------------------------------------------------------------- /astronomy/moshier/light.js: -------------------------------------------------------------------------------- 1 | $ns.light = {}; 2 | 3 | $ns.light.calc = function (body, q, e) { 4 | var p = [], p0 = [], ptemp = []; // double 5 | var P, Q, E, t, x, y; // double 6 | var i, k; // int 7 | 8 | /* save initial q-e vector for display */ 9 | for( i=0; i<3; i++ ) { 10 | p0[i] = q[i] - e[i]; 11 | } 12 | 13 | E = 0.0; 14 | for( i=0; i<3; i++ ) { 15 | E += e[i]*e[i]; 16 | } 17 | E = Math.sqrt(E); 18 | 19 | for( k=0; k<2; k++ ) { 20 | P = 0.0; 21 | Q = 0.0; 22 | for( i=0; i<3; i++ ) { 23 | y = q[i]; 24 | x = y - e[i]; 25 | p[i] = x; 26 | Q += y * y; 27 | P += x * x; 28 | } 29 | P = Math.sqrt(P); 30 | Q = Math.sqrt(Q); 31 | /* Note the following blows up if object equals sun. */ 32 | t = (P + 1.97e-8 * Math.log( (E+P+Q)/(E-P+Q) ) )/173.1446327; 33 | $moshier.kepler.calc ({julian: $moshier.body.earth.position.date.julian - t}, body, q, ptemp ); 34 | } 35 | 36 | body.lightTime = 1440.0 * t; 37 | 38 | /* Final object-earth vector and the amount by which it changed. 39 | */ 40 | for( i=0; i<3; i++ ) { 41 | x = q[i] - e[i]; 42 | p[i] = x; 43 | $const.dp [i] = x - p0[i]; 44 | } 45 | body.aberration = $util.showcor (p0, $const.dp ); 46 | 47 | /* Calculate dRA/dt and dDec/dt. 48 | * The desired correction of apparent coordinates is relative 49 | * to the equinox of date, but the coordinates here are 50 | * for J2000. This introduces a slight error. 51 | * 52 | * Estimate object-earth vector t days ago. We have 53 | * p(?) = q(J-t) - e(J), and must adjust to 54 | * p(J-t) = q(J-t) - e(J-t) = q(J-t) - (e(J) - Vearth * t) 55 | * = p(?) + Vearth * t. 56 | */ 57 | $moshier.vearth.calc ($moshier.body.earth.position.date); 58 | 59 | for( i=0; i<3; i++ ) { 60 | p[i] += $moshier.vearth.vearth [i]*t; 61 | } 62 | 63 | var d = $util.deltap ( p, p0); /* see dms.c */ 64 | $const.dradt = d.dr; 65 | $const.ddecdt = d.dd; 66 | $const.dradt /= t; 67 | $const.ddecdt /= t; 68 | }; -------------------------------------------------------------------------------- /astronomy/moshier/diurnal.js: -------------------------------------------------------------------------------- 1 | $ns.diurnal = { 2 | /* Earth radii per au. */ 3 | DISFAC: 0.0 4 | }; 5 | 6 | /* Diurnal aberration 7 | * This formula is less rigorous than the method used for 8 | * annual aberration. However, the correction is small. 9 | */ 10 | $ns.diurnal.aberration = function (last, ra, dec, result) { 11 | var lha, coslha, sinlha, cosdec, sindec; // double 12 | var coslat, N, D; // double 13 | 14 | result = result || {}; 15 | result.ra = ra; 16 | result.dec = dec; 17 | 18 | lha = last - result.ra; 19 | coslha = Math.cos(lha); 20 | sinlha = Math.sin(lha); 21 | cosdec = Math.cos(result.dec); 22 | sindec = Math.sin(result.dec); 23 | coslat = Math.cos( $const.DTR*$const.tlat ); 24 | 25 | if( cosdec != 0.0 ) 26 | N = 1.5472e-6*$const.trho*coslat*coslha/cosdec; 27 | else 28 | N = 0.0; 29 | result.ra += N; 30 | 31 | D = 1.5472e-6*$const.trho*coslat*sinlha*sindec; 32 | result.dec += D; 33 | 34 | result.dRA = $const.RTS*N/15.0; 35 | result.dDec = $const.RTS*D; 36 | 37 | return result; 38 | }; 39 | 40 | /* Diurnal parallax, AA page D3 41 | */ 42 | $ns.diurnal.parallax = function (last, ra, dec, dist, result) { 43 | var cosdec, sindec, coslat, sinlat; // double 44 | var p = [], dp = [], x, y, z, D; // double 45 | 46 | result = result || {}; 47 | result.ra = ra; 48 | result.dec = dec; 49 | 50 | /* Don't bother with this unless the equatorial horizontal parallax 51 | * is at least 0.005" 52 | */ 53 | if( dist > 1758.8 ) { 54 | return result; 55 | } 56 | 57 | this.DISFAC = $const.au / (0.001 * $const.aearth); 58 | cosdec = Math.cos(result.dec); 59 | sindec = Math.sin(result.dec); 60 | 61 | /* Observer's astronomical latitude 62 | */ 63 | x = $const.tlat * $const.DTR; 64 | coslat = Math.cos(x); 65 | sinlat = Math.sin(x); 66 | 67 | /* Convert to equatorial rectangular coordinates 68 | * in which unit distance = earth radius 69 | */ 70 | D = dist * this.DISFAC; 71 | p[0] = D*cosdec*Math.cos(result.ra); 72 | p[1] = D*cosdec*Math.sin(result.ra); 73 | p[2] = D*sindec; 74 | 75 | dp[0] = -$const.trho*coslat*Math.cos(last); 76 | dp[1] = -$const.trho*coslat*Math.sin(last); 77 | dp[2] = -$const.trho*sinlat; 78 | 79 | x = p[0] + dp[0]; 80 | y = p[1] + dp[1]; 81 | z = p[2] + dp[2]; 82 | D = x*x + y*y + z*z; 83 | D = Math.sqrt(D); /* topocentric distance */ 84 | 85 | /* recompute ra and dec */ 86 | result.ra = $util.zatan2(x,y); 87 | result.dec = Math.asin(z/D); 88 | $util.showcor (p, dp, result); 89 | return result; 90 | }; -------------------------------------------------------------------------------- /astronomy/moshier/constant.js: -------------------------------------------------------------------------------- 1 | $ns.constant = { 2 | /* Standard epochs. Note Julian epochs (J) are measured in 3 | * years of 365.25 days. 4 | */ 5 | j2000: 2451545.0, /* 2000 January 1.5 */ 6 | b1950: 2433282.423, /* 1950 January 0.923 Besselian epoch */ 7 | j1900: 2415020.0, /* 1900 January 0, 12h UT */ 8 | RTOH: 12.0 / Math.PI, /* Radians to hours, minutes, seconds */ 9 | 10 | 11 | /* Conversion factors between degrees and radians */ 12 | DTR: 1.7453292519943295769e-2, 13 | RTD: 5.7295779513082320877e1, 14 | RTS: 2.0626480624709635516e5, /* arc seconds per radian */ 15 | STR: 4.8481368110953599359e-6, /* radians per arc second */ 16 | 17 | TPI: 2.0 * Math.PI, 18 | 19 | date: {}, /* Input date */ 20 | 21 | tlong: -71.13, /* Cambridge, Massachusetts */ // input for kinit 22 | tlat: 42.38, /* geocentric */ // input for kinit 23 | glat: 42.27, /* geodetic */ // input for kinit 24 | 25 | /* Parameters for calculation of azimuth and elevation 26 | */ 27 | attemp: 12.0, /* atmospheric temperature, degrees Centigrade */ // input for kinit 28 | atpress: 1010.0, /* atmospheric pressure, millibars */ // input for kinit 29 | 30 | /* If the following number 31 | * is nonzero, then the program will return it for delta T 32 | * and not calculate anything. 33 | */ 34 | dtgiven: 0.0, // input for kinit 35 | 36 | /* Distance from observer to center of earth, in earth radii 37 | */ 38 | trho: 0.9985, 39 | flat: 298.257222, 40 | height: 0.0, 41 | 42 | /* Radius of the earth in au 43 | Thanks to Min He for pointing out 44 | this needs to be initialized early. */ 45 | Rearth: 0.0, // calculated in kinit 46 | 47 | /* Constants used elsewhere. These are DE403 values. */ 48 | aearth: 6378137., /* Radius of the earth, in meters. */ 49 | au: 1.49597870691e8, /* Astronomical unit, in kilometers. */ 50 | emrat: 81.300585, /* Earth/Moon mass ratio. */ 51 | Clight: 2.99792458e5, /* Speed of light, km/sec */ 52 | Clightaud: 0.0, /* C in au/day */ 53 | 54 | /* approximate motion of right ascension and declination 55 | * of object, in radians per day 56 | */ 57 | dradt: 0.0, 58 | ddecdt: 0.0, 59 | 60 | SE: 0.0, /* earth-sun distance */ 61 | SO: 0.0, /* object-sun distance */ 62 | EO: 0.0, /* object-earth distance */ 63 | 64 | pq: 0.0, /* cosine of sun-object-earth angle */ 65 | ep: 0.0, /* -cosine of sun-earth-object angle */ 66 | qe: 0.0, /* cosine of earth-sun-object angle */ 67 | 68 | /* correction vector, saved for display */ 69 | dp: [], 70 | 71 | /* 72 | * Current kepler body 73 | */ 74 | body: {} 75 | }; -------------------------------------------------------------------------------- /load.js: -------------------------------------------------------------------------------- 1 | $ns.load = function () { 2 | var curDate = new Date (); 3 | var dateArea = document.getElementById ('$const.date'); 4 | dateArea.value = curDate.getDate () + '.' + (curDate.getMonth () + 1) + '.' + curDate.getFullYear () + ' ' + 5 | curDate.getHours () + ':' + curDate.getMinutes () + ':' + curDate.getSeconds () 6 | ; 7 | 8 | $e.update (); 9 | }; 10 | 11 | $ns.update = function () { 12 | var textAreas = document.body.getElementsByTagName ('textarea'); 13 | var selects = document.body.getElementsByTagName ('select'); 14 | var classes, ids, value, date; 15 | var i, j, key; 16 | 17 | //$processor.test (); 18 | 19 | // fill input 20 | if (textAreas) { 21 | for (i = 0; i < textAreas.length; i ++) { 22 | ids = textAreas [i].getAttribute ('id'); 23 | try { 24 | eval ('' + ids + ' = "' + textAreas [i].value + '"'); 25 | } catch (exception) { 26 | } 27 | } 28 | } 29 | 30 | if ($const.date) { 31 | var tokens = $const.date.split (' '); 32 | 33 | tokens [0] = tokens [0].split ('.'); 34 | tokens [1] = tokens [1].split (':'); 35 | 36 | date = { 37 | day: parseFloat (tokens [0][0]), 38 | month: parseFloat (tokens [0][1]), 39 | year: parseFloat (tokens [0][2]), 40 | hours: parseFloat (tokens [1][0]), 41 | minutes: parseFloat (tokens [1][1]), 42 | seconds: parseFloat (tokens [1][2]) 43 | }; 44 | $const.date = date; 45 | } 46 | 47 | $processor.init (); 48 | 49 | // fill input bodies 50 | if (selects) { 51 | for (i = 0; i < selects.length; i ++) { 52 | classes = selects [i].getAttribute ('class'); 53 | ids = selects [i].getAttribute ('id'); 54 | if (classes) { 55 | try { 56 | var selector = eval ('(' + classes + ')'); 57 | if (!selects [i].innerHTML) { 58 | var selections = []; 59 | for (key in selector) { 60 | if (selector.hasOwnProperty (key) && selector [key].key == key && key != 'earth') { 61 | selections.push (''); 62 | } 63 | } 64 | selects [i].innerHTML = selections; 65 | } 66 | eval (ids + ' = ' + classes + '.' + selects [i].value); 67 | } catch (exception) { 68 | } 69 | } 70 | } 71 | } 72 | 73 | $processor.calc (date, $const.body); 74 | 75 | // fill output 76 | if (textAreas) { 77 | for (i = 0; i < textAreas.length; i ++) { 78 | classes = (textAreas [i].getAttribute ('class') || '').split (' '); 79 | for (j = 0; j < classes.length; j ++) { 80 | try { 81 | value = eval ('(' + classes [j] + ')'); 82 | if (value || value === 0) { 83 | textAreas [i].value = value.join ? value.join ('\n') : value; 84 | break; 85 | } 86 | } catch (exception) { 87 | } 88 | } 89 | } 90 | } 91 | }; 92 | -------------------------------------------------------------------------------- /astronomy/moshier/fk4fk5.js: -------------------------------------------------------------------------------- 1 | $ns.fk4fk5 = { 2 | /* Factors to eliminate E terms of aberration 3 | */ 4 | A: [-1.62557e-6, -3.1919e-7, - 1.3843e-7], 5 | Ad: [1.244e-3, -1.579e-3, -6.60e-4], 6 | 7 | /* Transformation matrix for unit direction vector, 8 | * and motion vector in arc seconds per century 9 | */ 10 | Mat: [ 11 | 0.9999256782, -0.0111820611, -4.8579477e-3, 12 | 2.42395018e-6, -2.710663e-8, -1.177656e-8, 13 | 0.0111820610, 0.9999374784, -2.71765e-5, 14 | 2.710663e-8, 2.42397878e-6, -6.587e-11, 15 | 4.8579479e-3, -2.71474e-5, 0.9999881997, 16 | 1.177656e-8, -6.582e-11, 2.42410173e-6, 17 | -5.51e-4, -0.238565, 0.435739, 18 | 0.99994704, -0.01118251, -4.85767e-3, 19 | 0.238514, -2.667e-3, -8.541e-3, 20 | 0.01118251, 0.99995883, -2.718e-5, 21 | -0.435623, 0.012254, 2.117e-3, 22 | 4.85767e-3, -2.714e-5, 1.00000956 23 | ] 24 | }; 25 | 26 | /* Convert FK4 B1950.0 catalogue coordinates 27 | * to FK5 J2000.0 coordinates. 28 | * AA page B58. 29 | */ 30 | $ns.fk4fk5.calc = function (p, m, el) { 31 | var a, b, c; // double 32 | var u, v; // double array 33 | var R = []; // double 34 | var i, j; // int 35 | 36 | /* Note the direction vector and motion vector 37 | * are already supplied by rstar.c. 38 | */ 39 | a = 0.0; 40 | b = 0.0; 41 | for( i=0; i<3; i++ ) { 42 | m[i] *= $const.RTS; /* motion must be in arc seconds per century */ 43 | a += this.A[i] * p[i]; 44 | b += this.Ad[i] * p[i]; 45 | } 46 | /* Remove E terms of aberration from FK4 47 | */ 48 | for( i=0; i<3; i++ ) { 49 | R[i] = p[i] - this.A[i] + a * p[i]; 50 | R[i+3] = m[i] - this.Ad[i] + b * p[i]; 51 | } 52 | 53 | var u_i = 0; 54 | var v_i = 0; 55 | 56 | /* Perform matrix multiplication 57 | */ 58 | v = this.Mat; 59 | for( i=0; i<6; i++ ) { 60 | a = 0.0; 61 | u = R; 62 | for( j=0; j<6; j++ ) { 63 | a += u [u_i ++] * v [v_i ++];//*u++ * *v++; 64 | } 65 | if( i < 3 ) { 66 | p[i] = a; 67 | } else { 68 | m[i-3] = a; 69 | } 70 | } 71 | 72 | /* Transform the answers into J2000 catalogue entries 73 | * in radian measure. 74 | */ 75 | b = p[0]*p[0] + p[1]*p[1]; 76 | a = b + p[2]*p[2]; 77 | c = a; 78 | a = Math.sqrt(a); 79 | 80 | el.ra = $util.zatan2( p[0], p[1] ); 81 | el.dec = Math.asin( p[2]/a ); 82 | 83 | /* Note motion converted back to radians per (Julian) century */ 84 | el.raMotion = (p[0]*m[1] - p[1]*m[0])/($const.RTS*b); 85 | el.decMotion = (m[2]*b - p[2]*(p[0]*m[0] + p[1]*m[1]) )/($const.RTS*c*Math.sqrt(b)); 86 | 87 | if( el.parallax > 0.0 ) { 88 | c = 0.0; 89 | for( i=0; i<3; i++ ) { 90 | c += p[i] * m[i]; 91 | } 92 | 93 | /* divide by RTS to deconvert m (and therefore c) 94 | * from arc seconds back to radians 95 | */ 96 | el.velocity = c/(21.094952663 * el.parallax * $const.RTS * a); 97 | } 98 | el.parallax = el.parallax / a; /* a is dimensionless */ 99 | el.epoch = $const.j2000; 100 | }; -------------------------------------------------------------------------------- /gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function( grunt ) { 2 | 3 | // Dynamically load npm tasks 4 | require('load-grunt-tasks')(grunt); 5 | 6 | grunt.initConfig( { 7 | pkg: grunt.file.readJSON( 'package.json' ), 8 | 9 | srcFiles: ['index.js', 10 | 'common.js', 11 | 12 | 'astronomy/index.js', 13 | 14 | 'astronomy/moshier/index.js', 15 | 'astronomy/moshier/constant.js', 16 | 'astronomy/moshier/julian.js', 17 | 'astronomy/moshier/delta.js', 18 | 'astronomy/moshier/epsilon.js', 19 | 'astronomy/moshier/lonlat.js', 20 | 'astronomy/moshier/gplan.js', 21 | 'astronomy/moshier/precess.js', 22 | 'astronomy/moshier/util.js', 23 | 'astronomy/moshier/kepler.js', 24 | 'astronomy/moshier/body.js', 25 | 'astronomy/moshier/sun.js', 26 | 'astronomy/moshier/aberration.js', 27 | 'astronomy/moshier/altaz.js', 28 | 'astronomy/moshier/constellation.js', 29 | 'astronomy/moshier/deflection.js', 30 | 'astronomy/moshier/diurnal.js', 31 | 'astronomy/moshier/fk4fk5.js', 32 | 'astronomy/moshier/light.js', 33 | 'astronomy/moshier/moon.js', 34 | 'astronomy/moshier/nutation.js', 35 | 'astronomy/moshier/planet.js', 36 | 'astronomy/moshier/refraction.js', 37 | 'astronomy/moshier/siderial.js', 38 | 'astronomy/moshier/star.js', 39 | 'astronomy/moshier/transit.js', 40 | 'astronomy/moshier/vearth.js', 41 | 'astronomy/moshier/processor.js', 42 | 43 | 'astronomy/moshier/plan404/index.js', 44 | 'astronomy/moshier/plan404/mercury.js', 45 | 'astronomy/moshier/plan404/venus.js', 46 | 'astronomy/moshier/plan404/earth.js', 47 | 'astronomy/moshier/plan404/moonlr.js', 48 | 'astronomy/moshier/plan404/moonlat.js', 49 | 'astronomy/moshier/plan404/mars.js', 50 | 'astronomy/moshier/plan404/jupiter.js', 51 | 'astronomy/moshier/plan404/saturn.js', 52 | 'astronomy/moshier/plan404/uranus.js', 53 | 'astronomy/moshier/plan404/neptune.js', 54 | 'astronomy/moshier/plan404/pluto.js', 55 | 56 | 'shortcut.js' 57 | ], 58 | 59 | concat : { 60 | options: { 61 | stripBanners: true, 62 | banner: '/* <%= pkg.name %> v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */', 63 | process: function(src, filepath) { 64 | return '\n// ### Source: ' + filepath + '\n' + src; 65 | }, 66 | }, 67 | 68 | dist: { 69 | files: { 70 | 'build/<%= pkg.name %>-<%= pkg.version %>.js': "<%= srcFiles %>" 71 | }, 72 | }, 73 | }, 74 | 75 | uglify : { 76 | dist : { 77 | files : { 78 | 'build/<%= pkg.name %>-<%= pkg.version %>.min.js' : ['build/<%= pkg.name %>-<%= pkg.version %>.js'] 79 | } 80 | } 81 | } 82 | }); 83 | 84 | grunt.registerTask("default", [ 85 | "concat", 86 | "uglify" 87 | ]); 88 | 89 | grunt.registerTask( 'build', [ 90 | "concat", 91 | "uglify" 92 | ]); 93 | }; -------------------------------------------------------------------------------- /astronomy/moshier/altaz.js: -------------------------------------------------------------------------------- 1 | $ns.altaz = { 2 | azimuth: 0.0, 3 | elevation: 0.0, 4 | refracted_elevation: 0.0 5 | }; 6 | 7 | $ns.altaz.calc = function (pol, date, result) { 8 | var dec, cosdec, sindec, lha, coslha, sinlha; // double 9 | var ra, dist, last, alt, az, coslat, sinlat; // double 10 | var N, D, x, y, z, TPI; // double 11 | 12 | result = result || {}; 13 | 14 | ra = pol[0]; 15 | dec = pol[1]; 16 | dist = pol[2]; 17 | TPI = 2.0*Math.PI; 18 | 19 | /* local apparent sidereal time, seconds converted to radians 20 | */ 21 | last = $moshier.siderial.calc ( date, $const.tlong ) * $const.DTR/240.0; 22 | lha = last - ra; /* local hour angle, radians */ 23 | result.dLocalApparentSiderialTime = last; 24 | result.localApparentSiderialTime = $util.hms (last); 25 | 26 | /* Display rate at which ra and dec are changing 27 | */ 28 | /* 29 | *if( prtflg ) 30 | * { 31 | * x = RTS/24.0; 32 | * N = x*dradt; 33 | * D = x*ddecdt; 34 | * if( N != 0.0 ) 35 | * printf( "dRA/dt %.2f\"/h, dDec/dt %.2f\"/h\n", N, D ); 36 | * } 37 | */ 38 | 39 | result.diurnalAberation = $moshier.diurnal.aberration ( last, ra, dec ); 40 | ra = result.diurnalAberation.ra; 41 | dec = result.diurnalAberation.dec; 42 | 43 | /* Do rise, set, and transit times 44 | trnsit.c takes diurnal parallax into account, 45 | but not diurnal aberration. */ 46 | lha = last - ra; 47 | result.transit = $moshier.transit.calc ( date, lha, dec ); 48 | 49 | /* Diurnal parallax 50 | */ 51 | result.diurnalParallax = $moshier.diurnal.parallax (last, ra, dec, dist); 52 | ra = result.diurnalParallax.ra; 53 | dec = result.diurnalParallax.dec; 54 | 55 | /* Diurnal aberration 56 | */ 57 | /*diurab( last, &ra, &dec );*/ 58 | 59 | /* Convert ra and dec to altitude and azimuth 60 | */ 61 | cosdec = Math.cos(dec); 62 | sindec = Math.sin(dec); 63 | lha = last - ra; 64 | coslha = Math.cos(lha); 65 | sinlha = Math.sin(lha); 66 | 67 | /* Use the geodetic latitude for altitude and azimuth */ 68 | x = $const.DTR * $const.glat; 69 | coslat = Math.cos(x); 70 | sinlat = Math.sin(x); 71 | 72 | N = -cosdec * sinlha; 73 | D = sindec * coslat - cosdec * coslha * sinlat; 74 | az = $const.RTD * $util.zatan2( D, N ); 75 | alt = sindec * sinlat + cosdec * coslha * coslat; 76 | alt = $const.RTD * Math.asin(alt); 77 | 78 | /* Store results */ 79 | this.azimuth = az; 80 | this.elevation = alt; /* Save unrefracted value. */ 81 | 82 | /* Correction for atmospheric refraction 83 | * unit = degrees 84 | */ 85 | D = $moshier.refraction.calc ( alt ); 86 | alt += D; 87 | this.refracted_elevation = alt; 88 | 89 | /* Convert back to R.A. and Dec. 90 | */ 91 | y = Math.sin($const.DTR*alt); 92 | x = Math.cos($const.DTR*alt); 93 | z = Math.cos($const.DTR*az); 94 | sinlha = -x * Math.sin($const.DTR*az); 95 | coslha = y*coslat - x*z*sinlat; 96 | sindec = y*sinlat + x*z*coslat; 97 | lha = $util.zatan2( coslha, sinlha ); 98 | 99 | y = ra; /* save previous values, before refrac() */ 100 | z = dec; 101 | dec = Math.asin( sindec ); 102 | ra = last - lha; 103 | y = ra - y; /* change in ra */ 104 | while( y < - Math.PI ) { 105 | y += $const.TPI; 106 | } 107 | while( y > Math.PI ) { 108 | y -= $const.TPI; 109 | } 110 | y = $const.RTS*y/15.0; 111 | z = $const.RTS*(dec - z); 112 | 113 | result.atmosphericRefraction = { 114 | deg: D, 115 | dRA: y, 116 | dDec: z 117 | }; 118 | 119 | result.topocentric = { 120 | altitude: alt, 121 | azimuth: az, 122 | ra: ra, 123 | dec: dec, 124 | dRA: $util.hms (ra), 125 | dDec: $util.dms (dec) 126 | }; 127 | 128 | return result; 129 | }; -------------------------------------------------------------------------------- /astronomy/moshier/sun.js: -------------------------------------------------------------------------------- 1 | $ns.sun = {}; 2 | 3 | $ns.sun.calc = function () { 4 | var r, x, y, t; // double 5 | var ecr = [], rec = [], pol = []; // double 6 | var i; // int 7 | var d; 8 | //double asin(), modtp(), sqrt(), cos(), sin(); 9 | 10 | $moshier.body.sun.position = $moshier.body.sun.position || {}; 11 | 12 | /* Display ecliptic longitude and latitude. 13 | */ 14 | for( i=0; i<3; i++ ) { 15 | ecr[i] = - $moshier.body.earth.position.rect [i];//-rearth[i]; 16 | } 17 | r = $moshier.body.earth.position.polar [2]; //eapolar [2]; 18 | 19 | $moshier.body.sun.position.equinoxEclipticLonLat = $moshier.lonlat.calc (ecr, $moshier.body.earth.position.date, pol, 1); // TDT 20 | 21 | /* Philosophical note: the light time correction really affects 22 | * only the Sun's barymetric position; aberration is due to 23 | * the speed of the Earth. In Newtonian terms the aberration 24 | * is the same if the Earth is standing still and the Sun moving 25 | * or vice versa. Thus the following is actually wrong, but it 26 | * differs from relativity only in about the 8th decimal. 27 | * It should be done the same way as the corresponding planetary 28 | * correction, however. 29 | */ 30 | pol [2] = r; 31 | for( i=0; i<2; i++ ) { 32 | t = pol [2] / 173.1446327; 33 | /* Find the earth at time TDT - t */ 34 | $moshier.kepler.calc ({julian: $moshier.body.earth.position.date.julian - t}, $moshier.body.earth, ecr, pol ); 35 | } 36 | r = pol [2]; 37 | 38 | for( i=0; i<3; i++ ) { 39 | x = -ecr[i]; 40 | y = - $moshier.body.earth.position.rect [i]; //-rearth[i]; 41 | ecr[i] = x; /* position t days ago */ 42 | rec[i] = y; /* position now */ 43 | pol[i] = y - x; /* change in position */ 44 | } 45 | 46 | $copy ($moshier.body.sun.position, { 47 | date: $moshier.body.earth.position.date, 48 | lightTime: 1440.0*t, 49 | aberration: $util.showcor (ecr, pol) 50 | }); 51 | 52 | /* Estimate rate of change of RA and Dec 53 | * for use by altaz(). 54 | */ 55 | d = $util.deltap( ecr, rec); /* see dms.c */ 56 | $const.dradt = d.dr; 57 | $const.ddecdt = d.dd; 58 | $const.dradt /= t; 59 | $const.ddecdt /= t; 60 | 61 | 62 | /* There is no light deflection effect. 63 | * AA page B39. 64 | */ 65 | 66 | /* precess to equinox of date 67 | */ 68 | $moshier.precess.calc ( ecr, $moshier.body.earth.position.date, -1); 69 | 70 | for( i=0; i<3; i++ ) { 71 | rec[i] = ecr[i]; 72 | } 73 | 74 | /* Nutation. 75 | */ 76 | $moshier.epsilon.calc ($moshier.body.earth.position.date); 77 | $moshier.nutation.calc ($moshier.body.earth.position.date, ecr); 78 | 79 | /* Display the final apparent R.A. and Dec. 80 | * for equinox of date. 81 | */ 82 | $moshier.body.sun.position.constellation = $moshier.constellation.calc (ecr, $moshier.body.earth.position.date); 83 | 84 | $moshier.body.sun.position.apparent = $util.showrd (ecr, pol); 85 | 86 | /* Show it in ecliptic coordinates */ 87 | y = $moshier.epsilon.coseps * rec[1] + $moshier.epsilon.sineps * rec[2]; 88 | y = $util.zatan2( rec[0], y ) + $moshier.nutation.nutl; 89 | $moshier.body.sun.position.apparentLongitude = $const.RTD*y; 90 | var dmsLongitude = $util.dms (y); 91 | $moshier.body.sun.position.apparentLongitudeString = 92 | dmsLongitude.degree + '\u00B0' + 93 | dmsLongitude.minutes + '\'' + 94 | Math.floor (dmsLongitude.seconds) + '"' 95 | ; 96 | 97 | $moshier.body.sun.position.apparentLongitude30String = 98 | $util.mod30 (dmsLongitude.degree) + '\u00B0' + 99 | dmsLongitude.minutes + '\'' + 100 | Math.floor (dmsLongitude.seconds) + '"' 101 | ; 102 | 103 | $moshier.body.sun.position.geocentricDistance = -1; 104 | 105 | /* Report altitude and azimuth 106 | */ 107 | $moshier.body.sun.position.altaz = $moshier.altaz.calc ( pol, $moshier.body.earth.position.date ); 108 | }; -------------------------------------------------------------------------------- /astronomy/moshier/julian.js: -------------------------------------------------------------------------------- 1 | $ns.julian = {}; 2 | 3 | $ns.julian.calc = function (date) { 4 | var centuries; 5 | var year; 6 | var month; 7 | var b = 0; 8 | var c; 9 | var e; 10 | 11 | /* The origin should be chosen to be a century year 12 | * that is also a leap year. We pick 4801 B.C. 13 | */ 14 | year = date.year + 4800; 15 | if (date.year < 0) { 16 | year += 1; 17 | } 18 | 19 | /* The following magic arithmetic calculates a sequence 20 | * whose successive terms differ by the correct number of 21 | * days per calendar month. It starts at 122 = March; January 22 | * and February come after December. 23 | */ 24 | month = date.month; 25 | if (month <= 2) { 26 | month += 12; 27 | year -= 1; 28 | } 29 | e = Math.floor ((306 * (month + 1)) / 10); 30 | 31 | // number of centuries 32 | centuries = Math.floor (year / 100); 33 | 34 | if (date.year <= 1582) { 35 | if (date.year == 1582) { 36 | if (date.month < 10) { 37 | b = -38; 38 | } 39 | if (date.month > 10 || date.day >= 15) { 40 | // number of century years that are not leap years 41 | b = Math.floor ((centuries / 4) - centuries); 42 | } 43 | } 44 | else { b = -38; } //**** additional line to fix the bug ***** 45 | } else { 46 | b = Math.floor ((centuries / 4) - centuries); 47 | } 48 | 49 | // Julian calendar years and leap years 50 | c = Math.floor ((36525 * year) / 100); 51 | 52 | /* Add up these terms, plus offset from J 0 to 1 Jan 4801 B.C. 53 | * Also fudge for the 122 days from the month algorithm. 54 | */ 55 | date.julianDate = b + c + e + date.day - 32167.5; 56 | 57 | // Add time 58 | date.julianTime = (3600.0 * date.hours + 60.0 * date.minutes + date.seconds) / 86400.0; 59 | 60 | date.julian = date.julianDate + date.julianTime; 61 | 62 | date.j2000 = 2000.0 + (date.julian - $const.j2000) / 365.25; 63 | date.b1950 = 1950.0 + (date.julian - $const.b1950) / 365.25; 64 | date.j1900 = 1900.0 + (date.julian - $const.j1900) / 365.25; 65 | 66 | return date.julian; 67 | }; 68 | 69 | $ns.julian.toGregorian = function (date) { 70 | var month, day; // int 71 | var year, a, c, d, x, y, jd; // int 72 | var BC; // int 73 | var dd; // double 74 | var J = date.julian; 75 | 76 | /* January 1.0, 1 A.D. */ 77 | if( J < 1721423.5 ) { 78 | BC = 1; 79 | } else { 80 | BC = 0; 81 | } 82 | 83 | jd = Math.floor (J + 0.5); /* round Julian date up to integer */ 84 | 85 | /* Find the number of Gregorian centuries 86 | * since March 1, 4801 B.C. 87 | */ 88 | a = Math.floor ((100 * jd + 3204500)/3652425); 89 | 90 | /* Transform to Julian calendar by adding in Gregorian century years 91 | * that are not leap years. 92 | * Subtract 97 days to shift origin of JD to March 1. 93 | * Add 122 days for magic arithmetic algorithm. 94 | * Add four years to ensure the first leap year is detected. 95 | */ 96 | c = jd + 1486; 97 | if( jd >= 2299160.5 ) { 98 | c += a - Math.floor (a / 4); 99 | } else { 100 | c += 38; 101 | } 102 | /* Offset 122 days, which is where the magic arithmetic 103 | * month formula sequence starts (March 1 = 4 * 30.6 = 122.4). 104 | */ 105 | d = Math.floor ((100 * c - 12210)/36525); 106 | /* Days in that many whole Julian years */ 107 | x = Math.floor ((36525 * d) / 100); 108 | 109 | /* Find month and day. */ 110 | y = Math.floor (((c-x) * 100) / 3061); 111 | day = Math.floor (c - x - Math.floor ((306 * y) / 10)); 112 | month = Math.floor (y - 1); 113 | if ( y > 13 ) { 114 | month -= 12; 115 | } 116 | 117 | /* Get the year right. */ 118 | year = d - 4715; 119 | if (month > 2 ) { 120 | year -= 1; 121 | } 122 | 123 | /* Fractional part of day. */ 124 | dd = day + J - jd + 0.5; 125 | 126 | if (BC) { 127 | year = year - 1; 128 | } 129 | 130 | date.year = year; 131 | date.month = month; 132 | 133 | date.day = Math.floor (dd); 134 | 135 | /* Display fraction of calendar day 136 | * as clock time. 137 | */ 138 | a = Math.floor (dd); 139 | dd = dd - a; 140 | x = 2.0 * Math.PI * dd; 141 | 142 | $copy (date, $util.hms (x)); 143 | 144 | return date; 145 | }; 146 | -------------------------------------------------------------------------------- /astronomy/moshier/precess.js: -------------------------------------------------------------------------------- 1 | $ns.precess = { 2 | /* In WILLIAMS and SIMON, Laskar's terms of order higher than t^4 3 | have been retained, because Simon et al mention that the solution 4 | is the same except for the lower order terms. */ 5 | pAcof: [ 6 | /* Corrections to Williams (1994) introduced in DE403. */ 7 | -8.66e-10, -4.759e-8, 2.424e-7, 1.3095e-5, 1.7451e-4, -1.8055e-3, 8 | -0.235316, 0.076, 110.5414, 50287.91959 9 | ], 10 | /* Pi from Williams' 1994 paper, in radians. No change in DE403. */ 11 | nodecof: [ 12 | 6.6402e-16, -2.69151e-15, -1.547021e-12, 7.521313e-12, 1.9e-10, 13 | -3.54e-9, -1.8103e-7, 1.26e-7, 7.436169e-5, 14 | -0.04207794833, 3.052115282424 15 | ], 16 | /* pi from Williams' 1994 paper, in radians. No change in DE403. */ 17 | inclcof: [ 18 | 1.2147e-16, 7.3759e-17, -8.26287e-14, 2.503410e-13, 2.4650839e-11, 19 | -5.4000441e-11, 1.32115526e-9, -6.012e-7, -1.62442e-5, 20 | 0.00227850649, 0.0 21 | ] 22 | }; 23 | 24 | /* Precession of the equinox and ecliptic 25 | * from epoch Julian date J to or from J2000.0 26 | * 27 | * Subroutine arguments: 28 | * 29 | * R = rectangular equatorial coordinate vector to be precessed. 30 | * The result is written back into the input vector. 31 | * J = Julian date 32 | * direction = 33 | * Precess from J to J2000: direction = 1 34 | * Precess from J2000 to J: direction = -1 35 | * Note that if you want to precess from J1 to J2, you would 36 | * first go from J1 to J2000, then call the program again 37 | * to go from J2000 to J2. 38 | */ 39 | $ns.precess.calc = function (R, date, direction) { 40 | var A, B, T, pA, W, z; // double 41 | var x = []; // double 42 | var p; // double array 43 | var p_i = 0; 44 | var i; // int 45 | 46 | if( date.julian == $const.j2000 ) { 47 | return; 48 | } 49 | /* Each precession angle is specified by a polynomial in 50 | * T = Julian centuries from J2000.0. See AA page B18. 51 | */ 52 | T = (date.julian - $const.j2000) / 36525.0; 53 | 54 | /* Implementation by elementary rotations using Laskar's expansions. 55 | * First rotate about the x axis from the initial equator 56 | * to the ecliptic. (The input is equatorial.) 57 | */ 58 | if (direction == 1) { 59 | $moshier.epsilon.calc (date); /* To J2000 */ 60 | } else { 61 | $moshier.epsilon.calc ({julian: $const.j2000}); /* From J2000 */ 62 | } 63 | x[0] = R[0]; 64 | z = $moshier.epsilon.coseps*R[1] + $moshier.epsilon.sineps*R[2]; 65 | x[2] = -$moshier.epsilon.sineps*R[1] + $moshier.epsilon.coseps*R[2]; 66 | x[1] = z; 67 | 68 | /* Precession in longitude 69 | */ 70 | T /= 10.0; /* thousands of years */ 71 | p = this.pAcof; 72 | pA = p [p_i ++]; //*p++; 73 | for( i=0; i<9; i++ ) { 74 | pA = pA * T + p [p_i ++]; //*p++; 75 | } 76 | pA *= $const.STR * T; 77 | 78 | /* Node of the moving ecliptic on the J2000 ecliptic. 79 | */ 80 | p = this.nodecof; 81 | p_i = 0; 82 | W = p [p_i ++]; //*p++; 83 | for( i=0; i<10; i++ ) { 84 | W = W * T + p [p_i ++]; //*p++; 85 | } 86 | 87 | /* Rotate about z axis to the node. 88 | */ 89 | if( direction == 1 ) { 90 | z = W + pA; 91 | } else { 92 | z = W; 93 | } 94 | B = Math.cos(z); 95 | A = Math.sin(z); 96 | z = B * x[0] + A * x[1]; 97 | x[1] = -A * x[0] + B * x[1]; 98 | x[0] = z; 99 | 100 | /* Rotate about new x axis by the inclination of the moving 101 | * ecliptic on the J2000 ecliptic. 102 | */ 103 | p = this.inclcof; 104 | p_i = 0; 105 | z = p [p_i ++]; //*p++; 106 | for( i=0; i<10; i++ ) { 107 | z = z * T + p [p_i ++]; //*p++; 108 | } 109 | if( direction == 1 ) { 110 | z = -z; 111 | } 112 | B = Math.cos(z); 113 | A = Math.sin(z); 114 | z = B * x[1] + A * x[2]; 115 | x[2] = -A * x[1] + B * x[2]; 116 | x[1] = z; 117 | 118 | /* Rotate about new z axis back from the node. 119 | */ 120 | if( direction == 1 ) { 121 | z = -W; 122 | } else { 123 | z = -W - pA; 124 | } 125 | B = Math.cos(z); 126 | A = Math.sin(z); 127 | z = B * x[0] + A * x[1]; 128 | x[1] = -A * x[0] + B * x[1]; 129 | x[0] = z; 130 | 131 | /* Rotate about x axis to final equator. 132 | */ 133 | if( direction == 1 ) { 134 | $moshier.epsilon.calc ({julian: $const.j2000}); 135 | } else { 136 | $moshier.epsilon.calc ( date ); 137 | } 138 | z = $moshier.epsilon.coseps * x[1] - $moshier.epsilon.sineps * x[2]; 139 | x[2] = $moshier.epsilon.sineps * x[1] + $moshier.epsilon.coseps * x[2]; 140 | x[1] = z; 141 | 142 | for( i=0; i<3; i++ ) { 143 | R[i] = x[i]; 144 | } 145 | }; -------------------------------------------------------------------------------- /astronomy/moshier/planet.js: -------------------------------------------------------------------------------- 1 | $ns.planet = {}; 2 | 3 | $ns.planet.calc = function (body) { 4 | this.prepare (body); 5 | 6 | /* calculate heliocentric position of the object */ 7 | $moshier.kepler.calc ($moshier.body.earth.position.date, body); 8 | /* apply correction factors and print apparent place */ 9 | this.reduce (body, body.position.rect, $moshier.body.earth.position.rect); 10 | }; 11 | 12 | /* The following program reduces the heliocentric equatorial 13 | * rectangular coordinates of the earth and object that 14 | * were computed by kepler() and produces apparent geocentric 15 | * right ascension and declination. 16 | */ 17 | $ns.planet.reduce = function (body, q, e) { 18 | var p = [], temp = [], polar = []; // double 19 | var a, b, r, s, x; // double 20 | var i; // int 21 | 22 | /* Save the geometric coordinates at TDT 23 | */ 24 | for ( i=0; i<3; i++ ) { 25 | temp[i] = q[i]; 26 | } 27 | 28 | /* Display ecliptic longitude and latitude, precessed to equinox 29 | of date. */ 30 | body.equinoxEclipticLonLat = $moshier.lonlat.calc (q, $moshier.body.earth.position.date, polar, 1 ); 31 | 32 | /* Adjust for light time (planetary aberration) 33 | */ 34 | $moshier.light.calc ( body, q, e ); 35 | 36 | /* Find Euclidean vectors between earth, object, and the sun 37 | */ 38 | for( i=0; i<3; i++ ) { 39 | p[i] = q[i] - e[i]; 40 | } 41 | 42 | $util.angles ( p, q, e ); 43 | 44 | a = 0.0; 45 | for( i=0; i<3; i++ ) { 46 | b = temp[i] - e[i]; 47 | a += b * b; 48 | } 49 | a = Math.sqrt(a); 50 | body.position.trueGeocentricDistance = a; /* was EO */ 51 | body.position.equatorialDiameter = 2.0*body.semiDiameter / $const.EO; 52 | 53 | /* Calculate radius. 54 | */ 55 | r = 0.0; 56 | x = 0.0; 57 | for( i=0; i<3; i++ ) { 58 | x = p[i]; 59 | r += x * x; 60 | } 61 | r = Math.sqrt(r); 62 | 63 | /* Calculate visual magnitude. 64 | * "Visual" refers to the spectrum of visible light. 65 | * Phase = 0.5(1+pq) = geometric fraction of disc illuminated. 66 | * where pq = cos( sun-object-earth angle ) 67 | * The magnitude is 68 | * V(1,0) + 2.5 log10( SE^2 SO^2 / Phase) 69 | * where V(1,0) = elemnt->mag is the magnitude at 1au from 70 | * both earth and sun and 100% illumination. 71 | */ 72 | a = 0.5 * (1.0 + $const.pq); 73 | /* Fudge the phase for light leakage in magnitude estimation. 74 | * Note this phase term estimate does not reflect reality well. 75 | * Calculated magnitudes of Mercury and Venus are inaccurate. 76 | */ 77 | b = 0.5 * (1.01 + 0.99*$const.pq); 78 | s = body.magnitude + 2.1715 * Math.log( $const.EO*$const.SO ) - 1.085*Math.log(b); 79 | body.position.approxVisual = { 80 | magnitude: s, 81 | phase: a 82 | }; 83 | 84 | /* Find unit vector from earth in direction of object 85 | */ 86 | for( i=0; i<3; i++ ) { 87 | p[i] /= $const.EO; 88 | temp[i] = p[i]; 89 | } 90 | 91 | /* Report astrometric position 92 | */ 93 | body.position.astrometricJ2000 = $util.showrd (p, polar ); 94 | 95 | /* Also in 1950 coordinates 96 | */ 97 | $moshier.precess.calc ( temp, {julian: $const.b1950}, -1 ); 98 | body.position.astrometricB1950 = $util.showrd (temp, polar ); 99 | 100 | /* Correct position for light deflection 101 | */ 102 | body.position.deflection = $moshier.deflectioon.calc ( p, q, e ); // relativity 103 | 104 | /* Correct for annual aberration 105 | */ 106 | body.position.aberration = $moshier.aberration.calc (p); 107 | 108 | /* Precession of the equinox and ecliptic 109 | * from J2000.0 to ephemeris date 110 | */ 111 | $moshier.precess.calc ( p, $moshier.body.earth.position.date, -1 ); 112 | 113 | /* Ajust for nutation 114 | * at current ecliptic. 115 | */ 116 | $moshier.epsilon.calc ( $moshier.body.earth.position.date ); 117 | body.position.nutation = $moshier.nutation.calc ( $moshier.body.earth.position.date, p ); 118 | 119 | /* Display the final apparent R.A. and Dec. 120 | * for equinox of date. 121 | */ 122 | body.position.constellation = $moshier.constellation.calc (p, $moshier.body.earth.position.date); 123 | body.position.apparent = $util.showrd (p, polar); 124 | 125 | /* Geocentric ecliptic longitude and latitude. */ 126 | for( i=0; i<3; i++ ) { 127 | p[i] *= $const.EO; 128 | } 129 | body.position.apparentGeocentric = $moshier.lonlat.calc ( p, $moshier.body.earth.position.date, temp, 0 ); 130 | body.position.apparentLongitude = body.position.apparentGeocentric [0] * $const.RTD; 131 | body.position.apparentLongitudeString = 132 | body.position.apparentGeocentric [3].degree + '\u00B0' + 133 | body.position.apparentGeocentric [3].minutes + '\'' + 134 | Math.floor (body.position.apparentGeocentric [3].seconds) + '"' 135 | ; 136 | 137 | body.position.apparentLongitude30String = 138 | $util.mod30 (body.position.apparentGeocentric [3].degree) + '\u00B0' + 139 | body.position.apparentGeocentric [3].minutes + '\'' + 140 | Math.floor (body.position.apparentGeocentric [3].seconds) + '"' 141 | ; 142 | 143 | body.position.geocentricDistance = r; 144 | 145 | /* Go do topocentric reductions. 146 | */ 147 | polar[2] = $const.EO; 148 | body.position.altaz = $moshier.altaz.calc (polar, $moshier.body.earth.position.date); 149 | }; 150 | 151 | $ns.planet.prepare = function (body) { 152 | if (!body.semiAxis) { 153 | body.semiAxis = body.perihelionDistance / (1 - body.eccentricity); 154 | } 155 | }; 156 | -------------------------------------------------------------------------------- /astronomy/moshier/plan404/neptune.js: -------------------------------------------------------------------------------- 1 | $ns.neptune = { 2 | maxargs: 9, 3 | max_harmonic: [0, 0, 0, 0, 3, 8, 7, 9, 0], 4 | max_power_of_t: 3, 5 | distance: 3.0110386869399999e+01, 6 | timescale: 3652500.0, 7 | trunclvl: 1.0, 8 | lon_tbl: [-1376.86480, 730.38970, 78655362.50948, 1095691.38676, -196.19023, 2086.77782, -122.04650, -276.81592, 184.56164, -148.08924, 3.39142, -14.75027, -9.22741, 0.87688, -0.13903, -0.44707, -0.17668, -0.36299, -0.12682, -0.26636, -0.51426, -0.24667, -0.04965, -0.03177, 0.05050, -0.00249, -0.80362, -0.07363, -0.15436, -0.07180, 2.45034, -3.50145, 0.86698, 0.09777, 7.72386, 7.16565, 2.10273, 8.86682, 2.44705, 77.90155, 0.28323, -11.87157, -13.64083, 252.70556, -4.94214, -6.17988, -305.60504, 51.23962, -2759.81719, 2476.20912, 12.65762, 13.31543, 0.36996, -0.19077, 0.67363, 0.36737, 0.02312, 0.02216, 0.09953, 0.04777, -0.00572, -0.02772, -0.02478, -0.21920, -0.15289, -1.50784, -0.17822, 0.34638, -0.70473, -8.61559, -2.65756, 1.25632, -0.31453, -1.40348, -4.02571, -1.50467, -69.62308, 3.21315, 0.69973, 0.08832, -0.00551, -0.04964, -0.02264, -0.34881, 0.00762, -1.85072, 0.01407, -0.30457, -0.09851, -0.02372, -0.07729, -0.11602, -0.75995, -0.71884, -0.08585, -0.30406, 0.45818, 0.14921, -0.01033, -0.11776, 0.00640, -0.57717, -0.01014, -0.01357, -0.00544, -0.02168, 0.40468, 0.28195, 0.00668, 0.14448, 0.01245, -0.08956, -0.26283, 0.01864, -0.00641, 18.55347, 0.01460, 0.08284, -0.04785, 0.11360, -0.33861, 0.01327, -0.06392, -0.18758, 0.05449, -0.05583, -0.00435, -0.09869, -0.00286, -0.04613, -0.00395, -0.14564, -0.01385, -0.01762, 0.21160, -0.61631, -0.52100, -0.04583, 0.32812, 0.32138, 0.04749, -0.05724, 0.11239, 0.13216, -0.01203, 0.40084, -0.05207, 34.07903, -0.21457, -0.34938, -0.04594, 0.11198, -0.30662, -0.20776, -0.01076, -0.10959, 0.10891, -0.10304, -0.28141, 0.25061, -0.20293, 0.79930], 9 | lat_tbl: [-391.05987, -243.95958, -23.83558, 58.13857, 5.04859, -3.93183, -14.21914, 7.14247, -12.09415, -9.70132, 1.04307, 0.47323, -0.07504, 0.70575, -0.05239, 0.00482, -0.02916, 0.00877, -0.00528, -0.00286, 0.00028, -0.00228, -0.00056, -0.00149, 0.00049, 0.00047, -0.18765, -0.59571, 0.03742, -0.14653, 2.30535, 0.65092, 0.42216, 0.24521, -2.86932, 2.37808, -0.58456, 0.27446, -1.12264, -2.04413, -11.71318, -1.41554, -23.30671, -24.70499, 8.82738, 85.64657, -90.02223, 22.42604, -4749.41359, -4244.46820, 25.20811, -18.51469, -1.19892, -0.61067, 0.67734, -1.08912, -0.01607, 0.00626, -0.00008, 0.00126, -0.00330, -0.00078, -0.01503, 0.00758, -0.13208, -0.00218, -0.04522, 0.20297, -0.94708, -0.77897, -2.74075, -3.01122, -1.03394, 0.00886, 1.55485, -4.68416, -0.13244, -57.26983, 0.05589, -0.55396, -0.00130, 0.00526, -0.01028, 0.02086, 0.01334, 0.00699, 0.08565, 0.02020, 0.01001, -0.08402, 0.08558, -0.04488, 0.57268, -0.59574, 0.00807, 0.00492, 0.21993, -0.18949, -0.00396, 0.00735, 0.00487, 0.00230, 0.00699, -0.00473, 0.01406, -0.00139, 0.00738, 0.00099, 0.00161, 0.00019, -0.00067, -0.00047, 0.00572, -0.00486, -0.00842, 0.00322, 0.00018, -0.00109, -0.00272, 0.00112, -0.00041, 0.00763, 0.00211, 0.00118, -0.46842, -0.17877, 0.00209, -0.00179, 0.00090, -0.00075, 0.00618, 0.00610, 0.00015, 0.00032, -0.00123, 0.00026, 0.00332, 0.00135, 0.39130, -0.34727, 0.00015, -0.00027, -0.00026, -0.00052, 0.00162, 0.00913, -0.00697, 0.00308, -0.00333, -0.00258, -0.00117, 0.00035, 0.00766, 0.00194, 0.00135, 0.00067, -0.41171, 0.24241, 0.00106, 0.00025, 0.00013, -0.00019], 10 | rad_tbl: [-767.68936, -460.59576, -52.41861, -273.85897, 59.52489, 1.85006, -39.64750, 23.63348, -34.60399, -23.41681, 2.74937, 1.55389, 0.20343, 2.15502, -0.12846, 0.07199, -0.07555, 0.05582, -0.04354, 0.01546, -0.03931, 0.07623, -0.00491, 0.00661, 0.00322, 0.01540, -0.06741, -0.35343, 0.00469, -0.08073, 1.94975, 0.66376, 0.06137, 0.31426, -2.93841, 4.27732, -4.00342, 1.11157, -36.87785, 1.24960, 4.69573, 2.15164, -114.24899, -6.69320, 12.99919, -9.47795, -21.82350, -156.88624, -1237.19769, -1379.88864, 6.54369, -6.20873, -0.14163, -0.32700, 0.17937, -0.34864, 0.01393, -0.01286, 0.02876, -0.05767, 0.02210, -0.00128, 0.16495, -0.01242, 1.15915, -0.10365, -0.33224, -0.10045, 6.83719, -0.27499, -0.31284, -0.94332, 1.63704, -0.33318, 1.48134, -1.32257, 0.96498, -8.31047, -0.00402, -0.09441, 0.04292, -0.00444, 0.30325, -0.02012, 1.67999, 0.00353, 0.00467, 0.03556, 0.01393, -0.01229, 0.01188, -0.01390, 0.04615, -0.03509, 0.32423, -0.12491, 0.13682, 0.15131, 0.11221, -0.01201, 0.57239, 0.00093, 0.02068, -0.01162, 0.00647, -0.00325, 0.27010, -0.42993, 0.14314, -0.01353, -0.08757, -0.00699, 0.00199, 0.31873, 18.80329, 0.01681, 0.08009, -0.00998, -0.14421, -0.15912, 0.37208, 0.49744, 0.35144, 0.06582, -0.11501, -0.14037, 0.10352, -0.00768, 0.04826, -0.00423, 0.19850, 0.00310, -0.01780, 0.01350, -0.61106, -0.20525, -0.04388, 0.52143, 0.19300, -0.21446, -0.05749, -0.04776, 0.12877, -0.10908, 0.39821, 0.00627, 34.03956, 0.04392, -0.34455, 0.22015, 0.11743, 0.04638, 0.20723, -0.30447, 0.10976, -0.01008, -0.20778, -0.21822, 0.24939, 0.27976, 0.79790, 0.20200], 11 | arg_tbl: [0, 3, 2, 1, 7, -2, 8, 0, 3, 3, 5, -8, 6, 3, 8, 0, 2, 2, 7, -4, 8, 0, 3, 1, 5, -3, 6, 3, 8, 0, 2, 3, 7, -6, 8, 0, 2, 4, 7, -8, 8, 0, 3, 1, 6, -6, 7, 6, 8, 0, 3, 1, 6, -5, 7, 4, 8, 0, 3, 1, 6, -4, 7, 2, 8, 0, 2, 1, 6, -3, 7, 0, 3, 1, 6, -2, 7, -1, 8, 0, 2, 5, 7, -9, 8, 1, 2, 4, 7, -7, 8, 1, 2, 3, 7, -5, 8, 1, 2, 2, 7, -3, 8, 0, 2, 1, 7, -1, 8, 1, 1, 1, 8, 2, 2, 1, 7, -3, 8, 0, 2, 2, 7, -5, 8, 1, 3, 1, 6, -6, 7, 5, 8, 0, 3, 1, 6, -5, 7, 3, 8, 0, 2, 5, 7, -8, 8, 0, 2, 4, 7, -6, 8, 0, 2, 3, 7, -4, 8, 0, 2, 2, 7, -2, 8, 1, 1, 1, 7, 0, 1, 2, 8, 2, 2, 1, 7, -4, 8, 0, 2, 5, 7, -7, 8, 0, 2, 4, 7, -5, 8, 0, 2, 3, 7, -3, 8, 0, 2, 2, 7, -1, 8, 0, 2, 1, 7, 1, 8, 0, 1, 3, 8, 1, 2, 1, 6, -2, 8, 1, 2, 5, 7, -6, 8, 0, 2, 4, 7, -4, 8, 0, 1, 4, 8, 1, 3, 2, 5, -4, 6, -1, 8, 1, 3, 1, 6, 1, 7, -3, 8, 0, 2, 1, 6, -1, 8, 1, 3, 1, 6, -1, 7, 1, 8, 0, 3, 2, 5, -6, 6, 1, 8, 0, 2, 5, 7, -5, 8, 1, 1, 1, 6, 0, 2, 6, 7, -6, 8, 0, 2, 7, 7, -7, 8, 0, 2, 2, 6, -2, 8, 0, 3, 2, 5, -3, 6, -1, 8, 0, 2, 2, 6, -1, 8, 1, 2, 1, 5, -2, 8, 0, 3, 3, 5, -5, 6, -1, 8, 0, 2, 4, 7, 5, 8, 0, 2, 1, 5, -1, 8, 1, 3, 1, 5, -1, 7, 1, 8, 1, 3, 1, 5, -5, 6, 1, 8, 1, 1, 1, 5, 0, 2, 2, 5, -1, 8, 1, -1] 12 | }; 13 | -------------------------------------------------------------------------------- /astronomy/moshier/body.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * body definition { 4 | * 5 | * // body 6 | * epoch: epoch = epoch of orbital elements 7 | * inclination: i = inclination 8 | * node: W = longitude of the ascending node 9 | * perihelion: w = argument of the perihelion 10 | * semiAxis: a = mean distance (semimajor axis), if 0.0 then = perihelionDistance / (1 - eccentricity) 11 | * dailyMotion: dm = daily motion, if 0.0 will be calculated 12 | * eccentricity: ecc = eccentricity 13 | * anomaly: M = mean anomaly 14 | * equinox: equinox = epoch of equinox and ecliptic 15 | * magnitude: mag = visual magnitude at 1AU from earth and sun 16 | * semiDiameter: sdiam = equatorial semidiameter at 1au, arc seconds 17 | * perihelionDistance: = perihelion distance 18 | * // computed values 19 | * longitude: L = computed mean longitude 20 | * distance: r = computed radius vector 21 | * perturbation plat = perturbation in ecliptic latitude 22 | * 23 | * // star 24 | * ra: ra = right ascension, radians 25 | * dec: dec = declination, radians 26 | * parallax: px = parallax, radians 27 | * raMotion: mura = proper motion in R.A., rad/century 28 | * decMotion: mudec = proper motion in Dec., rad/century 29 | * velocity: v = radial velocity, km/s 30 | * equinox: equinox = epoch of equinox and ecliptic 31 | * magnitude: mag = visual magnitude 32 | * 33 | * // constellation 34 | * index: index of constellation (1-88) 35 | * raLow: lower right ascension, in units of hours times 3600 36 | * raHight: upper right ascension, in units of hours times 3600 37 | * dec0: lower declination, in units of degrees times 3600 38 | * 39 | * } 40 | * 41 | */ 42 | 43 | $ns.body = { 44 | /** 45 | * Sun 46 | */ 47 | sun: { 48 | weight: 100 49 | }, 50 | 51 | /** 52 | * Planets 53 | */ 54 | mercury: { 55 | epoch: 2446800.5, // 05.01.1987 56 | inclination: 7.0048, 57 | node: 48.177, 58 | perihelion: 29.074, 59 | semiAxis: 0.387098, 60 | dailyMotion: 4.09236, 61 | eccentricity: 0.205628, 62 | anomaly: 198.7199, 63 | equinox: {julian: 2446800.5}, 64 | magnitude: -0.42, 65 | semiDiameter: 3.36 66 | }, 67 | venus: { 68 | epoch: 2446800.5, // 05.01.1987 69 | inclination: 3.3946, 70 | node: 76.561, 71 | perihelion: 54.889, 72 | semiAxis: 0.723329, 73 | dailyMotion: 1.60214, 74 | eccentricity: 0.006757, 75 | anomaly: 9.0369, 76 | equinox: {julian: 2446800.5}, 77 | /* Note the calculated apparent visual magnitude for Venus 78 | * is not very accurate. 79 | */ 80 | magnitude: -4.40, 81 | semiDiameter: 8.34 82 | }, 83 | earth: { 84 | epoch: 2446800.5, // 05.01.1987 85 | inclination: 0.0, 86 | node: 0.0, 87 | perihelion: 102.884, 88 | semiAxis: 0.999999, 89 | dailyMotion: 0.985611, 90 | eccentricity: 0.016713, 91 | anomaly: 1.1791, 92 | equinox: {julian: 2446800.5}, 93 | magnitude: -3.86, 94 | semiDiameter: 0.0, 95 | longitude: 0.0, // computed 96 | distance: 0.0, // computed 97 | perturbation: 0.0 // computed 98 | }, 99 | moon: { 100 | }, 101 | mars: { 102 | epoch: 2446800.5, // 05.01.1987 103 | inclination: 1.8498, 104 | node: 49.457, 105 | perihelion: 286.343, 106 | semiAxis: 1.523710, 107 | dailyMotion: 0.524023, 108 | eccentricity: 0.093472, 109 | anomaly: 53.1893, 110 | equinox: {julian: 2446800.5}, 111 | magnitude: -1.52, 112 | semiDiameter: 4.68 113 | }, 114 | jupiter: { 115 | epoch: 2446800.5, // 05.01.1987 116 | inclination: 1.3051, 117 | node: 100.358, 118 | perihelion: 275.129, 119 | semiAxis: 5.20265, 120 | dailyMotion: 0.0830948, 121 | eccentricity: 0.048100, 122 | anomaly: 344.5086, 123 | equinox: {julian: 2446800.5}, 124 | magnitude: -9.40, 125 | semiDiameter: 98.44 126 | }, 127 | saturn: { 128 | epoch: 2446800.5, // 05.01.1987 129 | inclination: 2.4858, 130 | node: 113.555, 131 | perihelion: 337.969, 132 | semiAxis: 9.54050, 133 | dailyMotion: 0.0334510, 134 | eccentricity: 0.052786, 135 | anomaly: 159.6327, 136 | equinox: {julian: 2446800.5}, 137 | magnitude: -8.88, 138 | semiDiameter: 82.73 139 | }, 140 | uranus: { 141 | epoch: 2446800.5, // 05.01.1987 142 | inclination: 0.7738, 143 | node: 73.994, 144 | perihelion: 98.746, 145 | semiAxis: 19.2233, 146 | dailyMotion: 0.0116943, 147 | eccentricity: 0.045682, 148 | anomaly: 84.8516, 149 | equinox: {julian: 2446800.5}, 150 | magnitude: -7.19, 151 | semiDiameter: 35.02 152 | }, 153 | neptune: { 154 | epoch: 2446800.5, // 05.01.1987 155 | inclination: 1.7697, 156 | node: 131.677, 157 | perihelion: 250.623, 158 | semiAxis: 30.1631, 159 | dailyMotion: 0.00594978, 160 | eccentricity: 0.009019, 161 | anomaly: 254.2568, 162 | equinox: {julian: 2446800.5}, 163 | magnitude: -6.87, 164 | semiDiameter: 33.50 165 | }, 166 | pluto: { 167 | epoch: 2446640.5, 168 | inclination: 17.1346, 169 | node: 110.204, 170 | perihelion: 114.21, 171 | semiAxis: 39.4633, 172 | dailyMotion: 0.00397570, 173 | eccentricity: 0.248662, 174 | anomaly: 355.0554, 175 | equinox: {julian: 2446640.5}, 176 | magnitude: -1.0, 177 | semiDiameter: 2.07 178 | }, 179 | 180 | /** 181 | * Comets and asteroids 182 | */ 183 | chiron: { 184 | epoch: 2456000.5, 185 | inclination: 6.926651533484328, 186 | node: 209.3851130617651, 187 | perihelion: 339.4595737215378, 188 | semiAxis: 0.0, // will be calulated if 0.0 189 | dailyMotion: 0.0, // will be calculated 190 | eccentricity: 0.3792037887546262, 191 | anomaly: 114.8798253094007, 192 | equinox: {julian: 2450109.234581196786}, 193 | magnitude: 6.5, 194 | semiDiameter: 0.0, 195 | perihelionDistance: 8.486494269138399 196 | }, 197 | 198 | /** 199 | * Stars (implemented, not tested) 200 | */ 201 | sirius: { 202 | epoch: 2000, 203 | hmsRa: {hours: 6, minutes: 45, seconds: 8.871}, 204 | hmsDec: {hours: -16, minutes: 42, seconds: 57.99}, 205 | raMotion: -3.847, 206 | decMotion: -120.53, 207 | velocity: -7.6, 208 | parallax: 0.3751, 209 | magnitude: -1.46, 210 | ra: 0.0, 211 | dec: 0.0, 212 | equinox: {julian: 0.0} 213 | } 214 | }; 215 | 216 | $ns.body.init = function () { 217 | for (var key in this) { 218 | if (this.hasOwnProperty (key) && key != 'init') { 219 | // fill the 'key' 220 | this [key].key = key; 221 | // fill the ptable for the body 222 | if ($moshier.plan404.hasOwnProperty (key)) { 223 | this [key].ptable = $moshier.plan404 [key]; 224 | } 225 | } 226 | } 227 | }; -------------------------------------------------------------------------------- /astronomy/moshier/star.js: -------------------------------------------------------------------------------- 1 | $ns.star = {}; 2 | 3 | $ns.star.calc = function (body) { 4 | if (!body.isPrepared) { 5 | this.prepare (body); 6 | body.isPrepared = true; 7 | } 8 | this.reduce (body); 9 | }; 10 | 11 | $ns.star.reduce = function (body) { 12 | var p = [], q = [], e = [], m = [], temp = [], polar = []; // double 13 | var T, vpi, epoch; // double 14 | var cosdec, sindec, cosra, sinra; // double 15 | var i; // int 16 | 17 | /* Convert from RA and Dec to equatorial rectangular direction 18 | */ 19 | // loop: 20 | do { 21 | cosdec = Math.cos( body.dec ); 22 | sindec = Math.sin( body.dec ); 23 | cosra = Math.cos( body.ra ); 24 | sinra = Math.sin( body.ra ); 25 | q[0] = cosra * cosdec; 26 | q[1] = sinra * cosdec; 27 | q[2] = sindec; 28 | 29 | /* space motion */ 30 | vpi = 21.094952663 * body.velocity * body.parallax; 31 | m[0] = -body.raMotion * cosdec * sinra 32 | - body.decMotion * sindec * cosra 33 | + vpi * q[0]; 34 | 35 | m[1] = body.raMotion * cosdec * cosra 36 | - body.decMotion * sindec * sinra 37 | + vpi * q[1]; 38 | 39 | m[2] = body.decMotion * cosdec 40 | + vpi * q[2]; 41 | 42 | epoch = body.epoch; 43 | 44 | /* Convert FK4 to FK5 catalogue */ 45 | if( epoch == $const.b1950 ) { 46 | $moshier.fk4fk5.calc ( q, m, body); 47 | //goto loop; 48 | } 49 | } while (epoch == $const.b1950); 50 | 51 | for( i=0; i<3; i++ ) { 52 | e[i] = $moshier.body.earth.position.rect[i]; 53 | } 54 | 55 | /* precess the earth to the star epoch */ 56 | $moshier.precess.calc ( e, {julian: epoch}, -1 ); 57 | 58 | /* Correct for proper motion and parallax 59 | */ 60 | T = ($moshier.body.earth.position.date.julian - epoch)/36525.0; 61 | for( i=0; i<3; i++ ) { 62 | p[i] = q[i] + T * m[i] - body.parallax * e[i]; 63 | } 64 | 65 | /* precess the star to J2000 */ 66 | $moshier.precess.calc (p, {julian: epoch}, 1 ); 67 | /* reset the earth to J2000 */ 68 | for( i=0; i<3; i++ ) { 69 | e[i] = $moshier.body.earth.position.rect [i]; 70 | } 71 | 72 | /* Find Euclidean vectors between earth, object, and the sun 73 | * angles( p, q, e ); 74 | */ 75 | $util.angles ( p, p, e ); 76 | 77 | /* Find unit vector from earth in direction of object 78 | */ 79 | for( i=0; i<3; i++ ) { 80 | p[i] /= $const.EO; 81 | temp[i] = p[i]; 82 | } 83 | 84 | body.position = {}; 85 | body.position.approxVisualMagnitude = body.magnitude; 86 | 87 | /* Report astrometric position 88 | */ 89 | body.position.astrimetricJ2000 = $util.showrd ( p, polar ); 90 | 91 | /* Also in 1950 coordinates 92 | */ 93 | $moshier.precess.calc ( temp, {julian: $const.b1950}, -1 ); 94 | 95 | body.position.astrimetricB1950 = $util.showrd (temp, polar); 96 | 97 | /* For equinox of date: */ 98 | for( i=0; i<3; i++ ) { 99 | temp[i] = p[i]; 100 | } 101 | 102 | $moshier.precess.calc ( temp, $moshier.body.earth.position.date, -1 ); 103 | body.position.astrimetricDate = $util.showrd (temp, polar); 104 | 105 | /* Correct position for light deflection 106 | * relativity( p, q, e ); 107 | */ 108 | body.position.deflectioon = $moshier.deflectioon.calc ( p, p, e ); // relativity 109 | 110 | /* Correct for annual aberration 111 | */ 112 | body.position.aberration = $moshier.aberration.calc ( p ); 113 | 114 | /* Precession of the equinox and ecliptic 115 | * from J2000.0 to ephemeris date 116 | */ 117 | $moshier.precess.calc ( p, $moshier.body.earth.position.date, -1 ); 118 | 119 | /* Ajust for nutation 120 | * at current ecliptic. 121 | */ 122 | $moshier.epsilon.calc ( $moshier.body.earth.position.date ); 123 | $moshier.nutation.calc ( $moshier.body.earth.position.date, p ); 124 | 125 | /* Display the final apparent R.A. and Dec. 126 | * for equinox of date. 127 | */ 128 | body.position.apparent = $util.showrd (p, polar); 129 | 130 | // prepare for display 131 | body.position.apparentLongitude = body.position.apparent.dRA; 132 | var dmsLongitude = $util.dms (body.position.apparentLongitude); 133 | body.position.apparentLongitudeString = 134 | dmsLongitude.degree + '\u00B0' + 135 | dmsLongitude.minutes + '\'' + 136 | Math.floor (dmsLongitude.seconds) + '"' 137 | ; 138 | 139 | body.position.apparentLongitude30String = 140 | $util.mod30 (dmsLongitude.degree) + '\u00B0' + 141 | dmsLongitude.minutes + '\'' + 142 | Math.floor (dmsLongitude.seconds) + '"' 143 | ; 144 | 145 | body.position.geocentricDistance = 7777; 146 | 147 | /* Go do topocentric reductions. 148 | */ 149 | $const.dradt = 0.0; 150 | $const.ddecdt = 0.0; 151 | polar [2] = 1.0e38; /* make it ignore diurnal parallax */ 152 | 153 | body.position.altaz = $moshier.altaz.calc ( polar, $moshier.body.earth.position.date ); 154 | }; 155 | 156 | $ns.star.prepare = function (body) { 157 | var sign; // int 158 | var s; // char array 159 | var x, z; // double 160 | var p; // char array 161 | var i; // int 162 | 163 | /* Read in the ASCII string data and name of the object 164 | */ 165 | // sscanf( s, "%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %s", 166 | // &body->epoch, &rh, &rm, &rs, &dd, &dm, &ds, 167 | // &body->mura, &body->mudec, &body->v, &body->px, &body->mag, &body->obname[0] ); 168 | 169 | x = body.epoch; 170 | if( x == 2000.0 ) { 171 | x = $const.j2000; 172 | } else if( x == 1950.0 ) { 173 | x = $const.b1950; 174 | } else if( x == 1900.0 ) { 175 | x = $const.j1900; 176 | } else { 177 | x = $const.j2000 + 365.25 * (x - 2000.0); 178 | } 179 | body.epoch = x; 180 | 181 | /* read the right ascension */ 182 | if (!body.ra) { 183 | body.ra = 2.0 * Math.PI * (3600.0*body.hmsRa.hours + 60.0*body.hmsRa.minutes + body.hmsRa.seconds)/86400.0; 184 | } 185 | 186 | /* read the declination */ 187 | if (!body.dec) { 188 | sign = 1; 189 | 190 | /* the '-' sign may appaer at any part of hmsDec */ 191 | if ( (body.hmsDec.hours < 0.0) || (body.hmsDec.minutes < 0.0) || (body.hmsDec.seconds < 0.0) ) { 192 | sign = -1; 193 | } 194 | z = (3600.0*Math.abs(body.hmsDec.hours) + 60.0*Math.abs(body.hmsDec.minutes) + Math.abs(body.hmsDec.seconds))/$const.RTS; 195 | if( sign < 0 ) { 196 | z = -z; 197 | } 198 | body.dec = z; 199 | } 200 | 201 | body.raMotion *= 15.0/$const.RTS; /* s/century -> "/century -> rad/century */ 202 | body.decMotion /= $const.RTS; 203 | z = body.parallax; 204 | if( z < 1.0 ) { 205 | if( z <= 0.0 ) { 206 | body.parallax = 0.0; 207 | } else { 208 | body.parallax = $const.STR * z; /* assume px in arc seconds */ 209 | } 210 | } else { 211 | body.parallax = 1.0/($const.RTS * z); /* parsecs -> radians */ 212 | } 213 | }; -------------------------------------------------------------------------------- /astronomy/moshier/processor.js: -------------------------------------------------------------------------------- 1 | $ns.processor = {}; 2 | 3 | $ns.processor.calc = function (date, body) { 4 | $const.body = body; 5 | 6 | $moshier.julian.calc (date); 7 | $moshier.delta.calc (date); 8 | 9 | date.universalDate = $moshier.julian.toGregorian ({ 10 | julian: date.universal 11 | }); 12 | 13 | date.universalDateString = 14 | date.universalDate.day + '.' + 15 | date.universalDate.month + '.' + 16 | date.universalDate.year + ' ' + 17 | date.universalDate.hours + ':' + 18 | date.universalDate.minutes + ':' + 19 | (date.universalDate.seconds + date.universalDate.milliseconds / 1000) 20 | ; 21 | 22 | // First to calculate the erath 23 | $moshier.kepler.calc (date, $moshier.body.earth); 24 | 25 | switch (body.key) { 26 | case 'sun': 27 | $moshier.sun.calc (); 28 | break; 29 | case 'moon': 30 | $moshier.moon.calc (); 31 | break; 32 | default: 33 | if (body.raMotion) { // star 34 | $moshier.star.calc (body); 35 | } else { // planet 36 | $moshier.planet.calc (body); 37 | } 38 | break; 39 | } 40 | }; 41 | 42 | $ns.processor.ecliptic = function (date, observer, body) { 43 | this.calc (date, observer); 44 | this.calc (date, body); 45 | 46 | //this.reduce (observer, body); 47 | }; 48 | 49 | $ns.processor.init = function () { 50 | $moshier.body.init (); 51 | $moshier.kepler.init (); 52 | }; 53 | 54 | $ns.processor.test = function () { 55 | var body, date; 56 | 57 | // tested position 58 | $copy ($const, { 59 | tlong: -71.13, 60 | glat: 42.27, 61 | attemp: 12.0, 62 | atpress: 1010.0, 63 | height: 0.0 64 | }); 65 | 66 | // initialize processor 67 | this.init (); 68 | 69 | // test the moon 70 | date = {year: 1986, month: 1, day: 1, hours: 1, minutes: 52, seconds: 0}; 71 | body = $moshier.body.moon; 72 | this.calc (date, body); 73 | 74 | $assert (date.julian, 2446431.577777778); 75 | $assert (date.delta, 54.87009963821919); 76 | 77 | $assert (body.position.nutation.dRA, -0.48342256851185134); 78 | $assert (body.position.nutation.dDec, 5.886353197581648); 79 | 80 | $assert (body.position.geometric.longitude, 156.0921880198016); 81 | $assert (body.position.geometric.latitude, 4.422063993387057); 82 | $assert (body.position.geometric.distance, 0.14716616073282882); 83 | 84 | $assert (body.position.apparentGeocentric.longitude, 2.7242742960376667); 85 | $assert (body.position.apparentGeocentric.latitude, 0.07717957641849299); 86 | $assert (body.position.apparentGeocentric.distance, 60.24442952894567); 87 | 88 | $assert (body.position.dHorizontalParallax, 0.016599807399569004); 89 | 90 | $assert (body.position.sunElongation, 124.15076164595345); 91 | $assert (body.position.illuminatedFraction, 0.7815787330095528); 92 | 93 | $assert (body.position.apparent.dRA, 2.7844808512258266); 94 | $assert (body.position.apparent.dDec, 0.23362556081599462); 95 | 96 | $assert (body.position.altaz.diurnalAberation.ra, 2.7844805966970942); 97 | $assert (body.position.altaz.diurnalAberation.dec, 0.23362530162522877); 98 | 99 | $assert (body.position.altaz.diurnalParallax.ra, 2.7967931740378766); 100 | $assert (body.position.altaz.diurnalParallax.dec, 0.2221893682125501); 101 | 102 | $assert (body.position.altaz.atmosphericRefraction.deg, 0.6356568799861307); 103 | $assert (body.position.altaz.atmosphericRefraction.dRA, -112.9014532718829); 104 | $assert (body.position.altaz.atmosphericRefraction.dDec, 1585.1382135790564); 105 | 106 | $assert (body.position.altaz.topocentric.altitude, -0.2989379770846806); 107 | $assert (body.position.altaz.topocentric.ra, -3.4946025585162133); 108 | $assert (body.position.altaz.topocentric.dec, 0.22987433513647665); 109 | $assert (body.position.altaz.topocentric.azimuth, 71.78002666681668); 110 | 111 | // test the sun 112 | date = {year: 1986, month: 1, day: 1, hours: 16, minutes: 47, seconds: 0}; 113 | body = $moshier.body.sun; 114 | this.calc (date, body); 115 | 116 | $assert (date.julian, 2446432.199305556); 117 | $assert (date.delta, 54.87089572485891); 118 | 119 | $assert (body.position.equinoxEclipticLonLat [0], 4.90413951369789); 120 | $assert (body.position.equinoxEclipticLonLat [1], 0.000002184617423267333); 121 | $assert (body.position.equinoxEclipticLonLat [2], 0.9832794756330766); 122 | 123 | $assert (body.position.lightTime, 8.177686171897745); 124 | 125 | $assert (body.position.aberration.dRA, 1.50327643199855); 126 | $assert (body.position.aberration.dDec, 1.7448150469138453); 127 | 128 | $assert (body.position.constellation, 77); 129 | 130 | $assert (body.position.apparent.dRA, 4.920756988829355); 131 | $assert (body.position.apparent.dDec, -0.40123417213339135); 132 | 133 | $assert (body.position.apparentLongitude, 280.9781321178379); 134 | 135 | $assert (body.position.altaz.diurnalParallax.ra, 4.920758543965699); 136 | $assert (body.position.altaz.diurnalParallax.dec, -0.4012734282906353); 137 | 138 | $assert (body.position.altaz.atmosphericRefraction.deg, 0.0347669495824713); 139 | $assert (body.position.altaz.atmosphericRefraction.dRA, -0.0654871080210392); 140 | $assert (body.position.altaz.atmosphericRefraction.dDec, 125.15775095794257); 141 | 142 | $assert (body.position.altaz.topocentric.altitude, 24.771802544653966); 143 | $assert (body.position.altaz.topocentric.ra, -1.3624315255707726); 144 | $assert (body.position.altaz.topocentric.dec, -0.4006666463910222); 145 | $assert (body.position.altaz.topocentric.azimuth, 179.48488458374226); 146 | 147 | // test the sirius 148 | date = {year: 1986, month: 1, day: 1, hours: 0, minutes: 0, seconds: 0}; 149 | body = $moshier.body.sirius; 150 | this.calc (date, body); 151 | 152 | $assert (date.julian, 2446431.5); 153 | $assert (date.delta, 54.87); 154 | 155 | $assert (body.position.apparent.dRA, 1.7651675096112047); 156 | $assert (body.position.apparent.dDec, -0.29137543179606207); 157 | 158 | $assert (body.position.astrimetricDate.dRA, 1.7651002655957506); 159 | $assert (body.position.astrimetricDate.dDec, -0.29140596467162816); 160 | 161 | $assert (body.position.altaz.topocentric.altitude, 1.7060953673767152); 162 | $assert (body.position.altaz.topocentric.ra, -4.522192086886859); 163 | $assert (body.position.altaz.topocentric.dec, -0.2873401996237649); 164 | $assert (body.position.altaz.topocentric.azimuth, 114.21923743994829); 165 | 166 | // test the sirius 167 | date = {year: 1986, month: 1, day: 1, hours: 0, minutes: 0, seconds: 0}; 168 | body = $moshier.body.sirius; 169 | this.calc (date, body); 170 | 171 | $assert (date.julian, 2446431.5); 172 | $assert (date.delta, 54.87); 173 | 174 | $assert (body.position.apparent.dRA, 1.7651675096112047); 175 | $assert (body.position.apparent.dDec, -0.29137543179606207); 176 | 177 | $assert (body.position.astrimetricDate.dRA, 1.7651002655957506); 178 | $assert (body.position.astrimetricDate.dDec, -0.29140596467162816); 179 | 180 | $assert (body.position.altaz.topocentric.altitude, 1.7060953673767152); 181 | $assert (body.position.altaz.topocentric.ra, -4.522192086886859); 182 | $assert (body.position.altaz.topocentric.dec, -0.2873401996237649); 183 | $assert (body.position.altaz.topocentric.azimuth, 114.21923743994829); 184 | }; -------------------------------------------------------------------------------- /astronomy/moshier/util.js: -------------------------------------------------------------------------------- 1 | $ns.util = {}; 2 | 3 | $ns.util.mods3600 = function (value) { 4 | var result; 5 | 6 | result = (value - 1.296e6 * Math.floor (value / 1.296e6)); 7 | 8 | return result; 9 | }; 10 | 11 | /* Reduce x modulo 2 pi 12 | */ 13 | $ns.util.modtp = function (x) { 14 | var y; // double 15 | 16 | y = Math.floor ( x / $const.TPI ); 17 | y = x - y * $const.TPI; 18 | while( y < 0.0 ) { 19 | y += $const.TPI; 20 | } 21 | while( y >= $const.TPI ) { 22 | y -= $const.TPI; 23 | } 24 | return y; 25 | }; 26 | 27 | /* Reduce x modulo 360 degrees 28 | */ 29 | $ns.util.mod360 = function (x) { 30 | var k; // int 31 | var y; // double 32 | 33 | k = Math.floor (x / 360.0); 34 | y = x - k * 360.0; 35 | while( y < 0.0 ) { 36 | y += 360.0; 37 | } 38 | while( y > 360.0 ) { 39 | y -= 360.0; 40 | } 41 | return y; 42 | }; 43 | 44 | /* Reduce x modulo 30 degrees 45 | */ 46 | $ns.util.mod30 = function (x) { 47 | var k; // int 48 | var y; // double 49 | 50 | k = Math.floor (x / 30.0); 51 | y = x - k * 30.0; 52 | while( y < 0.0 ) { 53 | y += 30.0; 54 | } 55 | while( y > 30.0 ) { 56 | y -= 30.0; 57 | } 58 | return y; 59 | }; 60 | 61 | $ns.util.zatan2 = function ( x, y ) { 62 | var z, w; // double 63 | var code; // short 64 | 65 | code = 0; 66 | 67 | if( x < 0.0 ) { 68 | code = 2; 69 | } 70 | if( y < 0.0 ) { 71 | code |= 1; 72 | } 73 | 74 | if( x == 0.0 ) { 75 | if( code & 1 ) { 76 | return 1.5 * Math.PI ; 77 | } 78 | if( y == 0.0 ) { 79 | return 0.0; 80 | } 81 | return 0.5 * Math.PI; 82 | } 83 | 84 | if( y == 0.0 ) { 85 | if( code & 2 ) { 86 | return Math.PI; 87 | } 88 | return 0.0; 89 | } 90 | 91 | switch( code ) { 92 | default: 93 | case 0: w = 0.0; break; 94 | case 1: w = 2.0 * Math.PI; break; 95 | case 2: 96 | case 3: w = Math.PI; break; 97 | } 98 | 99 | z = Math.atan (y / x); 100 | 101 | return w + z; 102 | }; 103 | 104 | $ns.util.sinh = function (x) { 105 | return (Math.exp(x) - Math.exp(-x)) / 2; 106 | }; 107 | 108 | $ns.util.cosh = function (x) { 109 | return (Math.exp(x) + Math.exp(-x)) / 2; 110 | }; 111 | 112 | $ns.util.tanh = function (x) { 113 | return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x)); 114 | }; 115 | 116 | $ns.util.hms = function (x) { 117 | var h, m; // int 118 | var sint, sfrac; // long 119 | var s; // double 120 | var result = {}; 121 | 122 | s = x * $const.RTOH; 123 | if (s < 0.0) { 124 | s += 24.0; 125 | } 126 | h = Math.floor (s); 127 | s -= h; 128 | s *= 60; 129 | m = Math.floor (s); 130 | s -= m; 131 | s *= 60; 132 | /* Handle shillings and pence roundoff. */ 133 | sfrac = Math.floor (1000.0 * s + 0.5); 134 | if ( sfrac >= 60000 ) { 135 | sfrac -= 60000; 136 | m += 1; 137 | if( m >= 60 ) { 138 | m -= 60; 139 | h += 1; 140 | } 141 | } 142 | sint = Math.floor (sfrac / 1000); 143 | sfrac -= Math.floor (sint * 1000); 144 | 145 | result.hours = h; 146 | result.minutes = m; 147 | result.seconds = sint; 148 | result.milliseconds = sfrac; 149 | 150 | return result; 151 | }; 152 | 153 | $ns.util.dms = function (x) { 154 | var s; // double 155 | var d, m; // int 156 | var result = {}; 157 | 158 | s = x * $const.RTD; 159 | if( s < 0.0 ) { 160 | s = -s; 161 | } 162 | d = Math.floor (s); 163 | s -= d; 164 | s *= 60; 165 | m = Math.floor (s); 166 | s -= m; 167 | s *= 60; 168 | 169 | result.degree = d; 170 | result.minutes = m; 171 | result.seconds = s; 172 | 173 | return result; 174 | }; 175 | 176 | /* Display magnitude of correction vector 177 | * in arc seconds 178 | */ 179 | $ns.util.showcor = function (p, dp, result) { 180 | var p1 = []; // dr, dd; // double 181 | var i; // int 182 | var d; 183 | 184 | for( i=0; i<3; i++ ) { 185 | p1[i] = p[i] + dp[i]; 186 | } 187 | 188 | d = $util.deltap ( p, p1); 189 | 190 | result = result || {}; 191 | result.dRA = $const.RTS * d.dr/15.0; 192 | result.dDec = $const.RTS * d.dd; 193 | 194 | return result; 195 | }; 196 | 197 | /* Display Right Ascension and Declination 198 | * from input equatorial rectangular unit vector. 199 | * Output vector pol[] contains R.A., Dec., and radius. 200 | */ 201 | $ns.util.showrd = function (p, pol, result) { 202 | var x, y, r; // double 203 | var i; // int 204 | 205 | r = 0.0; 206 | for( i=0; i<3; i++ ) { 207 | x = p[i]; 208 | r += x * x; 209 | } 210 | r = Math.sqrt(r); 211 | 212 | x = $util.zatan2( p[0], p[1] ); 213 | pol[0] = x; 214 | 215 | y = Math.asin( p[2]/r ); 216 | pol[1] = y; 217 | 218 | pol[2] = r; 219 | 220 | result = result || {}; 221 | 222 | $copy (result, { 223 | dRA: x, 224 | dDec: y, 225 | ra: $util.hms (x), 226 | dec: $util.dms (y) 227 | }); 228 | 229 | return result; 230 | }; 231 | 232 | /* 233 | * Convert change in rectangular coordinatates to change 234 | * in right ascension and declination. 235 | * For changes greater than about 0.1 degree, the 236 | * coordinates are converted directly to R.A. and Dec. 237 | * and the results subtracted. For small changes, 238 | * the change is calculated to first order by differentiating 239 | * tan(R.A.) = y/x 240 | * to obtain 241 | * dR.A./cos**2(R.A.) = dy/x - y dx/x**2 242 | * where 243 | * cos**2(R.A.) = 1/(1 + (y/x)**2). 244 | * 245 | * The change in declination arcsin(z/R) is 246 | * d asin(u) = du/sqrt(1-u**2) 247 | * where u = z/R. 248 | * 249 | * p0 is the initial object - earth vector and 250 | * p1 is the vector after motion or aberration. 251 | * 252 | */ 253 | $ns.util.deltap = function (p0, p1, d) { 254 | var dp = [], A, B, P, Q, x, y, z; // double 255 | var i; // int 256 | 257 | d = d || {}; 258 | 259 | P = 0.0; 260 | Q = 0.0; 261 | z = 0.0; 262 | for( i=0; i<3; i++ ) { 263 | x = p0[i]; 264 | y = p1[i]; 265 | P += x * x; 266 | Q += y * y; 267 | y = y - x; 268 | dp[i] = y; 269 | z += y*y; 270 | } 271 | 272 | A = Math.sqrt(P); 273 | B = Math.sqrt(Q); 274 | 275 | if( (A < 1.e-7) || (B < 1.e-7) || (z/(P+Q)) > 5.e-7 ) { 276 | P = $util.zatan2( p0[0], p0[1] ); 277 | Q = $util.zatan2( p1[0], p1[1] ); 278 | Q = Q - P; 279 | while( Q < -Math.PI ) { 280 | Q += 2.0*Math.PI; 281 | } 282 | while( Q > Math.PI ) { 283 | Q -= 2.0*Math.PI; 284 | } 285 | d.dr = Q; 286 | P = Math.asin( p0[2]/A ); 287 | Q = Math.asin( p1[2]/B ); 288 | d.dd = Q - P; 289 | return d; 290 | } 291 | 292 | 293 | x = p0[0]; 294 | y = p0[1]; 295 | if( x == 0.0 ) { 296 | d.dr = 1.0e38; 297 | } else { 298 | Q = y/x; 299 | Q = (dp[1] - dp[0]*y/x)/(x * (1.0 + Q*Q)); 300 | d.dr = Q; 301 | } 302 | 303 | x = p0[2] / A; 304 | P = Math.sqrt( 1.0 - x*x ); 305 | d.dd = (p1[2] / B - x) / P; 306 | 307 | return d; 308 | }; 309 | 310 | /* Sun - object - earth angles and distances. 311 | * q (object), e (earth), and p (q minus e) are input vectors. 312 | * The answers are posted in the following global locations: 313 | */ 314 | $ns.util.angles = function (p, q, e) { 315 | var a, b, s; // double 316 | var i; // int 317 | 318 | $const.EO = 0.0; 319 | $const.SE = 0.0; 320 | $const.SO = 0.0; 321 | $const.pq = 0.0; 322 | $const.ep = 0.0; 323 | $const.qe = 0.0; 324 | for( i=0; i<3; i++ ) { 325 | a = e[i]; 326 | b = q[i]; 327 | s = p[i]; 328 | $const.EO += s * s; 329 | $const.SE += a * a; 330 | $const.SO += b * b; 331 | $const.pq += s * b; 332 | $const.ep += a * s; 333 | $const.qe += b * a; 334 | } 335 | $const.EO = Math.sqrt($const.EO); /* Distance between Earth and object */ 336 | $const.SO = Math.sqrt($const.SO); /* Sun - object */ 337 | $const.SE = Math.sqrt($const.SE); /* Sun - earth */ 338 | /* Avoid fatality: if object equals sun, SO is zero. */ 339 | if( $const.SO > 1.0e-12 ) 340 | { 341 | $const.pq /= $const.EO*$const.SO; /* cosine of sun-object-earth */ 342 | $const.qe /= $const.SO*$const.SE; /* cosine of earth-sun-object */ 343 | } 344 | $const.ep /= $const.SE*$const.EO; /* -cosine of sun-earth-object */ 345 | }; -------------------------------------------------------------------------------- /astronomy/moshier/delta.js: -------------------------------------------------------------------------------- 1 | $ns.delta = {}; 2 | 3 | /** 4 | * Morrison and Stephenson (2004) 5 | * This table covers -1000 through 1700 in 100-year steps. 6 | * Values are in whole seconds. 7 | * Estimated standard error at -1000 is 640 seconds; at 1600, 20 seconds. 8 | * The first value in the table has been adjusted 28 sec for 9 | * continuity with their long-term quadratic extrapolation formula. 10 | * The last value in this table agrees with the AA table at 1700, 11 | * so there is no discontinuity at either endpoint. 12 | */ 13 | $ns.delta.m_s = [ 14 | /* -1000 to -100 */ 15 | 25428, 23700, 22000, 21000, 19040, 17190, 15530, 14080, 12790, 11640, 16 | /* 0 to 900 */ 17 | 10580, 9600, 8640, 7680, 6700, 5710, 4740, 3810, 2960, 2200, 18 | /* 1000 to 1700 */ 19 | 1570, 1090, 740, 490, 320, 200, 120, 9 20 | ]; 21 | 22 | /** 23 | * Entries prior to 1955 in the following table are from 24 | * the 1984 Astronomical Almanac and assume ndot = -26.0. 25 | * For dates prior to 1700, the above table is used instead of this one. 26 | */ 27 | $ns.delta.dt = [ 28 | /* 1620.0 thru 1659.0 */ 29 | 12400, 11900, 11500, 11000, 10600, 10200, 9800, 9500, 9100, 8800, 8500, 8200, 7900, 7700, 7400, 7200, 7000, 6700, 6500, 6300, 6200, 6000, 5800, 5700, 5500, 5400, 5300, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3800, 30 | /* 1660.0 thru 1699.0 */ 31 | 3700, 3600, 3500, 3400, 3300, 3200, 3100, 3000, 2800, 2700, 2600, 2500, 2400, 2300, 2200, 2100, 2000, 1900, 1800, 1700, 1600, 1500, 1400, 1400, 1300, 1200, 1200, 1100, 1100, 1000, 1000, 1000, 900, 900, 900, 900, 900, 900, 900, 900, 32 | /* 1700.0 thru 1739.0 */ 33 | 900, 900, 900, 900, 900, 900, 900, 900, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1100, 1200, 1200, 1200, 1200, 1200, 1200, 34 | /* 1740.0 thru 1779.0 */ 35 | 1200, 1200, 1200, 1200, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1400, 1400, 1400, 1400, 1400, 1400, 1400, 1500, 1500, 1500, 1500, 1500, 1500, 1500, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1600, 1700, 1700, 1700, 1700, 1700, 36 | /* 1780.0 thru 1799.0 */ 37 | 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1600, 1600, 1600, 1600, 1500, 1500, 1400, 1400, 38 | /* 1800.0 thru 1819.0 */ 39 | 1370, 1340, 1310, 1290, 1270, 1260, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1250, 1240, 1230, 1220, 40 | /* 1820.0 thru 1859.0 */ 41 | 1200, 1170, 1140, 1110, 1060, 1020, 960, 910, 860, 800, 750, 700, 660, 630, 600, 580, 570, 560, 560, 560, 570, 580, 590, 610, 620, 630, 650, 660, 680, 690, 710, 720, 730, 740, 750, 760, 770, 770, 780, 780, 42 | /* 1860.0 thru 1899.0 */ 43 | 788, 782, 754, 697, 640, 602, 541, 410, 292, 182, 161, 10, -102, -128, -269, -324, -364, -454, -471, -511, -540, -542, -520, -546, -546, -579, -563, -564, -580, -566, -587, -601, -619, -664, -644, -647, -609, -576, -466, -374, 44 | /* 1900.0 thru 1939.0 */ 45 | -272, -154, -2, 124, 264, 386, 537, 614, 775, 913, 1046, 1153, 1336, 1465, 1601, 1720, 1824, 1906, 2025, 2095, 2116, 2225, 2241, 2303, 2349, 2362, 2386, 2449, 2434, 2408, 2402, 2400, 2387, 2395, 2386, 2393, 2373, 2392, 2396, 2402, 46 | /* 1940.0 thru 1979.0 */ 47 | 2433, 2483, 2530, 2570, 2624, 2677, 2728, 2778, 2825, 2871, 2915, 2957, 2997, 3036, 3072, 3107, 3135, 3168, 3218, 3268, 3315, 3359, 3400, 3447, 3503, 3573, 3654, 3743, 3829, 3920, 4018, 4117, 4223, 4337, 4449, 4548, 4646, 4752, 4853, 4959, 48 | /* 1980.0 thru 2011.0 */ 49 | 5054, 5138, 5217, 5296, 5379, 5434, 5487, 5532, 5582, 5630, 5686, 5757, 5831, 5912, 5998, 6078, 6163, 6230, 6297, 6347, 6383, 6409, 6430, 6447, 6457, 6469, 6485, 6515, 6546, 6578, 6607, 6632 50 | ]; 51 | 52 | $ns.delta.demo = 0; 53 | $ns.delta.TABSTART = 1620; 54 | $ns.delta.TABEND = 2011; 55 | $ns.delta.TABSIZ = ($ns.delta.TABEND - $ns.delta.TABSTART + 1); 56 | 57 | $ns.delta.calc = function (date) { 58 | var p, B; // double 59 | var diff = [0, 0, 0, 0, 0, 0]; // int 60 | var i, iy, k; // int 61 | 62 | if ($const.dtgiven) { 63 | date.delta = $const.dtgiven; 64 | } else if (date.j2000 > this.TABEND) { 65 | /* Extrapolate future values beyond the lookup table. */ 66 | if (date.j2000 > (this.TABEND + 100.0)) { 67 | /* Morrison & Stephenson (2004) long-term curve fit. */ 68 | B = (date.j2000 - 1820.0) / 100; 69 | date.delta = 32.0 * B * B - 20.0; 70 | } else { 71 | var a, b, c, d, m0, m1; // double 72 | 73 | /* Cubic interpolation between last tabulated value 74 | and long-term curve evaluated at 100 years later. */ 75 | 76 | /* Last tabulated delta T value. */ 77 | a = this.dt [this.TABSIZ - 1] / 100; 78 | /* Approximate slope in past 10 years. */ 79 | b = (this.dt [this.TABSIZ - 1] - this.dt [this.TABSIZ - 11]) / 1000; 80 | 81 | /* Long-term curve 100 years hence. */ 82 | B = (this.TABEND + 100.0 - 1820.0) / 100; 83 | m0 = 32.0 * B * B - 20.0; 84 | /* Its slope. */ 85 | m1 = 0.64 * B; 86 | 87 | /* Solve for remaining coefficients of an interpolation polynomial 88 | that agrees in value and slope at both ends of the 100-year 89 | interval. */ 90 | d = 2.0e-6 * (50.0 * (m1 + b) - m0 + a); 91 | c = 1.0e-4 * (m0 - a - 100.0 * b - 1.0e6 * d); 92 | 93 | /* Note, the polynomial coefficients do not depend on Y. 94 | A given tabulation and long-term formula 95 | determine the polynomial. 96 | Thus, for the IERS table ending at 2011.0, the coefficients are 97 | a = 66.32 98 | b = 0.223 99 | c = 0.03231376 100 | d = -0.0001607784 101 | */ 102 | 103 | /* Compute polynomial value at desired time. */ 104 | p = date.j2000 - this.TABEND; 105 | date.delta = a + p * (b + p * (c + p * d)); 106 | } 107 | } else { 108 | /* Use Morrison and Stephenson (2004) prior to the year 1700. */ 109 | if (date.j2000 < 1700.0) { 110 | if (date.j2000 <= -1000.0) { 111 | /* Morrison and Stephenson long-term fit. */ 112 | B = (date.j2000 - 1820.0) / 100; 113 | date.delta = 32.0 * B * B - 20.0; 114 | } else { 115 | /* Morrison and Stephenson recommend linear interpolation 116 | between tabulations. */ 117 | iy = Math.floor (date.j2000); 118 | iy = Math.floor ((iy + 1000) / 100); 119 | /* Integer index into the table. */ 120 | B = -1000 + 100 * iy; 121 | /* Starting year of tabulated interval. */ 122 | p = this.m_s [iy]; 123 | date.delta = p + (date.j2000 - B) * (this.m_s [iy + 1] - p) / 100; 124 | } 125 | } else { 126 | /* Besselian interpolation between tabulated values 127 | * in the telescopic era. 128 | * See AA page K11. 129 | */ 130 | 131 | /* Index into the table. 132 | */ 133 | p = Math.floor (date.j2000); 134 | iy = Math.floor (p - this.TABSTART); 135 | /* Zeroth order estimate is value at start of year 136 | */ 137 | date.delta = this.dt [iy]; 138 | k = iy + 1; 139 | if (!(k >= this.TABSIZ)) { 140 | /* The fraction of tabulation interval 141 | */ 142 | p = date.j2000 - p; 143 | 144 | /* First order interpolated value 145 | */ 146 | date.delta += p * (this.dt [k] - this.dt [iy]); 147 | if (!((iy - 1 < 0) || (iy + 2 >= this.TABSIZ))) { 148 | // make table of first differences 149 | k = iy - 2; 150 | for (i = 0; i < 5; i++) { 151 | if ((k < 0) || (k + 1 >= this.TABSIZ)) { 152 | diff[i] = 0; 153 | } else { 154 | diff[i] = this.dt[k + 1] - this.dt[k]; 155 | } 156 | k += 1; 157 | } 158 | 159 | // compute second differences 160 | for (i = 0; i < 4; i++) { 161 | diff[i] = diff[i + 1] - diff[i]; 162 | } 163 | B = 0.25 * p * (p - 1.0); 164 | date.delta += B * (diff[1] + diff[2]); 165 | 166 | if (!(iy + 2 >= this.TABSIZ)) { 167 | // Compute third differences 168 | for (i = 0; i < 3; i++) { 169 | diff[i] = diff[i + 1] - diff[i]; 170 | } 171 | B = 2.0 * B / 3.0; 172 | date.delta += (p - 0.5) * B * diff[1]; 173 | if (!((iy - 2 < 0) || (iy + 3 > this.TABSIZ))) { 174 | // Compute fourth differences 175 | for (i = 0; i < 2; i++) { 176 | diff[i] = diff[i + 1] - diff[i]; 177 | } 178 | B = 0.125 * B * (p + 1.0) * (p - 2.0); 179 | date.delta += B * (diff[0] + diff[1]); 180 | } 181 | } 182 | } 183 | } 184 | } 185 | date.delta /= 100.0; 186 | } 187 | 188 | date.terrestrial = date.julian; 189 | date.universal = date.terrestrial - date.delta / 86400.0; 190 | 191 | return date.delta; 192 | }; 193 | -------------------------------------------------------------------------------- /astronomy/moshier/moon.js: -------------------------------------------------------------------------------- 1 | $ns.moon = { 2 | ra: 0.0, /* Right Ascension */ 3 | dec: 0.0 /* Declination */ 4 | }; 5 | 6 | /* Calculate geometric position of the Moon and apply 7 | * approximate corrections to find apparent position, 8 | * phase of the Moon, etc. for AA.ARC. 9 | */ 10 | $ns.moon.calc = function () { 11 | var i, prtsav; // int 12 | var ra0, dec0; // double 13 | var x, y, z, lon0; // double 14 | var pp = [], qq = [], pe = [], re = [], moonpp = [], moonpol = []; // double 15 | 16 | $moshier.body.moon.position = { 17 | polar: [], 18 | rect: [] 19 | }; 20 | 21 | /* Geometric equatorial coordinates of the earth. */ 22 | for (i = 0; i < 3; i++) { 23 | re [i] = $moshier.body.earth.position.rect [i]; 24 | } 25 | 26 | /* Run the orbit calculation twice, at two different times, 27 | * in order to find the rate of change of R.A. and Dec. 28 | */ 29 | 30 | /* Calculate for 0.001 day ago 31 | */ 32 | this.calcll({julian: $moshier.body.earth.position.date.julian - 0.001}, moonpp, moonpol); // TDT - 0.001 33 | ra0 = this.ra; 34 | dec0 = this.dec; 35 | lon0 = moonpol[0]; 36 | 37 | /* Calculate for present instant. 38 | */ 39 | $moshier.body.moon.position.nutation = this.calcll ($moshier.body.earth.position.date, moonpp, moonpol).nutation; 40 | 41 | $moshier.body.moon.position.geometric = { 42 | longitude: $const.RTD * $moshier.body.moon.position.polar[0], 43 | latitude: $const.RTD * $moshier.body.moon.position.polar[1], 44 | distance: $const.RTD * $moshier.body.moon.position.polar[2] 45 | }; 46 | 47 | /** 48 | * The rates of change. These are used by altaz () to 49 | * correct the time of rising, transit, and setting. 50 | */ 51 | $const.dradt = this.ra - ra0; 52 | if ($const.dradt >= Math.PI) 53 | $const.dradt = $const.dradt - 2.0 * Math.PI; 54 | if ($const.dradt <= -Math.PI) 55 | $const.dradt = $const.dradt + 2.0 * Math.PI; 56 | $const.dradt = 1000.0 * $const.dradt; 57 | $const.ddecdt = 1000.0*(this.dec-dec0); 58 | 59 | /* Rate of change in longitude, degrees per day 60 | * used for phase of the moon 61 | */ 62 | lon0 = 1000.0*$const.RTD*(moonpol[0] - lon0); 63 | 64 | /* Get apparent coordinates for the earth. */ 65 | z = re [0] * re [0] + re [1] * re [1] + re [2] * re [2]; 66 | z = Math.sqrt(z); 67 | for (i = 0; i < 3; i++) { 68 | re[i] /= z; 69 | } 70 | 71 | /* aberration of light. */ 72 | $moshier.body.moon.position.annualAberration = $moshier.aberration.calc (re); 73 | 74 | /* pe[0] -= STR * (20.496/(RTS*pe[2])); */ 75 | $moshier.precess.calc (re, $moshier.body.earth.position.date, -1); 76 | $moshier.nutation.calc ($moshier.body.earth.position.date, re); 77 | for (i = 0; i < 3; i++) { 78 | re[i] *= z; 79 | } 80 | 81 | $moshier.lonlat.calc ( re, $moshier.body.earth.position.date, pe, 0 ); 82 | 83 | /* Find sun-moon-earth angles */ 84 | for( i=0; i<3; i++ ) { 85 | qq[i] = re[i] + moonpp[i]; 86 | } 87 | $util.angles ( moonpp, qq, re ); 88 | 89 | /* Display answers 90 | */ 91 | $moshier.body.moon.position.apparentGeocentric = { 92 | longitude: moonpol [0], 93 | dLongitude: $const.RTD * moonpol [0], 94 | latitude: moonpol [1], 95 | dLatitude: $const.RTD * moonpol [1], 96 | distance: moonpol [2] / $const.Rearth 97 | }; 98 | $moshier.body.moon.position.apparentLongitude = $moshier.body.moon.position.apparentGeocentric.dLongitude; 99 | var dmsLongitude = $util.dms ($moshier.body.moon.position.apparentGeocentric.longitude); 100 | $moshier.body.moon.position.apparentLongitudeString = 101 | dmsLongitude.degree + '\u00B0' + 102 | dmsLongitude.minutes + '\'' + 103 | Math.floor (dmsLongitude.seconds) + '"' 104 | ; 105 | 106 | $moshier.body.moon.position.apparentLongitude30String = 107 | $util.mod30 (dmsLongitude.degree) + '\u00B0' + 108 | dmsLongitude.minutes + '\'' + 109 | Math.floor (dmsLongitude.seconds) + '"' 110 | ; 111 | 112 | $moshier.body.moon.position.geocentricDistance = moonpol [2] / $const.Rearth; 113 | 114 | x = $const.Rearth/moonpol[2]; 115 | $moshier.body.moon.position.dHorizontalParallax = Math.asin (x); 116 | $moshier.body.moon.position.horizontalParallax = $util.dms (Math.asin (x)); 117 | 118 | x = 0.272453 * x + 0.0799 / $const.RTS; /* AA page L6 */ 119 | $moshier.body.moon.position.dSemidiameter = x; 120 | $moshier.body.moon.position.Semidiameter = $util.dms (x); 121 | 122 | x = $const.RTD * Math.acos(-$const.ep); 123 | /* x = 180.0 - RTD * arcdot (re, pp); */ 124 | $moshier.body.moon.position.sunElongation = x; 125 | x = 0.5 * (1.0 + $const.pq); 126 | $moshier.body.moon.position.illuminatedFraction = x; 127 | 128 | /* Find phase of the Moon by comparing Moon's longitude 129 | * with Earth's longitude. 130 | * 131 | * The number of days before or past indicated phase is 132 | * estimated by assuming the true longitudes change linearly 133 | * with time. These rates are estimated for the date, but 134 | * do not stay constant. The error can exceed 0.15 day in 4 days. 135 | */ 136 | x = moonpol[0] - pe[0]; 137 | x = $util.modtp ( x ) * $const.RTD; /* difference in longitude */ 138 | i = Math.floor (x/90); /* number of quarters */ 139 | x = (x - i*90.0); /* phase angle mod 90 degrees */ 140 | 141 | /* days per degree of phase angle */ 142 | z = moonpol[2]/(12.3685 * 0.00257357); 143 | 144 | if( x > 45.0 ) { 145 | y = -(x - 90.0)*z; 146 | $moshier.body.moon.position.phaseDaysBefore = y; 147 | i = (i+1) & 3; 148 | } else { 149 | y = x*z; 150 | $moshier.body.moon.position.phaseDaysPast = y; 151 | } 152 | 153 | $moshier.body.moon.position.phaseQuarter = i; 154 | 155 | $moshier.body.moon.position.apparent = { 156 | dRA: this.ra, 157 | dDec: this.dec, 158 | ra: $util.hms (this.ra), 159 | dec: $util.dms (this.dec) 160 | }; 161 | 162 | /* Compute and display topocentric position (altaz.c) 163 | */ 164 | pp[0] = this.ra; 165 | pp[1] = this.dec; 166 | pp[2] = moonpol[2]; 167 | $moshier.body.moon.position.altaz = $moshier.altaz.calc (pp, $moshier.body.earth.position.date); 168 | }; 169 | 170 | /* Calculate apparent latitude, longitude, and horizontal parallax 171 | * of the Moon at Julian date J. 172 | */ 173 | $ns.moon.calcll = function (date, rect, pol, result) { 174 | var cosB, sinB, cosL, sinL, y, z; // double 175 | var qq = [], pp = []; // double 176 | var i; // int 177 | 178 | result = result || {}; 179 | 180 | /* Compute obliquity of the ecliptic, coseps, and sineps. */ 181 | $moshier.epsilon.calc (date); 182 | /* Get geometric coordinates of the Moon. */ 183 | $moshier.gplan.moon (date, rect, pol); 184 | /* Post the geometric ecliptic longitude and latitude, in radians, 185 | * and the radius in au. 186 | */ 187 | $const.body.position.polar [0] = pol[0]; 188 | $const.body.position.polar[1] = pol[1]; 189 | $const.body.position.polar[2] = pol[2]; 190 | 191 | /* Light time correction to longitude, 192 | * about 0.7". 193 | */ 194 | pol[0] -= 0.0118 * $const.DTR * $const.Rearth / pol[2]; 195 | 196 | /* convert to equatorial system of date */ 197 | cosB = Math.cos(pol[1]); 198 | sinB = Math.sin(pol[1]); 199 | cosL = Math.cos(pol[0]); 200 | sinL = Math.sin(pol[0]); 201 | rect[0] = cosB*cosL; 202 | rect[1] = $moshier.epsilon.coseps*cosB*sinL - $moshier.epsilon.sineps*sinB; 203 | rect[2] = $moshier.epsilon.sineps*cosB*sinL + $moshier.epsilon.coseps*sinB; 204 | 205 | /* Rotate to J2000. */ 206 | $moshier.precess.calc ( rect, {julian: $moshier.body.earth.position.date.julian}, 1 ); // TDT 207 | 208 | /* Find Euclidean vectors and angles between earth, object, and the sun 209 | */ 210 | for( i=0; i<3; i++ ) { 211 | pp[i] = rect[i] * pol[2]; 212 | qq[i] = $moshier.body.earth.position.rect [i] + pp[i]; 213 | } 214 | $util.angles (pp, qq, $moshier.body.earth.position.rect); 215 | 216 | /* Make rect a unit vector. */ 217 | /* for (i = 0; i < 3; i++) */ 218 | /* rect[i] /= EO; */ 219 | 220 | /* Correct position for light deflection. 221 | (Ignore.) */ 222 | /* relativity( rect, qq, rearth ); */ 223 | 224 | /* Aberration of light. 225 | The Astronomical Almanac (Section D, Daily Polynomial Coefficients) 226 | seems to omit this, even though the reference ephemeris is inertial. */ 227 | /* annuab (rect); */ 228 | 229 | /* Precess to date. */ 230 | $moshier.precess.calc (rect, {julian: $moshier.body.earth.position.date.julian}, -1); // TDT 231 | 232 | /* Correct for nutation at date TDT. 233 | */ 234 | result.nutation = $moshier.nutation.calc ({julian: $moshier.body.earth.position.date.julian}, rect); // TDT 235 | 236 | /* Apparent geocentric right ascension and declination. */ 237 | this.ra = $util.zatan2(rect[0],rect[1]); 238 | this.dec = Math.asin(rect[2]); 239 | 240 | /* For apparent ecliptic coordinates, rotate from the true 241 | equator into the ecliptic of date. */ 242 | cosL = Math.cos($moshier.epsilon.eps + $moshier.nutation.nuto); 243 | sinL = Math.sin($moshier.epsilon.eps + $moshier.nutation.nuto); 244 | y = cosL * rect[1] + sinL * rect[2]; 245 | z = -sinL * rect[1] + cosL * rect[2]; 246 | pol[0] = $util.zatan2( rect[0], y ); 247 | pol[1] = Math.asin(z); 248 | 249 | /* Restore earth-moon distance. */ 250 | for( i=0; i<3; i++ ) { 251 | rect[i] *= $const.EO; 252 | } 253 | 254 | return result; 255 | }; 256 | -------------------------------------------------------------------------------- /astronomy/moshier/plan404/venus.js: -------------------------------------------------------------------------------- 1 | $ns.venus = { 2 | maxargs: 9, 3 | max_harmonic: [5, 14, 13, 8, 4, 5, 1, 0, 0], 4 | max_power_of_t: 5, 5 | distance: 7.2332982000000001e-01, 6 | timescale: 3652500.0, 7 | trunclvl: 1.0, 8 | lon_tbl: [9.08078, 55.42416, 21066413644.98911, 655127.20186, 0.00329, 0.10408, 0.00268, -0.01908, 0.00653, 0.00183, 0.15083, -0.21997, 6.08596, 2.34841, 3.70668, -0.22740, -2.29376, -1.46741, -0.03840, 0.01242, 0.00176, 0.00913, 0.00121, -0.01222, -1.22624, 0.65264, -1.15974, -1.28172, 1.00656, -0.66266, 0.01560, -0.00654, 0.00896, 0.00069, 0.21649, -0.01786, 0.01239, 0.00255, 0.00084, -0.06086, -0.00041, 0.00887, 0.13453, -0.20013, 0.08234, 0.01575, 0.00658, -0.00214, 0.00254, 0.00857, -0.01047, -0.00519, 0.63215, -0.40914, 0.34271, -1.53258, 0.00038, -0.01437, -0.02599, -2.27805, -0.36873, -1.01799, -0.36798, 1.41356, -0.08167, 0.01368, 0.20676, 0.06807, 0.02282, -0.04691, 0.30308, -0.20218, 0.24785, 0.27522, 0.00197, -0.00499, 1.43909, -0.46154, 0.93459, 2.99583, -3.43274, 0.05672, -0.06586, 0.12467, 0.02505, -0.08433, 0.00743, 0.00174, -0.04013, 0.17715, -0.00603, -0.01024, 0.01542, -0.02378, 0.00676, 0.00002, -0.00168, -4.89487, 0.02393, -0.03064, 0.00090, 0.00977, 0.01223, 0.00381, 0.28135, -0.09158, 0.18550, 0.58372, -0.67437, 0.01409, -0.25404, -0.06863, 0.06763, -0.02939, -0.00009, -0.04888, 0.01718, -0.00978, -0.01945, 0.08847, -0.00135, -11.29920, 0.01689, -0.04756, 0.02075, -0.01667, 0.01397, 0.00443, -0.28437, 0.07600, 0.17996, -0.44326, 0.29356, 1.41869, -1.58617, 0.03206, 0.00229, -0.00753, -0.03076, -2.96766, 0.00245, 0.00697, 0.01063, -0.02468, -0.00351, -0.18179, -0.01088, 0.00380, 0.00496, 0.02072, -0.12890, 0.16719, -0.06820, -0.03234, -60.36135, -11.74485, -11.03752, -3.80145, -21.33955, -284.54495, -763.43839, 248.50823, 1493.02775, 1288.79621, -2091.10921, -1851.15420, -0.00922, 0.06233, 0.00004, 0.00785, 0.10363, -0.16770, 0.45497, 0.24051, -0.28057, 0.61126, -0.02057, 0.00010, 0.00561, 0.01994, 0.01416, -0.00442, 0.03073, -0.14961, -0.06272, 0.08301, 0.02040, 7.12824, -0.00453, -0.01815, 0.00004, -0.00013, -0.03593, -0.18147, 0.20353, -0.00683, 0.00003, 0.06226, -0.00443, 0.00257, 0.03194, 0.03254, 0.00282, -0.01401, 0.00422, 1.03169, -0.00169, -0.00591, -0.00307, 0.00540, 0.05511, 0.00347, 0.07896, 0.06583, 0.00783, 0.01926, 0.03109, 0.15967, 0.00343, 0.88734, 0.01047, 0.32054, 0.00814, 0.00051, 0.02474, 0.00047, 0.00052, 0.03763, -57.06618, 20.34614, -45.06541, -115.20465, 136.46887, -84.67046, 92.93308, 160.44644, -0.00020, -0.00082, 0.02496, 0.00279, 0.00849, 0.00195, -0.05013, -0.04331, -0.00136, 0.14491, -0.00183, -0.00406, 0.01163, 0.00093, -0.00604, -0.00680, -0.00036, 0.06861, -0.00450, -0.00969, 0.00171, 0.00979, -0.00152, 0.03929, 0.00631, 0.00048, -0.00709, -0.00864, 1.51002, -0.24657, 1.27338, 2.64699, -2.40990, -0.57413, -0.00023, 0.03528, 0.00268, 0.00522, -0.00010, 0.01933, -0.00006, 0.01100, 0.06313, -0.09939, 0.08571, 0.03206, -0.00004, 0.00645], 9 | lat_tbl: [-23.91858, 31.44154, 25.93273, -67.68643, -0.00171, 0.00123, 0.00001, -0.00018, -0.00005, 0.00018, -0.00001, 0.00019, 0.00733, 0.00030, -0.00038, 0.00011, 0.00181, 0.00120, 0.00010, 0.00002, -0.00012, 0.00002, 0.00021, 0.00004, -0.00403, 0.00101, 0.00342, -0.00328, 0.01564, 0.01212, 0.00011, 0.00010, -0.00002, -0.00004, -0.00524, 0.00079, 0.00011, 0.00002, -0.00001, 0.00003, 0.00001, 0.00000, 0.00108, 0.00035, 0.00003, 0.00064, -0.00000, -0.00002, -0.00069, 0.00031, 0.00020, 0.00003, 0.00768, 0.03697, -0.07906, 0.01673, -0.00003, -0.00001, -0.00198, -0.01045, 0.01761, -0.00803, -0.00751, 0.04199, 0.00280, -0.00213, -0.00482, -0.00209, -0.01077, 0.00715, 0.00048, -0.00004, 0.00199, 0.00237, 0.00017, -0.00032, -0.07513, -0.00658, -0.04213, 0.16065, 0.27661, 0.06515, 0.02156, -0.08144, -0.23994, -0.05674, 0.00167, 0.00069, 0.00244, -0.01247, -0.00100, 0.00036, 0.00240, 0.00012, 0.00010, 0.00018, 0.00208, -0.00098, -0.00217, 0.00707, -0.00338, 0.01260, -0.00127, -0.00039, -0.03516, -0.00544, -0.01746, 0.08258, 0.10633, 0.02523, 0.00077, -0.00214, -0.02335, 0.00976, -0.00019, 0.00003, 0.00041, 0.00039, 0.00199, -0.01098, 0.00813, -0.00853, 0.02230, 0.00349, -0.02250, 0.08119, -0.00214, -0.00052, -0.00220, 0.15216, 0.17152, 0.08051, -0.01561, 0.27727, 0.25837, 0.07021, -0.00005, -0.00000, -0.02692, -0.00047, -0.00007, -0.00016, 0.01072, 0.01418, -0.00076, 0.00379, -0.00807, 0.03463, -0.05199, 0.06680, -0.00622, 0.00787, 0.00672, 0.00453, -10.69951, -67.43445, -183.55956, -37.87932, -102.30497, -780.40465, 2572.21990, -446.97798, 1665.42632, 5698.61327, -11889.66501, 2814.93799, 0.03204, -0.09479, 0.00014, -0.00001, -0.04118, -0.04562, 0.03435, -0.05878, 0.01700, 0.02566, -0.00121, 0.00170, 0.02390, 0.00403, 0.04629, 0.01896, -0.00521, 0.03215, -0.01051, 0.00696, -0.01332, -0.08937, -0.00469, -0.00751, 0.00016, -0.00035, 0.00492, -0.03930, -0.04742, -0.01013, 0.00065, 0.00021, -0.00006, 0.00017, 0.06768, -0.01558, -0.00055, 0.00322, -0.00287, -0.01656, 0.00061, -0.00041, 0.00030, 0.00047, -0.01436, -0.00148, 0.30302, -0.05511, -0.00020, -0.00005, 0.00042, -0.00025, 0.01270, 0.00458, -0.00593, -0.04480, 0.00005, -0.00008, 0.08457, -0.01569, 0.00062, 0.00018, 9.79942, -2.48836, 4.17423, 6.72044, -63.33456, 34.63597, 39.11878, -72.89581, -0.00066, 0.00036, -0.00045, -0.00062, -0.00287, -0.00118, -0.21879, 0.03947, 0.00086, 0.00671, -0.00113, 0.00122, -0.00193, -0.00029, -0.03612, 0.00635, 0.00024, 0.00207, -0.00273, 0.00443, -0.00055, 0.00030, -0.00451, 0.00175, -0.00110, -0.00015, -0.02608, 0.00480, 2.16555, -0.70419, 1.74648, 0.97514, -1.15360, 1.73688, 0.00004, 0.00105, 0.00187, -0.00311, 0.00005, 0.00055, 0.00004, 0.00032, -0.04629, 0.02292, -0.00363, -0.03807, 0.00002, 0.00020], 10 | rad_tbl: [-0.24459, 3.72698, -6.67281, 5.24378, 0.00030, 0.00003, -0.00002, -0.00000, -0.00000, 0.00001, 0.00032, 0.00021, -0.00326, 0.01002, 0.00067, 0.00653, 0.00243, -0.00417, -0.00004, -0.00010, -0.00002, -0.00001, 0.00004, -0.00002, -0.00638, -0.01453, 0.01458, -0.01235, 0.00755, 0.01030, 0.00006, 0.00014, 0.00000, 0.00009, 0.00063, 0.00176, 0.00003, -0.00022, 0.00112, 0.00001, -0.00014, -0.00001, 0.00485, 0.00322, -0.00035, 0.00198, 0.00004, 0.00013, -0.00015, -0.00003, 0.00011, -0.00025, 0.00634, 0.02207, 0.04620, 0.00160, 0.00045, 0.00001, -0.11563, 0.00643, -0.05947, 0.02018, 0.07704, 0.01574, -0.00090, -0.00471, -0.00322, 0.01104, 0.00265, -0.00038, 0.01395, 0.02165, -0.01948, 0.01713, -0.00057, -0.00019, 0.04889, 0.13403, -0.28327, 0.10597, -0.02325, -0.35829, 0.01171, -0.00904, 0.00747, 0.02546, 0.00029, -0.00190, -0.03408, -0.00703, 0.00176, -0.00109, 0.00463, 0.00293, 0.00000, 0.00148, 1.06691, -0.00054, -0.00935, -0.00790, 0.00552, -0.00084, -0.00100, 0.00336, 0.02874, 0.08604, -0.17876, 0.05973, -0.00720, -0.21195, 0.02134, -0.07980, 0.01500, 0.01398, 0.01758, -0.00004, 0.00371, 0.00650, -0.03375, -0.00723, 4.65465, -0.00040, 0.02040, 0.00707, -0.00727, -0.01144, -0.00196, 0.00620, -0.03396, -0.12904, 0.20160, 0.08092, -0.67045, 0.14014, -0.01571, -0.75141, 0.00361, 0.00110, 1.42165, -0.01499, -0.00334, 0.00117, 0.01187, 0.00507, 0.08935, -0.00174, -0.00211, -0.00525, 0.01035, -0.00252, -0.08355, -0.06442, 0.01616, -0.03409, 5.55241, -30.62428, 2.03824, -6.26978, 143.07279, -10.24734, -125.25411, -380.85360, -644.78411, 745.02852, 926.70000, -1045.09820, -0.03124, -0.00465, -0.00396, 0.00002, 0.08518, 0.05248, -0.12178, 0.23023, -0.30943, -0.14208, -0.00005, -0.01054, -0.00894, 0.00233, -0.00173, -0.00768, 0.07881, 0.01633, -0.04463, -0.03347, -3.92991, 0.00945, 0.01524, -0.00422, -0.00011, -0.00005, 0.10842, -0.02126, 0.00349, 0.12097, -0.03752, 0.00001, -0.00156, -0.00270, -0.01520, 0.01349, 0.00895, 0.00186, -0.67751, 0.00180, 0.00516, -0.00151, -0.00365, -0.00210, -0.00276, 0.03793, -0.02637, 0.03235, -0.01343, 0.00541, -0.11270, 0.02169, -0.63365, 0.00122, -0.24329, 0.00428, -0.00040, 0.00586, 0.00581, 0.01112, -0.02731, 0.00008, -2.69091, 0.42729, 2.78805, 3.43849, -0.87998, -6.62373, 0.56882, 4.69370, 0.00005, -0.00008, -0.00181, 0.01767, -0.00168, 0.00660, 0.01802, -0.01836, -0.11245, -0.00061, 0.00199, -0.00070, -0.00076, 0.00919, 0.00311, -0.00165, -0.05650, -0.00018, 0.00121, -0.00069, -0.00803, 0.00146, -0.03260, -0.00072, -0.00042, 0.00524, 0.00464, -0.00339, -0.06203, -0.00278, 0.04145, 0.02871, -0.01962, -0.01362, -0.03040, -0.00010, 0.00085, -0.00001, -0.01712, -0.00006, -0.00996, -0.00003, -0.00029, 0.00026, 0.00016, -0.00005, -0.00594, -0.00003], 11 | arg_tbl: [0, 3, 2, 2, 5, -5, 6, 0, 3, 2, 2, 1, 3, -8, 4, 0, 3, 5, 1, -14, 2, 2, 3, 0, 3, 3, 2, -7, 3, 4, 4, 0, 2, 8, 2, -13, 3, 2, 3, 6, 2, -10, 3, 3, 5, 0, 1, 1, 7, 0, 2, 1, 5, -2, 6, 0, 2, 1, 2, -3, 4, 2, 2, 2, 5, -4, 6, 1, 1, 1, 6, 0, 3, 3, 2, -5, 3, 1, 5, 0, 3, 3, 2, -5, 3, 2, 5, 0, 2, 1, 5, -1, 6, 0, 2, 2, 2, -6, 4, 1, 2, 2, 5, -3, 6, 0, 1, 2, 6, 0, 2, 3, 5, -5, 6, 0, 1, 1, 5, 1, 2, 2, 5, -2, 6, 0, 2, 3, 2, -5, 3, 2, 2, 5, 2, -8, 3, 1, 1, 2, 5, 0, 2, 2, 1, -5, 2, 1, 2, 6, 2, -10, 3, 0, 2, 2, 2, -3, 3, 2, 2, 1, 2, -2, 3, 1, 2, 4, 2, -7, 3, 0, 2, 4, 2, -6, 3, 0, 1, 1, 4, 0, 2, 1, 2, -2, 4, 0, 2, 2, 2, -5, 4, 0, 2, 1, 2, -1, 3, 0, 2, 1, 1, -3, 2, 0, 2, 2, 2, -4, 3, 0, 2, 6, 2, -9, 3, 0, 2, 3, 2, -4, 3, 2, 2, 1, 1, -2, 2, 0, 1, 1, 3, 0, 2, 1, 2, -1, 4, 0, 2, 2, 2, -4, 4, 0, 2, 5, 2, -7, 3, 0, 2, 2, 2, -2, 3, 0, 2, 1, 2, -3, 5, 0, 2, 1, 2, -3, 3, 0, 2, 7, 2, -10, 3, 0, 2, 1, 2, -2, 5, 1, 2, 4, 2, -5, 3, 1, 3, 1, 2, 1, 5, -5, 6, 0, 2, 1, 2, -1, 5, 0, 3, 1, 2, -3, 5, 5, 6, 0, 2, 1, 2, -2, 6, 0, 2, 1, 2, -1, 6, 0, 1, 3, 4, 0, 2, 7, 2, -13, 3, 0, 3, 1, 2, 2, 5, -5, 6, 1, 1, 1, 2, 5, 2, 9, 2, -13, 3, 0, 3, 1, 2, 1, 5, -2, 6, 0, 2, 2, 2, -3, 4, 2, 2, 3, 2, -6, 4, 0, 2, 1, 2, 1, 5, 0, 2, 2, 2, -5, 3, 0, 2, 6, 2, -8, 3, 0, 2, 2, 1, -4, 2, 0, 2, 3, 2, -3, 3, 0, 1, 2, 3, 0, 2, 3, 2, -7, 3, 0, 2, 5, 2, -6, 3, 1, 2, 2, 2, -2, 4, 0, 2, 3, 2, -5, 4, 0, 2, 2, 2, -1, 3, 0, 2, 7, 2, -9, 3, 0, 2, 4, 2, -4, 3, 0, 2, 1, 2, 1, 3, 0, 2, 3, 2, -4, 4, 0, 2, 6, 2, -7, 3, 0, 2, 3, 2, -2, 3, 0, 2, 2, 2, -4, 5, 0, 2, 2, 2, -3, 5, 0, 2, 2, 2, -2, 5, 0, 2, 5, 2, -5, 3, 0, 2, 2, 2, -3, 6, 0, 2, 2, 2, -1, 5, 0, 2, 2, 2, -2, 6, 0, 1, 2, 2, 3, 2, 2, 2, 1, 5, 0, 2, 7, 2, -8, 3, 0, 2, 2, 1, -3, 2, 0, 2, 4, 2, -3, 3, 0, 2, 6, 2, -6, 3, 0, 2, 3, 2, -1, 3, 0, 2, 8, 2, -9, 3, 0, 2, 5, 2, -4, 3, 0, 2, 7, 2, -7, 3, 0, 2, 4, 2, -2, 3, 0, 2, 3, 2, -4, 5, 0, 2, 3, 2, -3, 5, 0, 2, 9, 2, -10, 3, 0, 2, 3, 2, -2, 5, 0, 1, 3, 2, 2, 2, 8, 2, -8, 3, 0, 2, 5, 2, -3, 3, 0, 2, 9, 2, -9, 3, 0, 2, 10, 2, -10, 3, 0, 1, 4, 2, 1, 2, 11, 2, -11, 3, 0, -1] 12 | }; 13 | -------------------------------------------------------------------------------- /astronomy/moshier/nutation.js: -------------------------------------------------------------------------------- 1 | $ns.nutation = { 2 | /* The answers are posted here by nutlo(): 3 | */ 4 | jdnut: {}, /* time to which the nutation applies */ 5 | nutl: 0.0, /* nutation in longitude (radians) */ 6 | nuto: 0.0, /* nutation in obliquity (radians) */ 7 | 8 | /* Each term in the expansion has a trigonometric 9 | * argument given by 10 | * W = i*MM + j*MS + k*FF + l*DD + m*OM 11 | * where the variables are defined below. 12 | * The nutation in longitude is a sum of terms of the 13 | * form (a + bT) * sin(W). The terms for nutation in obliquity 14 | * are of the form (c + dT) * cos(W). The coefficients 15 | * are arranged in the tabulation as follows: 16 | * 17 | * Coefficient: 18 | * i j k l m a b c d 19 | * 0, 0, 0, 0, 1, -171996, -1742, 92025, 89, 20 | * The first line of the table, above, is done separately 21 | * since two of the values do not fit into 16 bit integers. 22 | * The values a and c are arc seconds times 10000. b and d 23 | * are arc seconds per Julian century times 100000. i through m 24 | * are integers. See the program for interpretation of MM, MS, 25 | * etc., which are mean orbital elements of the Sun and Moon. 26 | * 27 | * If terms with coefficient less than X are omitted, the peak 28 | * errors will be: 29 | * 30 | * omit error, omit error, 31 | * a < longitude c < obliquity 32 | * .0005" .0100" .0008" .0094" 33 | * .0046 .0492 .0095 .0481 34 | * .0123 .0880 .0224 .0905 35 | * .0386 .1808 .0895 .1129 36 | */ 37 | nt: [0, 0, 0, 0, 2, 2062, 2, -895, 5, -2, 0, 2, 0, 1, 46, 0, -24, 0, 2, 0, -2, 0, 0, 11, 0, 0, 0, -2, 0, 2, 0, 2, -3, 0, 1, 0, 1, -1, 0, -1, 0, -3, 0, 0, 0, 0, -2, 2, -2, 1, -2, 0, 1, 0, 2, 0, -2, 0, 1, 1, 0, 0, 0, 0, 0, 2, -2, 2, -13187, -16, 5736, -31, 0, 1, 0, 0, 0, 1426, -34, 54, -1, 0, 1, 2, -2, 2, -517, 12, 224, -6, 0, -1, 2, -2, 2, 217, -5, -95, 3, 0, 0, 2, -2, 1, 129, 1, -70, 0, 2, 0, 0, -2, 0, 48, 0, 1, 0, 0, 0, 2, -2, 0, -22, 0, 0, 0, 0, 2, 0, 0, 0, 17, -1, 0, 0, 0, 1, 0, 0, 1, -15, 0, 9, 0, 0, 2, 2, -2, 2, -16, 1, 7, 0, 0, -1, 0, 0, 1, -12, 0, 6, 0, -2, 0, 0, 2, 1, -6, 0, 3, 0, 0, -1, 2, -2, 1, -5, 0, 3, 0, 2, 0, 0, -2, 1, 4, 0, -2, 0, 0, 1, 2, -2, 1, 4, 0, -2, 0, 1, 0, 0, -1, 0, -4, 0, 0, 0, 2, 1, 0, -2, 0, 1, 0, 0, 0, 0, 0, -2, 2, 1, 1, 0, 0, 0, 0, 1, -2, 2, 0, -1, 0, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 0, -1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 2, -2, 0, -1, 0, 0, 0, 0, 0, 2, 0, 2, -2274, -2, 977, -5, 1, 0, 0, 0, 0, 712, 1, -7, 0, 0, 0, 2, 0, 1, -386, -4, 200, 0, 1, 0, 2, 0, 2, -301, 0, 129, -1, 1, 0, 0, -2, 0, -158, 0, -1, 0, -1, 0, 2, 0, 2, 123, 0, -53, 0, 0, 0, 0, 2, 0, 63, 0, -2, 0, 1, 0, 0, 0, 1, 63, 1, -33, 0, -1, 0, 0, 0, 1, -58, -1, 32, 0, -1, 0, 2, 2, 2, -59, 0, 26, 0, 1, 0, 2, 0, 1, -51, 0, 27, 0, 0, 0, 2, 2, 2, -38, 0, 16, 0, 2, 0, 0, 0, 0, 29, 0, -1, 0, 1, 0, 2, -2, 2, 29, 0, -12, 0, 2, 0, 2, 0, 2, -31, 0, 13, 0, 0, 0, 2, 0, 0, 26, 0, -1, 0, -1, 0, 2, 0, 1, 21, 0, -10, 0, -1, 0, 0, 2, 1, 16, 0, -8, 0, 1, 0, 0, -2, 1, -13, 0, 7, 0, -1, 0, 2, 2, 1, -10, 0, 5, 0, 1, 1, 0, -2, 0, -7, 0, 0, 0, 0, 1, 2, 0, 2, 7, 0, -3, 0, 0, -1, 2, 0, 2, -7, 0, 3, 0, 1, 0, 2, 2, 2, -8, 0, 3, 0, 1, 0, 0, 2, 0, 6, 0, 0, 0, 2, 0, 2, -2, 2, 6, 0, -3, 0, 0, 0, 0, 2, 1, -6, 0, 3, 0, 0, 0, 2, 2, 1, -7, 0, 3, 0, 1, 0, 2, -2, 1, 6, 0, -3, 0, 0, 0, 0, -2, 1, -5, 0, 3, 0, 1, -1, 0, 0, 0, 5, 0, 0, 0, 2, 0, 2, 0, 1, -5, 0, 3, 0, 0, 1, 0, -2, 0, -4, 0, 0, 0, 1, 0, -2, 0, 0, 4, 0, 0, 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, 1, 1, 0, 0, 0, -3, 0, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 0, 1, -1, 2, 0, 2, -3, 0, 1, 0, -1, -1, 2, 2, 2, -3, 0, 1, 0, -2, 0, 0, 0, 1, -2, 0, 1, 0, 3, 0, 2, 0, 2, -3, 0, 1, 0, 0, -1, 2, 2, 2, -3, 0, 1, 0, 1, 1, 2, 0, 2, 2, 0, -1, 0, -1, 0, 2, -2, 1, -2, 0, 1, 0, 2, 0, 0, 0, 1, 2, 0, -1, 0, 1, 0, 0, 0, 2, -2, 0, 1, 0, 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 1, 2, 2, 0, -1, 0, -1, 0, 0, 0, 2, 1, 0, -1, 0, 1, 0, 0, -4, 0, -1, 0, 0, 0, -2, 0, 2, 2, 2, 1, 0, -1, 0, -1, 0, 2, 4, 2, -2, 0, 1, 0, 2, 0, 0, -4, 0, -1, 0, 0, 0, 1, 1, 2, -2, 2, 1, 0, -1, 0, 1, 0, 2, 2, 1, -1, 0, 1, 0, -2, 0, 2, 4, 2, -1, 0, 1, 0, -1, 0, 4, 0, 2, 1, 0, 0, 0, 1, -1, 0, -2, 0, 1, 0, 0, 0, 2, 0, 2, -2, 1, 1, 0, -1, 0, 2, 0, 2, 2, 2, -1, 0, 0, 0, 1, 0, 0, 2, 1, -1, 0, 0, 0, 0, 0, 4, -2, 2, 1, 0, 0, 0, 3, 0, 2, -2, 2, 1, 0, 0, 0, 1, 0, 2, -2, 0, -1, 0, 0, 0, 0, 1, 2, 0, 1, 1, 0, 0, 0, -1, -1, 0, 2, 1, 1, 0, 0, 0, 0, 0, -2, 0, 1, -1, 0, 0, 0, 0, 0, 2, -1, 2, -1, 0, 0, 0, 0, 1, 0, 2, 0, -1, 0, 0, 0, 1, 0, -2, -2, 0, -1, 0, 0, 0, 0, -1, 2, 0, 1, -1, 0, 0, 0, 1, 1, 0, -2, 1, -1, 0, 0, 0, 1, 0, -2, 2, 0, -1, 0, 0, 0, 2, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 2, 4, 2, -1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0], 38 | ss: [], 39 | cc: [] 40 | }; 41 | 42 | /* Nutation -- AA page B20 43 | * using nutation in longitude and obliquity from nutlo() 44 | * and obliquity of the ecliptic from epsiln() 45 | * both calculated for Julian date J. 46 | * 47 | * p[] = equatorial rectangular position vector of object for 48 | * mean ecliptic and equinox of date. 49 | */ 50 | $ns.nutation.calc = function (date, p) { 51 | var ce, se, cl, sl, sino, f; // double 52 | var dp = [], p1 = []; // double 53 | var i; // int 54 | var result; 55 | 56 | this.calclo (date); /* be sure we calculated nutl and nuto */ 57 | $moshier.epsilon.calc (date); /* and also the obliquity of date */ 58 | 59 | f = $moshier.epsilon.eps + this.nuto; 60 | ce = Math.cos( f ); 61 | se = Math.sin( f ); 62 | sino = Math.sin(this.nuto); 63 | cl = Math.cos( this.nutl ); 64 | sl = Math.sin( this.nutl ); 65 | 66 | /* Apply adjustment 67 | * to equatorial rectangular coordinates of object. 68 | * 69 | * This is a composite of three rotations: rotate about x axis 70 | * to ecliptic of date; rotate about new z axis by the nutation 71 | * in longitude; rotate about new x axis back to equator of date 72 | * plus nutation in obliquity. 73 | */ 74 | p1[0] = cl*p[0] 75 | - sl*$moshier.epsilon.coseps*p[1] 76 | - sl*$moshier.epsilon.sineps*p[2]; 77 | 78 | p1[1] = sl*ce*p[0] 79 | + ( cl*$moshier.epsilon.coseps*ce + $moshier.epsilon.sineps*se )*p[1] 80 | - ( sino + (1.0-cl)*$moshier.epsilon.sineps*ce )*p[2]; 81 | 82 | p1[2] = sl*se*p[0] 83 | + ( sino + (cl-1.0)*se*$moshier.epsilon.coseps )*p[1] 84 | + ( cl*$moshier.epsilon.sineps*se + $moshier.epsilon.coseps*ce )*p[2]; 85 | 86 | for( i=0; i<3; i++ ) { 87 | dp[i] = p1[i] - p[i]; 88 | } 89 | 90 | result = $util.showcor (p, dp); 91 | 92 | for( i=0; i<3; i++ ) { 93 | p[i] = p1[i]; 94 | } 95 | 96 | return result; 97 | }; 98 | 99 | /* Nutation in longitude and obliquity 100 | * computed at Julian date J. 101 | */ 102 | $ns.nutation.calclo = function (date) { 103 | var f, g, T, T2, T10; // double 104 | var MM, MS, FF, DD, OM; // double 105 | var cu, su, cv, sv, sw; // double 106 | var C, D; // double 107 | var i, j, k, k1, m; // int 108 | var p; // short array 109 | 110 | if( this.jdnut.julian == date.julian ) 111 | return(0); 112 | this.jdnut = date; 113 | 114 | /* Julian centuries from 2000 January 1.5, 115 | * barycentric dynamical time 116 | */ 117 | T = (date.julian - 2451545.0) / 36525.0; 118 | T2 = T * T; 119 | T10 = T / 10.0; 120 | 121 | /* Fundamental arguments in the FK5 reference system. */ 122 | 123 | /* longitude of the mean ascending node of the lunar orbit 124 | * on the ecliptic, measured from the mean equinox of date 125 | */ 126 | OM = ($util.mods3600 (-6962890.539 * T + 450160.280) + (0.008 * T + 7.455) * T2) 127 | * $const.STR; 128 | 129 | /* mean longitude of the Sun minus the 130 | * mean longitude of the Sun's perigee 131 | */ 132 | MS = ($util.mods3600 (129596581.224 * T + 1287099.804) - (0.012 * T + 0.577) * T2) 133 | * $const.STR; 134 | 135 | /* mean longitude of the Moon minus the 136 | * mean longitude of the Moon's perigee 137 | */ 138 | MM = ($util.mods3600 (1717915922.633 * T + 485866.733) + (0.064 * T + 31.310) * T2) 139 | * $const.STR; 140 | 141 | /* mean longitude of the Moon minus the 142 | * mean longitude of the Moon's node 143 | */ 144 | FF = ($util.mods3600 (1739527263.137 * T + 335778.877) + (0.011 * T - 13.257) * T2) 145 | * $const.STR; 146 | 147 | /* mean elongation of the Moon from the Sun. 148 | */ 149 | DD = ($util.mods3600 (1602961601.328 * T + 1072261.307) + (0.019 * T - 6.891) * T2) 150 | * $const.STR; 151 | 152 | /* Calculate sin( i*MM ), etc. for needed multiple angles 153 | */ 154 | this.sscc ( 0, MM, 3 ); 155 | this.sscc ( 1, MS, 2 ); 156 | this.sscc ( 2, FF, 4 ); 157 | this.sscc ( 3, DD, 4 ); 158 | this.sscc ( 4, OM, 2 ); 159 | 160 | C = 0.0; 161 | D = 0.0; 162 | p = this.nt; /* point to start of table */ 163 | 164 | var p_i = 0; 165 | 166 | for( i=0; i<105; i++ ) { 167 | /* argument of sine and cosine */ 168 | k1 = 0; 169 | cv = 0.0; 170 | sv = 0.0; 171 | for( m=0; m<5; m++ ) { 172 | j = p [p_i ++]; //*p++; 173 | if( j ) { 174 | k = j; 175 | if( j < 0 ) { 176 | k = -k; 177 | } 178 | su = this.ss[m][k-1]; /* sin(k*angle) */ 179 | if( j < 0 ) { 180 | su = -su; 181 | } 182 | cu = this.cc[m][k-1]; 183 | if( k1 == 0 ) { /* set first angle */ 184 | sv = su; 185 | cv = cu; 186 | k1 = 1; 187 | } else { /* combine angles */ 188 | sw = su*cv + cu*sv; 189 | cv = cu*cv - su*sv; 190 | sv = sw; 191 | } 192 | } 193 | } 194 | /* longitude coefficient */ 195 | f = p [p_i ++]; //*p++; 196 | if( (k = p [p_i ++] /* *p++ */) != 0 ) { 197 | f += T10 * k; 198 | } 199 | 200 | /* obliquity coefficient */ 201 | g = p [p_i ++]; //*p++; 202 | if( (k = p [p_i ++] /* *p++ */) != 0 ) 203 | g += T10 * k; 204 | 205 | /* accumulate the terms */ 206 | C += f * sv; 207 | D += g * cv; 208 | } 209 | /* first terms, not in table: */ 210 | C += (-1742.*T10 - 171996.)*this.ss[4][0]; /* sin(OM) */ 211 | D += ( 89.*T10 + 92025.)*this.cc[4][0]; /* cos(OM) */ 212 | /* 213 | printf( "nutation: in longitude %.3f\", in obliquity %.3f\"\n", C, D ); 214 | */ 215 | /* Save answers, expressed in radians */ 216 | this.nutl = 0.0001 * $const.STR * C; 217 | this.nuto = 0.0001 * $const.STR * D; 218 | }; 219 | 220 | /* Prepare lookup table of sin and cos ( i*Lj ) 221 | * for required multiple angles 222 | */ 223 | $ns.nutation.sscc = function (k, arg, n) { 224 | var cu, su, cv, sv, s; // double 225 | var i; // int 226 | 227 | su = Math.sin (arg); 228 | cu = Math.cos (arg); 229 | this.ss[k] = []; 230 | this.cc[k] = []; 231 | 232 | this.ss[k][0] = su; /* sin(L) */ 233 | this.cc[k][0] = cu; /* cos(L) */ 234 | sv = 2.0 * su * cu; 235 | cv = cu * cu - su * su; 236 | this.ss[k][1] = sv; /* sin(2L) */ 237 | this.cc[k][1] = cv; 238 | for (i = 2; i < n; i++) 239 | { 240 | s = su * cv + cu * sv; 241 | cv = cu * cv - su * sv; 242 | sv = s; 243 | this.ss[k][i] = sv; /* sin( i+1 L ) */ 244 | this.cc[k][i] = cv; 245 | } 246 | }; 247 | -------------------------------------------------------------------------------- /astronomy/moshier/kepler.js: -------------------------------------------------------------------------------- 1 | $ns.kepler = {}; 2 | 3 | $ns.kepler.calc = function (date, body, rect, polar) { 4 | var alat, E, M, W, temp; // double 5 | var epoch, inclination, ascnode, argperih; // double 6 | var meandistance, dailymotion, eccent, meananomaly; // double 7 | var r, coso, sino, cosa; // double 8 | 9 | rect = rect || []; 10 | polar = polar || []; 11 | 12 | /* Call program to compute position, if one is supplied. */ 13 | if ( body.ptable ) { 14 | if ( body.key == 'earth' ) { 15 | $moshier.gplan.calc3 (date, body.ptable, polar, 3); 16 | } else { 17 | $moshier.gplan.calc (date, body.ptable, polar); 18 | } 19 | E = polar[0]; /* longitude */ 20 | body.longitude = E; 21 | W = polar[1]; /* latitude */ 22 | r = polar[2]; /* radius */ 23 | body.distance = r; 24 | body.epoch = date.julian; 25 | body.equinox = {julian: $const.j2000}; 26 | // goto kepdon; 27 | } else { 28 | /* Decant the parameters from the data structure 29 | */ 30 | epoch = body.epoch; 31 | inclination = body.inclination; 32 | ascnode = body.node * $const.DTR; 33 | argperih = body.perihelion; 34 | meandistance = body.semiAxis; /* semimajor axis */ 35 | dailymotion = body.dailyMotion; 36 | eccent = body.eccentricity; 37 | meananomaly = body.anomaly; 38 | /* Check for parabolic orbit. */ 39 | if( eccent == 1.0 ) { 40 | /* meandistance = perihelion distance, q 41 | * epoch = perihelion passage date 42 | */ 43 | temp = meandistance * Math.sqrt (meandistance); 44 | W = (date.julian - epoch ) * 0.0364911624 / temp; 45 | /* The constant above is 3 k / sqrt(2), 46 | * k = Gaussian gravitational constant = 0.01720209895 . */ 47 | E = 0.0; 48 | M = 1.0; 49 | while (Math.abs(M) > 1.0e-11) { 50 | temp = E * E; 51 | temp = (2.0 * E * temp + W)/( 3.0 * (1.0 + temp)); 52 | M = temp - E; 53 | if( temp != 0.0 ) { 54 | M /= temp; 55 | } 56 | E = temp; 57 | } 58 | r = meandistance * (1.0 + E * E ); 59 | M = Math.atan (E); 60 | M = 2.0 * M; 61 | alat = M + $const.DTR*argperih; 62 | // goto parabcon; 63 | } else { 64 | if( eccent > 1.0 ) { 65 | /* The equation of the hyperbola in polar coordinates r, theta 66 | * is r = a(e^2 - 1)/(1 + e cos(theta)) 67 | * so the perihelion distance q = a(e-1), 68 | * the "mean distance" a = q/(e-1). 69 | */ 70 | meandistance = meandistance/(eccent - 1.0); 71 | temp = meandistance * Math.sqrt(meandistance); 72 | W = (date.julian - epoch ) * 0.01720209895 / temp; 73 | /* solve M = -E + e sinh E */ 74 | E = W/(eccent - 1.0); 75 | M = 1.0; 76 | while( Math.abs(M) > 1.0e-11 ) 77 | { 78 | M = -E + eccent * $util.sinh(E) - W; 79 | E += M/(1.0 - eccent * $util.cosh(E)); 80 | } 81 | r = meandistance * (-1.0 + eccent * $util.cosh(E)); 82 | temp = (eccent + 1.0)/(eccent - 1.0); 83 | M = Math.sqrt(temp) * $util.tanh( 0.5*E ); 84 | M = 2.0 * Math.atan(M); 85 | alat = M + $const.DTR * argperih; 86 | // goto parabcon; 87 | } else { 88 | /* Calculate the daily motion, if it is not given. 89 | */ 90 | if( dailymotion == 0.0 ) 91 | { 92 | /* The constant is 180 k / pi, k = Gaussian gravitational constant. 93 | * Assumes object in heliocentric orbit is massless. 94 | */ 95 | dailymotion = 0.9856076686 / (body.semiAxis * Math.sqrt(body.semiAxis)); 96 | } 97 | dailymotion *= date.julian - epoch; 98 | /* M is proportional to the area swept out by the radius 99 | * vector of a circular orbit during the time between 100 | * perihelion passage and Julian date J. 101 | * It is the mean anomaly at time J. 102 | */ 103 | M = $const.DTR * ( meananomaly + dailymotion ); 104 | M = $util.modtp(M); 105 | /* If mean longitude was calculated, adjust it also 106 | * for motion since epoch of elements. 107 | */ 108 | if( body.longitude ) 109 | { 110 | body.longitude += dailymotion; 111 | body.longitude = $util.mod360 (body.longitude); 112 | } 113 | 114 | /* By Kepler's second law, M must be equal to 115 | * the area swept out in the same time by an 116 | * elliptical orbit of same total area. 117 | * Integrate the ellipse expressed in polar coordinates 118 | * r = a(1-e^2)/(1 + e cosW) 119 | * with respect to the angle W to get an expression for the 120 | * area swept out by the radius vector. The area is given 121 | * by the mean anomaly; the angle is solved numerically. 122 | * 123 | * The answer is obtained in two steps. We first solve 124 | * Kepler's equation 125 | * M = E - eccent*sin(E) 126 | * for the eccentric anomaly E. Then there is a 127 | * closed form solution for W in terms of E. 128 | */ 129 | 130 | E = M; /* Initial guess is same as circular orbit. */ 131 | temp = 1.0; 132 | do { 133 | /* The approximate area swept out in the ellipse */ 134 | temp = E - eccent * Math.sin(E) 135 | /* ...minus the area swept out in the circle */ 136 | - M; 137 | /* ...should be zero. Use the derivative of the error 138 | * to converge to solution by Newton's method. 139 | */ 140 | E -= temp/(1.0 - eccent * Math.cos(E)); 141 | } while ( Math.abs(temp) > 1.0e-11 ); 142 | 143 | /* The exact formula for the area in the ellipse is 144 | * 2.0*atan(c2*tan(0.5*W)) - c1*eccent*sin(W)/(1+e*cos(W)) 145 | * where 146 | * c1 = sqrt( 1.0 - eccent*eccent ) 147 | * c2 = sqrt( (1.0-eccent)/(1.0+eccent) ). 148 | * Substituting the following value of W 149 | * yields the exact solution. 150 | */ 151 | temp = Math.sqrt( (1.0+eccent)/(1.0-eccent) ); 152 | W = 2.0 * Math.atan( temp * Math.tan(0.5*E) ); 153 | 154 | /* The true anomaly. 155 | */ 156 | W = $util.modtp(W); 157 | 158 | meananomaly *= $const.DTR; 159 | /* Orbital longitude measured from node 160 | * (argument of latitude) 161 | */ 162 | if( body.longitude ) { 163 | alat = (body.longitude) * $const.DTR + W - meananomaly - ascnode; 164 | } else { 165 | alat = W + $const.DTR * argperih; /* mean longitude not given */ 166 | } 167 | 168 | /* From the equation of the ellipse, get the 169 | * radius from central focus to the object. 170 | */ 171 | r = meandistance*(1.0-eccent*eccent)/(1.0+eccent*Math.cos(W)); 172 | } 173 | } 174 | // parabcon: 175 | /* The heliocentric ecliptic longitude of the object 176 | * is given by 177 | * tan( longitude - ascnode ) = cos( inclination ) * tan( alat ). 178 | */ 179 | coso = Math.cos( alat ); 180 | sino = Math.sin( alat ); 181 | inclination *= $const.DTR; 182 | W = sino * Math.cos( inclination ); 183 | E = $util.zatan2 ( coso, W ) + ascnode; 184 | 185 | /* The ecliptic latitude of the object 186 | */ 187 | W = sino * Math.sin( inclination ); 188 | W = Math.asin (W); 189 | } 190 | // kepdon: 191 | 192 | /* Convert to rectangular coordinates, 193 | * using the perturbed latitude. 194 | */ 195 | rect[2] = r * Math.sin(W); 196 | cosa = Math.cos(W); 197 | rect[1] = r * cosa * Math.sin(E); 198 | rect[0] = r * cosa * Math.cos(E); 199 | 200 | /* Convert from heliocentric ecliptic rectangular 201 | * to heliocentric equatorial rectangular coordinates 202 | * by rotating eps radians about the x axis. 203 | */ 204 | $moshier.epsilon.calc (body.equinox); 205 | W = $moshier.epsilon.coseps*rect[1] - $moshier.epsilon.sineps*rect[2]; 206 | M = $moshier.epsilon.sineps*rect[1] + $moshier.epsilon.coseps*rect[2]; 207 | rect[1] = W; 208 | rect[2] = M; 209 | 210 | /* Precess the position 211 | * to ecliptic and equinox of J2000.0 212 | * if not already there. 213 | */ 214 | $moshier.precess.calc (rect, body.equinox, 1); 215 | 216 | /* If earth, adjust from earth-moon barycenter to earth 217 | * by AA page E2. 218 | */ 219 | if( body.key == 'earth' ) { 220 | r = this.embofs ( date, rect); /* see below */ 221 | } 222 | 223 | /* Rotate back into the ecliptic. */ 224 | $moshier.epsilon.calc ({julian: $const.j2000}); 225 | W = $moshier.epsilon.coseps*rect[1] + $moshier.epsilon.sineps*rect[2]; 226 | M = -$moshier.epsilon.sineps*rect[1] + $moshier.epsilon.coseps*rect[2]; 227 | 228 | /* Convert to polar coordinates */ 229 | E = $util.zatan2( rect[0], W ); 230 | W = Math.asin( M/r ); 231 | 232 | /* Output the polar cooordinates 233 | */ 234 | polar[0] = E; /* longitude */ 235 | polar[1] = W; /* latitude */ 236 | polar[2] = r; /* radius */ 237 | 238 | // fill the body.position only if rect and polar are 239 | // not defined 240 | if (arguments.length < 4) { 241 | body.position = { 242 | date: date, 243 | rect: rect, 244 | polar: polar 245 | }; 246 | } 247 | }; 248 | 249 | /* Adjust position from Earth-Moon barycenter to Earth 250 | * 251 | * J = Julian day number 252 | * emb = Equatorial rectangular coordinates of EMB. 253 | * return = Earth's distance to the Sun (au) 254 | */ 255 | $ns.kepler.embofs = function (date, ea) { 256 | var pm = [], polm = []; // double 257 | var a, b; // double 258 | var i; // int 259 | 260 | /* Compute the vector Moon - Earth. */ 261 | $moshier.gplan.moon (date, pm, polm); 262 | 263 | /* Precess the lunar position 264 | * to ecliptic and equinox of J2000.0 265 | */ 266 | $moshier.precess.calc (pm, date, 1); 267 | 268 | /* Adjust the coordinates of the Earth 269 | */ 270 | a = 1.0 / ($const.emrat + 1.0); 271 | b = 0.0; 272 | for( i=0; i<3; i++ ) { 273 | ea[i] = ea[i] - a * pm[i]; 274 | b = b + ea[i] * ea[i]; 275 | } 276 | /* Sun-Earth distance. */ 277 | return Math.sqrt (b); 278 | }; 279 | 280 | $ns.kepler.init = function () { 281 | var a, b, fl, co, si, u; // double 282 | 283 | u = $const.glat * $const.DTR; 284 | 285 | /* Reduction from geodetic latitude to geocentric latitude 286 | * AA page K5 287 | */ 288 | co = Math.cos(u); 289 | si = Math.sin(u); 290 | fl = 1.0 - 1.0 / $const.flat; 291 | fl = fl*fl; 292 | si = si*si; 293 | u = 1.0/Math.sqrt( co*co + fl*si ); 294 | a = $const.aearth*u + $const.height; 295 | b = $const.aearth*fl*u + $const.height; 296 | $const.trho = Math.sqrt( a*a*co*co + b*b*si ); 297 | $const.tlat = $const.RTD * Math.acos( a*co/$const.trho ); 298 | if( $const.glat < 0.0 ) { 299 | $const.tlat = -$const.tlat; 300 | } 301 | $const.trho /= $const.aearth; 302 | 303 | /* Reduction from geodetic latitude to geocentric latitude 304 | * AA page K5 305 | */ 306 | /* 307 | tlat = glat 308 | - 0.19242861 * sin(2.0*u) 309 | + 0.00032314 * sin(4.0*u) 310 | - 0.00000072 * sin(6.0*u); 311 | 312 | trho = 0.998327073 313 | + 0.001676438 * cos(2.0*u) 314 | - 0.000003519 * cos(4.0*u) 315 | + 0.000000008 * cos(6.0*u); 316 | trho += height/6378160.; 317 | */ 318 | 319 | $const.Clightaud = 86400.0 * $const.Clight / $const.au; 320 | /* Radius of the earth in au 321 | Thanks to Min He for pointing out 322 | this needs to be initialized early. */ 323 | $const.Rearth = 0.001 * $const.aearth / $const.au; 324 | }; -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ephemeris 5 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 151 | 203 |
Ephemerides
129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 |
Time
TerrestrialUniversalDelta
Gregorian=+
Julian
152 | 153 | 154 | 201 | 202 |
ObserverBody
155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 |
Body
GeodeticGeodecentric
Longitude
Latitude
Height
180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 |
Body
Apparent Longitude (dms 30°)
Apparent Longitude (dms 360°)
Apparent Longitude (dd)
Geocentric distance (km)
204 | 205 | 206 | -------------------------------------------------------------------------------- /astronomy/moshier/constellation.js: -------------------------------------------------------------------------------- 1 | $ns.constellation = { 2 | /* Constellation names 3 | */ 4 | constel: [ 5 | "And Andromedae", 6 | "Ant Antliae", 7 | "Aps Apodis", 8 | "Aql Aquilae", 9 | "Aqr Aquarii", 10 | "Ari Arietis", 11 | "Ara Arae", 12 | "Aur Aurigae", 13 | "Boo Bootis", 14 | "Cae Caeli", 15 | "Cam Camelopardalis", 16 | "Can Cancri", /* also abbreviated Cnc */ 17 | "Cap Capricorni", 18 | "Car Carinae", 19 | "Cas Cassiopeiae", 20 | "Cen Centauri", 21 | "Cep Cephei", 22 | "Cet Ceti", 23 | "Cha Chamaeleontis", 24 | "Cir Circini", 25 | "CMa Canis Majoris", 26 | "CMi Canis Minoris", 27 | "Cnc Cancri", 28 | "Col Columbae", 29 | "Com Comae Berenices", 30 | "CrA Coronae Austrinae", 31 | "CrB Coronae Borealis", 32 | "Crt Crateris", 33 | "Cru Crucis", 34 | "Crv Corvi", 35 | "CVn Canum Venaticorum", 36 | "Cyg Cygni", 37 | "Del Delphini", 38 | "Dor Doradus", 39 | "Dra Draconis", 40 | "Equ Equulei", 41 | "Eri Eridani", 42 | "For Fornacis", 43 | "Gem Geminorum", 44 | "Gru Gruis", 45 | "Her Herculis", 46 | "Hor Horologii", 47 | "Hya Hydrae", 48 | "Hyi Hydri", 49 | "Ind Indi", 50 | "Lac Lacertae", 51 | "Leo Leonis", 52 | "Lep Leporis", 53 | "Lib Librae", 54 | "LMi Leonis Minoris", 55 | "Lup Lupi", 56 | "Lyn Lyncis", 57 | "Lyr Lyrae", 58 | "Men Mensae", 59 | "Mic Microscopii", 60 | "Mon Monocerotis", 61 | "Mus Muscae", 62 | "Nor Normae", 63 | "Oct Octantis", 64 | "Oph Ophiuchi", 65 | "Ori Orionis", 66 | "Pav Pavonis", 67 | "Peg Pegasi", 68 | "Per Persei", 69 | "Phe Phoenicis", 70 | "Pic Pictoris", 71 | "PsA Piscis Austrini", 72 | "Psc Piscium", 73 | "Pup Puppis", 74 | "Pyx Pyxidis", 75 | "Ret Reticuli", 76 | "Scl Sculptoris", 77 | "Sco Scorpii", 78 | "Sct Scuti", 79 | "Ser Serpentis", 80 | "Sex Sextantis", 81 | "Sge Sagittae", 82 | "Sgr Sagittarii", 83 | "Tau Tauri", 84 | "Tel Telescopii", 85 | "TrA Trianguli Australis", 86 | "Tri Trianguli", 87 | "Tuc Tucanae", 88 | "UMa Ursae Majoris", 89 | "UMi Ursae Minoris", 90 | "Vel Velorum", 91 | "Vir Virginis", 92 | "Vol Volantis", 93 | "Vul Vulpeculae" 94 | ], 95 | 96 | /* Greek letters 97 | */ 98 | greek: [ 99 | "alpha", 100 | "beta", 101 | "gamma", 102 | "delta", 103 | "epsilon", 104 | "zeta", 105 | "eta", 106 | "theta", 107 | "iota", 108 | "kappa", 109 | "lambda", 110 | "mu", 111 | "nu", 112 | "xi", 113 | "omicron", 114 | "pi", 115 | "rho", 116 | "sigma", 117 | "tau", 118 | "upsilon", 119 | "phi", 120 | "chi", 121 | "psi", 122 | "omega" 123 | ], 124 | 125 | /* Table of constellation boundaries. 126 | 127 | Roman, Nancy Grace, "Identification of a Constellation from a Position" 128 | Pub. Astron. Soc. Pac. 99, 695, (1987) 129 | 130 | Array items are 131 | Lower Right Ascension, Upper Right Ascension, 132 | both in units of hours times 3600; 133 | Lower Declination, in units of degrees times 3600; 134 | and array index of constellation name. */ 135 | bndries: [0, 86400, 316800, 84, 28800, 52200, 311400, 84, 75600, 82800, 310200, 84, 64800, 75600, 309600, 84, 0, 28800, 306000, 16, 33000, 38400, 295200, 10, 0, 18000, 288000, 16, 38400, 52200, 288000, 10, 63000, 64800, 288000, 84, 72600, 75600, 288000, 34, 0, 12630, 277200, 16, 41400, 48900, 277200, 10, 59520, 63000, 270000, 84, 72600, 74400, 270000, 16, 28680, 33000, 264600, 10, 33000, 40800, 264600, 34, 46800, 59520, 252000, 84, 11160, 12300, 244800, 14, 73500, 74400, 241200, 34, 40800, 43200, 239400, 34, 0, 1200, 237600, 16, 50400, 56400, 237600, 84, 84900, 86400, 237600, 16, 43200, 48600, 230400, 34, 48600, 51900, 226800, 34, 83400, 84900, 226800, 16, 21960, 25200, 223200, 10, 72000, 73500, 221400, 34, 73932, 74160, 219300, 16, 25200, 28680, 216000, 10, 28680, 30300, 216000, 83, 71160, 72000, 214200, 34, 72000, 73932, 214200, 16, 82320, 83400, 212700, 16, 0, 8760, 210600, 14, 69900, 71160, 208800, 34, 6120, 6870, 207000, 14, 8760, 11160, 205200, 14, 11160, 11400, 205200, 10, 80340, 82320, 202500, 16, 18000, 21960, 201600, 10, 50520, 51900, 199800, 83, 51900, 69900, 199800, 34, 11400, 12000, 198000, 10, 79680, 80340, 198000, 16, 74160, 79080, 197400, 16, 0, 6120, 194400, 14, 21960, 23400, 194400, 51, 43500, 48600, 190800, 83, 54900, 56700, 190800, 34, 79080, 79680, 189900, 16, 12000, 18000, 189000, 10, 82320, 84000, 189000, 14, 56700, 61200, 185400, 34, 7350, 9060, 181800, 63, 61200, 65640, 181800, 34, 0, 4920, 180000, 14, 4920, 6000, 180000, 63, 23400, 24480, 180000, 51, 84000, 86400, 180000, 14, 48600, 50520, 174600, 83, 0, 4020, 172800, 14, 84900, 86400, 172800, 14, 65430, 65640, 171000, 40, 65640, 68700, 171000, 34, 68700, 69000, 171000, 31, 6000, 7350, 169200, 63, 30300, 33000, 169200, 83, 600, 3120, 165600, 14, 43200, 43500, 162000, 83, 24480, 26520, 160200, 51, 78870, 79080, 158400, 31, 78750, 78870, 157500, 31, 69000, 69840, 156600, 31, 33000, 36600, 151200, 83, 36600, 38820, 144000, 83, 55560, 56700, 144000, 8, 56700, 58800, 144000, 40, 33300, 34500, 143100, 51, 0, 9060, 132300, 0, 9060, 9240, 132300, 63, 69690, 69840, 131400, 52, 16200, 16890, 129600, 63, 78240, 78750, 129600, 31, 78750, 79200, 129600, 45, 23520, 26520, 127800, 7, 26520, 27900, 127800, 51, 0, 7200, 126000, 0, 79200, 82140, 126000, 45, 82140, 82320, 124200, 45, 82320, 84600, 124200, 0, 9240, 9780, 122400, 63, 38820, 39600, 122400, 83, 43200, 44400, 122400, 30, 27900, 33300, 120600, 51, 33300, 35580, 120600, 49, 2580, 5070, 118800, 0, 54660, 55560, 118800, 8, 84600, 85500, 115500, 0, 44400, 47700, 115200, 30, 85500, 86400, 112800, 0, 50250, 50520, 110700, 30, 8700, 9780, 110400, 81, 9780, 16200, 110400, 63, 16200, 17100, 108000, 7, 65430, 69690, 108000, 52, 39600, 43200, 104400, 83, 70800, 75300, 104400, 31, 17100, 21180, 102600, 7, 35580, 37800, 102600, 49, 47700, 50250, 102600, 30, 0, 240, 100800, 0, 5070, 6000, 100800, 81, 21180, 23520, 100800, 7, 28380, 28800, 100800, 38, 75300, 78240, 100800, 31, 69330, 70800, 99000, 31, 6900, 8700, 98100, 81, 58200, 58800, 97200, 26, 54300, 54660, 93600, 8, 54660, 58200, 93600, 26, 66120, 67920, 93600, 52, 38700, 39600, 91800, 49, 67920, 69330, 91800, 52, 6000, 6900, 90000, 81, 2580, 3060, 85500, 67, 37800, 38700, 84600, 49, 76500, 77100, 84600, 88, 20520, 21180, 82200, 78, 240, 510, 79200, 0, 57300, 57720, 79200, 74, 21180, 22380, 77400, 38, 71400, 72900, 76500, 88, 67920, 69300, 75900, 88, 510, 3060, 75600, 0, 72900, 74040, 73800, 88, 28110, 28380, 72000, 38, 74040, 76500, 70200, 88, 69300, 71400, 69000, 88, 11820, 12120, 68400, 5, 67920, 68400, 66600, 76, 20520, 20760, 64800, 60, 22380, 22710, 63000, 38, 68400, 71400, 58200, 76, 17880, 19200, 57600, 78, 57300, 57900, 57600, 40, 71400, 72900, 56700, 76, 16620, 17880, 55800, 78, 19200, 20160, 55800, 78, 46200, 48600, 54000, 24, 62100, 65700, 51600, 40, 42720, 46200, 50400, 24, 27000, 28110, 48600, 38, 60300, 62100, 46200, 40, 0, 510, 45000, 62, 20160, 20760, 45000, 78, 25200, 27000, 45000, 38, 76020, 76800, 45000, 62, 22710, 24960, 43200, 38, 65700, 67920, 43200, 40, 75150, 75780, 42600, 32, 75780, 76020, 42600, 62, 41460, 42720, 39600, 46, 22470, 22710, 36000, 60, 24960, 25200, 36000, 38, 28110, 28530, 36000, 22, 85800, 86400, 36000, 62, 6000, 11820, 35700, 5, 72510, 73080, 30600, 32, 48600, 54300, 28800, 8, 81900, 85800, 27000, 62, 28530, 33300, 25200, 22, 33300, 38700, 25200, 46, 65700, 67184, 22500, 59, 67184, 67920, 22500, 3, 75000, 75150, 21600, 32, 25200, 25260, 19800, 21, 65700, 66330, 16200, 74, 57900, 60300, 14400, 40, 65700, 66330, 10800, 59, 77280, 78000, 9900, 62, 0, 7200, 7200, 67, 66900, 67920, 7200, 74, 73080, 75000, 7200, 32, 75000, 76800, 7200, 35, 76800, 77280, 7200, 62, 79200, 81900, 7200, 62, 78000, 79200, 6300, 62, 25260, 25920, 5400, 21, 12900, 16620, 0, 78, 16620, 16800, 0, 60, 25920, 29100, 0, 21, 52800, 54300, 0, 86, 64200, 65700, 0, 59, 9540, 11820, -6300, 17, 11820, 12900, -6300, 78, 54300, 58560, -11700, 74, 16800, 18300, -14400, 60, 21000, 22470, -14400, 60, 64200, 64680, -14400, 74, 65700, 66900, -14400, 74, 66900, 67920, -14400, 3, 81900, 85800, -14400, 67, 38700, 41460, -21600, 46, 41460, 42600, -21600, 86, 0, 1200, -25200, 67, 85800, 86400, -25200, 67, 51300, 52800, -28800, 86, 57300, 58560, -28800, 59, 72000, 73920, -32400, 3, 76800, 78720, -32400, 4, 61800, 64680, -36000, 59, 21000, 29100, -39600, 55, 17700, 18300, -39600, 36, 18300, 21000, -39600, 60, 29100, 30120, -39600, 42, 34500, 38700, -39600, 75, 42600, 46200, -39600, 86, 63300, 63600, -42000, 59, 67920, 72000, -43320, 3, 17400, 17700, -52200, 36, 73920, 76800, -54000, 4, 61800, 65700, -57600, 74, 65700, 67920, -57600, 73, 30120, 30900, -61200, 42, 58560, 58950, -65700, 59, 30900, 32700, -68400, 42, 38700, 39000, -68400, 27, 58560, 58950, -69300, 59, 56400, 57300, -72000, 48, 45300, 46200, -79200, 29, 46200, 51300, -79200, 86, 32700, 35100, -86400, 42, 6000, 9540, -87780, 17, 9540, 13500, -87780, 36, 39000, 42600, -88200, 27, 42600, 45300, -88200, 29, 51300, 53700, -88200, 48, 58560, 60300, -88500, 59, 0, 6000, -91800, 17, 76800, 78720, -91800, 12, 78720, 85800, -91800, 4, 85800, 86400, -91800, 17, 35100, 36900, -95400, 42, 16920, 17400, -98100, 36, 17400, 22020, -98100, 47, 72000, 76800, -100800, 12, 36900, 38100, -105000, 42, 45300, 53700, -106200, 42, 53700, 56400, -106200, 48, 56400, 57600, -106200, 72, 16500, 16920, -108000, 36, 60300, 63360, -108000, 59, 63360, 64200, -108000, 77, 38100, 39000, -112200, 42, 22020, 26520, -118800, 20, 44100, 45300, -118800, 42, 39000, 44100, -126000, 42, 12600, 13500, -129600, 37, 30120, 33720, -132300, 69, 15360, 16500, -133200, 36, 64200, 69000, -133200, 77, 76800, 82800, -133200, 66, 82800, 84000, -133200, 71, 10800, 12600, -142500, 37, 33720, 39600, -143100, 1, 0, 6000, -144000, 71, 6000, 10800, -144000, 37, 13920, 15360, -144000, 36, 84000, 86400, -144000, 71, 51000, 53700, -151200, 15, 56400, 57600, -151200, 50, 57600, 59115, -151200, 72, 17400, 18000, -154800, 9, 18000, 23700, -154800, 23, 28800, 30120, -154800, 68, 12300, 13920, -158400, 36, 59115, 64200, -163800, 72, 64200, 69000, -163800, 25, 69000, 73200, -163800, 77, 73200, 76800, -163800, 54, 10800, 12300, -165600, 36, 16200, 17400, -167400, 9, 55200, 56400, -172800, 50, 0, 8400, -173400, 64, 9600, 10800, -176400, 36, 14700, 15360, -176400, 41, 15360, 16200, -176400, 9, 76800, 79200, -180000, 39, 21600, 28800, -182700, 68, 28800, 29400, -182700, 85, 8700, 9600, -183600, 36, 13800, 14700, -183600, 41, 0, 6600, -185400, 64, 21600, 22200, -189000, 13, 29400, 30420, -190800, 85, 12600, 13800, -191400, 41, 13800, 14400, -191400, 33, 0, 5700, -192600, 64, 7800, 8700, -194400, 36, 16200, 18000, -194400, 65, 54180, 55200, -194400, 50, 30420, 31800, -196200, 85, 22200, 23400, -198000, 13, 42600, 46200, -198000, 15, 51000, 54180, -198000, 50, 54180, 55200, -198000, 57, 14400, 15600, -203400, 33, 31800, 39600, -203400, 85, 39600, 40500, -203400, 15, 63000, 64800, -205200, 6, 64800, 73200, -205200, 79, 79200, 84000, -205200, 39, 11520, 12600, -207000, 41, 18000, 19800, -207000, 65, 23400, 24600, -208800, 13, 0, 4800, -210600, 64, 4800, 7800, -210600, 36, 84000, 86400, -210600, 64, 15600, 16500, -212400, 33, 55200, 59115, -216000, 57, 73200, 76800, -216000, 44, 19800, 21600, -219600, 65, 54600, 55200, -219600, 19, 59115, 59700, -219600, 6, 53700, 54600, -228900, 19, 59700, 60300, -228900, 6, 21600, 24600, -230400, 65, 24600, 32520, -230400, 13, 40500, 42600, -230400, 15, 42600, 46200, -230400, 28, 46200, 52320, -230400, 15, 48600, 49200, -234000, 19, 60300, 60600, -234000, 6, 7800, 11520, -243000, 41, 11520, 16500, -243000, 70, 53100, 53700, -243000, 19, 60600, 63000, -243000, 6, 63000, 64800, -243000, 61, 79200, 84000, -243000, 82, 16500, 23700, -252000, 33, 49200, 53100, -252000, 19, 53100, 61200, -252000, 80, 0, 4800, -270000, 82, 12600, 16500, -270000, 43, 23700, 32520, -270000, 87, 32520, 40500, -270000, 13, 40500, 49200, -270000, 56, 64800, 76800, -270000, 61, 76800, 84000, -270000, 44, 84000, 86400, -270000, 82, 2700, 4800, -273600, 82, 0, 12600, -297000, 43, 27600, 49200, -297000, 18, 49200, 64800, -297000, 2, 12600, 27600, -306000, 53, 0, 86400, -324000, 58] 136 | }; 137 | 138 | /* Return the constellation name corresponding to a given mean equatorial 139 | position P. EPOCH is the precessional equinox and ecliptic date 140 | of P. */ 141 | $ns.constellation.calc = function (pp, epoch) { 142 | var i, k; // int 143 | var ra, dec, d; // double 144 | var p = []; // double 145 | 146 | for (i = 0; i < 3; i++) { 147 | p[i] = pp[i]; 148 | } 149 | 150 | /* Precess from given epoch to J2000. */ 151 | $moshier.precess.calc (p, epoch, 1); 152 | /* Precess from J2000 to Besselian epoch 1875.0. */ 153 | $moshier.precess.calc (p, {julian: 2405889.25855}, -1); 154 | d = p[0] * p[0] + p[1] * p[1] + p[2] * p[2]; 155 | d = Math.sqrt (d); 156 | ra = Math.atan2 (p[1], p[0]) * ($const.RTD * 3600. / 15.); 157 | if (ra < 0.0) { 158 | ra += 86400.0; 159 | } 160 | dec = Math.asin (p[2] / d) * ($const.RTD * 3600.); 161 | 162 | /* FIND CONSTELLATION SUCH THAT THE DECLINATION ENTERED IS HIGHER THAN 163 | THE LOWER BOUNDARY OF THE CONSTELLATION WHEN THE UPPER AND LOWER 164 | RIGHT ASCENSIONS FOR THE CONSTELLATION BOUND THE ENTERED RIGHT 165 | ASCENSION 166 | */ 167 | for (i = 0; i < this.bndries.length / 4; i++) { 168 | k = i << 2; 169 | if (ra >= this.bndries[k] && ra < this.bndries[k+1] && dec > this.bndries[k+2]) { 170 | k = this.bndries [k+3]; 171 | return k; 172 | } 173 | } 174 | return -1; 175 | }; -------------------------------------------------------------------------------- /astronomy/moshier/plan404/mercury.js: -------------------------------------------------------------------------------- 1 | $ns.mercury = { 2 | maxargs: 9, 3 | max_harmonic: [11, 14, 10, 11, 4, 5, 2, 0, 0], 4 | max_power_of_t: 6, 5 | distance: 3.8709830979999998e-01, 6 | timescale: 3652500.0, 7 | trunclvl: 1.0, 8 | lon_tbl: [35.85255, -163.26379, 53810162857.56026, 908082.18475, 0.05214, -0.07712, 1.07258, 0.04008, 0.49259, 0.00230, 0.02324, 0.05869, 0.24516, 0.22898, -0.06037, 0.13023, 0.00331, -0.03576, 0.06464, 0.00089, 0.03103, 0.05078, -0.01133, 0.01520, 0.14654, 0.07538, 0.25112, -0.24473, -0.17928, -0.53366, -0.06367, 0.20458, -0.42985, 0.14848, -0.35317, -0.61364, 0.00325, -0.08617, -0.23180, 0.08576, 0.22995, 0.43569, 1.92114, 2.89319, -5.55637, 4.70329, -4.91411, -5.45521, 0.02607, 0.04468, -0.05439, 0.13476, -0.07329, -0.00985, -0.00278, 0.05377, 0.07474, -0.09658, 0.29818, 0.20422, -0.29074, 0.44962, -0.15411, -0.04287, 0.29907, -1.02948, 3.62183, 0.84869, -0.08157, 0.02754, -0.03610, -0.12909, 0.09195, -0.04424, -0.08845, 0.09347, -0.27140, 0.08185, 0.24783, 0.19543, -0.25154, 0.41371, -0.00046, 0.01524, 0.04127, 0.06663, 0.43023, 0.11790, 0.04427, 0.05329, 0.00411, -0.71074, -0.07111, -0.09824, 0.01264, -0.02075, -0.00068, -0.01678, 0.01186, 0.00181, 0.00302, -0.21963, -0.06412, -0.10155, -0.36856, 0.20240, 0.32282, 0.65133, -0.07178, -0.01876, 0.13399, -0.39522, 1.28413, 0.33790, 0.05040, -0.01679, -0.00794, 0.01117, 0.02630, 0.00575, -0.07113, -0.11414, 0.16422, -0.23060, 0.35198, 0.05409, 1.11486, -0.35833, 0.87313, 1.66304, -1.28434, 0.72067, 0.01400, 0.00971, 0.21044, -0.87385, 3.20820, 0.67957, -0.01716, 0.00111, -0.13776, -0.02650, -0.06778, 0.00908, 0.00616, -0.04520, -0.31625, -0.61913, 0.36184, 0.09373, 0.00984, -0.03292, 0.01944, 0.00530, 0.00243, -0.00123, 0.01589, 0.02223, -0.02992, -0.01086, 4356.04809, -5859.86328, 2918.27323, -4796.67315, 510.24783, -1220.02233, 127.48927, 250.10654, 3250.43013, -904.27614, -5667.40042, -22634.00922, -82471.79425, 18615.92342, 0.01941, 0.00372, 0.01830, -0.00652, -0.02548, -0.01157, 0.00635, 0.02343, -0.00980, 0.00961, 0.12137, 0.10068, 0.16676, -0.07257, -0.07267, -0.13761, 0.25305, -0.28112, -0.07974, 0.07866, -0.41726, 0.49991, -1.55187, -1.14150, 1.54754, -2.35141, -0.00862, 0.00808, 0.00218, -0.03726, 0.06914, -0.08986, -0.00501, 2.09577, -0.01409, -0.01842, 0.04138, 0.05961, -0.12276, -0.04929, -0.03963, -0.06080, -0.27697, -0.09329, -0.01011, 0.00295, -0.01374, 0.01328, -0.00171, 0.25815, 0.01446, 0.00782, 0.17909, -0.04683, 0.03765, -0.04990, 0.00036, 0.00528, 0.05508, -0.01369, -0.11751, -0.10624, -0.14448, 0.10522, -0.00884, 0.43006, 0.01162, 0.01659, -0.00076, 0.10143, 0.55779, 0.05510, 0.12350, -0.34025, 0.01320, 0.92985, -0.00026, -0.03426, 0.01305, 0.00041, 0.13187, -0.11903, 0.00058, 0.09877, -33.10230, -41.96782, -268.28908, 174.29259, 731.20089, 1508.07639, 5223.99114, -3008.08849, -3909.34957, -9646.69156, 0.02988, 0.03182, 0.07149, 0.04513, -0.02356, -0.01641, -0.03188, -0.03711, 0.15084, -0.22436, 0.61987, 0.25706, 0.02425, 0.01200, -0.05543, -0.14435, -0.53398, 0.10997, 0.00465, -0.01893, 0.01260, -0.01314, 0.00650, -0.05499, -0.06804, 0.01608, 0.02134, 0.04160, 0.00636, 0.01293, -0.03470, -0.02697, -0.11323, 0.02409, -0.02618, 0.00827, 0.01879, 0.16838, 0.08978, 0.01934, -0.23564, 0.05565, 0.03686, 0.02644, -0.02471, 0.00558, -140.22669, -120.40692, -501.88143, 434.05868, 1044.54998, 1162.72084, 1527.78437, -882.37371, -0.00768, 0.02213, -0.04090, 0.16718, -0.05923, -0.12595, 0.01154, -0.00025, -0.00776, -0.01653, -0.01213, -0.02773, 0.00344, 0.02180, -0.02558, -0.05682, -0.00490, 0.01050, 38.75496, -78.17502, -189.90700, -136.33371, -249.94062, 319.76423, 205.73478, 272.64549, -0.01132, -0.01071, -0.04607, -0.00390, 0.02903, -0.02070, 0.01326, -0.00901, 35.38435, 7.45358, 31.08987, -70.52685, -92.13879, -51.58876, -51.80016, 48.98102, -0.00124, -0.01159, 0.47335, 13.71886, 23.71637, 5.55804, 10.06850, -25.65292, -11.85300, -10.20802, -4.72861, 1.27151, -0.47322, 7.46754, 6.99528, 1.79089, 2.05336, -2.90866, -1.97528, 0.72236, -0.25084, 1.90269, 0.72127, 0.41354, -0.30286, -0.53125, -0.50883, -0.01200, -0.08301, 0.18083, -0.04286, -0.10963, -0.04544, -0.01645, -0.00013, -0.00986], 9 | lat_tbl: [68.33369, 422.77623, -2057.26405, -2522.29068, -0.00030, -0.00009, 0.02400, -0.06471, 0.02074, -0.00904, 0.00044, 0.00261, -0.00174, -0.00088, -0.00027, 0.00003, 0.00005, -0.00004, -0.00036, 0.00200, 0.01432, 0.01199, 0.00006, -0.00004, 0.00236, 0.00803, 0.01235, 0.00406, -0.03253, 0.00179, -0.00243, 0.00132, -0.00352, 0.00011, -0.00146, -0.01154, 0.00824, -0.01195, -0.01829, -0.00465, 0.12540, 0.09997, 0.00400, 0.00288, -0.02848, 0.01094, -0.02273, -0.07051, 0.01305, 0.01078, -0.00119, 0.00136, -0.00107, -0.00066, 0.00097, -0.00315, 0.00120, 0.00430, -0.00710, -0.00157, 0.06052, -0.04777, 0.00192, -0.00229, -0.02077, 0.00647, 0.06907, 0.07644, -0.00717, 0.00451, 0.00052, -0.00262, 0.00345, 0.00039, -0.00674, 0.00346, -0.02880, 0.00807, 0.00054, 0.00206, -0.01745, 0.00517, -0.00044, 0.00049, 0.01749, 0.01230, 0.01703, 0.01563, 0.00934, 0.02372, 0.01610, -0.01136, 0.00186, -0.00503, 0.00082, -0.00673, 0.00170, -0.00539, 0.00042, 0.00037, 0.00415, -0.00430, 0.00258, -0.00914, -0.01761, -0.00251, 0.15909, 0.13276, 0.02436, -0.00791, 0.00491, 0.03890, -0.02982, 0.05645, -0.00003, 0.00427, -0.00363, 0.00221, 0.00077, 0.00130, 0.00131, -0.00071, 0.00796, 0.00453, 0.01186, 0.01631, 0.12949, -0.02546, 0.03613, 0.32854, -0.43001, 0.01417, 0.00034, 0.00095, -0.03268, 0.04034, 0.11407, 0.15049, -0.00079, -0.00052, -0.04009, 0.00988, -0.00259, -0.00085, 0.00221, -0.00133, 0.00003, -0.01733, 0.01055, 0.01976, 0.00222, 0.00085, 0.00089, 0.00087, 0.00014, 0.00001, 0.00145, 0.00802, 0.00122, 0.00068, 947.79367, -1654.39690, 542.00864, -1281.09901, 90.02068, -318.36115, -87.67090, 92.91960, 376.98232, -419.10705, 5094.60412, 2476.97098, -18160.57888, 16010.48165, 0.00621, -0.00128, 0.00186, -0.00153, -0.00790, 0.00011, -0.00032, 0.00165, -0.00277, 0.00539, 0.00552, 0.00682, 0.01086, -0.00978, -0.02292, -0.01300, 0.02940, -0.04427, -0.02051, 0.04860, -0.05020, 0.29089, -0.50763, -0.04900, 0.11177, -0.41357, -0.00222, 0.00504, -0.00006, -0.00459, -0.00175, -0.02691, 0.05921, 0.18938, -0.00181, -0.00154, 0.00322, 0.00586, -0.01098, -0.00520, -0.00861, -0.01342, -0.02694, -0.00706, -0.00103, 0.00012, -0.00284, 0.00797, 0.00743, 0.02523, 0.00872, 0.00096, 0.03155, -0.01644, 0.00414, -0.00583, 0.00029, 0.00066, 0.00935, -0.00619, -0.02498, -0.01600, -0.03545, 0.07623, 0.01649, 0.06498, 0.00148, 0.00209, 0.00621, 0.02014, 0.17407, -0.05022, -0.03485, -0.17012, 0.06164, 0.20059, -0.00804, -0.01475, 0.00296, -0.00068, 0.01880, -0.03797, 0.00608, 0.02270, 5.89651, -6.62562, -37.41057, -10.51542, -47.22373, 95.76862, 494.45951, -5.37252, -3991.04809, -2886.97750, 0.01232, 0.00487, 0.03163, 0.00561, -0.01847, -0.00207, -0.10138, 0.01430, -0.04269, -0.22338, 0.24955, -0.02066, 0.01119, -0.00186, 0.03416, 0.01805, -0.12498, 0.10385, -0.00210, -0.01011, 0.00346, -0.00682, -0.00683, -0.02227, -0.01649, 0.01259, 0.01392, 0.01174, 0.00440, 0.00351, -0.02871, -0.00375, -0.03170, 0.02246, -0.00833, 0.00596, 0.04081, 0.06666, 0.05400, -0.02387, -0.07852, 0.05781, 0.01881, 0.00324, -0.00868, 0.00606, -6.52157, -19.74446, -72.46009, 43.12366, 321.78233, 215.45201, 452.61804, -1025.05619, 0.00119, 0.01169, 0.02239, 0.09003, -0.05329, -0.03974, 0.00688, -0.00421, -0.00676, -0.00515, -0.01171, -0.00952, 0.01337, 0.01270, -0.02791, -0.02184, 0.00058, 0.00679, 8.42102, -11.87757, -49.07247, -25.34584, -43.54829, 161.26509, 261.70993, 56.25777, 0.00568, 0.00871, -0.02656, 0.01582, 0.00875, -0.02114, 0.00464, -0.01075, 9.08966, 1.37810, 3.44548, -27.44651, -59.62749, -0.73611, -0.77613, 65.72607, -0.00664, -0.00723, 1.04214, 4.78920, 11.67397, -1.84524, -4.16685, -19.14211, -16.14483, 3.02496, -1.98140, 1.16261, 1.81526, 4.21224, 5.59020, -2.55741, -1.54151, -3.85817, -1.08723, 1.23372, 1.12378, 1.51554, 0.88937, -0.57631, -0.50549, -0.25617, -0.37618, 0.42163, 0.18902, 0.19575, -0.15402, -0.04062, -0.04017, 0.05717, -0.01665, -0.00199], 10 | rad_tbl: [-8.30490, -11.68232, 86.54880, 4361.05018, 0.00002, -0.00001, -0.01102, 0.00410, 0.00007, -0.00276, 0.00117, 0.00082, 0.00049, 0.00007, 0.00003, -0.00001, 0.00012, 0.00005, -0.00186, -0.00534, -0.03301, 0.01808, 0.00008, 0.00005, -0.00394, 0.00202, 0.02362, -0.00359, 0.00638, -0.06767, 0.00422, -0.00493, 0.00660, 0.00513, -0.00417, 0.00708, 0.05849, -0.00213, -0.07647, -0.16162, -0.30551, 0.13856, -0.02789, 0.01811, -0.04155, -0.06229, 0.05729, -0.03694, -0.03087, 0.01610, -0.00297, -0.00167, 0.00041, -0.00157, -0.00115, 0.00058, 0.00796, 0.00436, -0.01393, 0.02921, -0.05902, -0.02363, 0.00459, -0.01512, 0.10038, 0.02964, -0.08369, 0.34570, -0.00749, -0.02653, 0.01361, -0.00326, 0.00406, 0.00952, -0.00594, -0.00829, -0.02763, -0.09933, -0.04143, 0.05152, -0.08436, -0.05294, -0.00329, -0.00016, -0.04340, 0.02566, -0.03027, 0.10904, 0.03665, -0.03070, 0.23525, 0.00182, 0.03092, -0.02212, 0.01255, 0.00777, -0.01025, 0.00042, -0.00065, 0.00440, 0.08688, 0.00136, 0.05700, -0.03616, -0.11272, -0.20838, -0.37048, 0.18314, 0.00717, -0.02911, 0.15848, 0.05266, -0.13451, 0.51639, 0.00688, 0.02029, 0.00596, 0.00423, -0.00253, 0.01196, 0.05264, -0.03301, 0.10669, 0.07558, -0.02461, 0.16282, -0.18481, -0.57118, 0.85303, -0.44876, 0.37090, 0.65915, -0.00458, 0.00660, 0.41186, 0.09829, -0.31999, 1.51149, -0.00052, -0.00809, 0.01384, -0.07114, -0.00435, -0.03237, 0.02162, 0.00294, 0.29742, -0.15430, -0.04508, 0.17436, 0.01577, 0.00485, -0.00258, 0.00946, 0.00061, 0.00119, 0.01095, -0.00788, 0.00530, -0.01478, 2885.06380, 2152.76256, 2361.91098, 1442.28586, 602.45147, 251.18991, -121.68155, 71.20167, 404.94753, 1607.37580, 11211.04090, -2905.37340, -9066.27933, -40747.62807, -0.00189, 0.00957, 0.00332, 0.00907, 0.00574, -0.01255, -0.01134, 0.00291, -0.00666, -0.00615, -0.04947, 0.06182, 0.03965, 0.08091, 0.06846, -0.03612, 0.13966, 0.12543, -0.05494, -0.05043, -0.24454, -0.20507, 0.56201, -0.75997, 1.15728, 0.76203, -0.00559, -0.00536, 0.01872, 0.00104, 0.03044, 0.02504, -1.07241, -0.00288, 0.00950, -0.00760, -0.03211, 0.02261, 0.02678, -0.06868, 0.03008, -0.02062, 0.04997, -0.15164, -0.00176, -0.00580, -0.00730, -0.00676, -0.13906, -0.00089, -0.00362, 0.00817, 0.02021, 0.07719, 0.02788, 0.02061, -0.00274, 0.00016, 0.00566, 0.02293, 0.04691, -0.05005, -0.05095, -0.06225, -0.19770, -0.00456, -0.00848, 0.00595, -0.04506, -0.00172, -0.01960, 0.22971, 0.14459, 0.04362, -0.40199, 0.00386, 0.01442, -0.00088, -0.00020, 0.00544, 0.04768, 0.05222, -0.04069, -0.00003, 15.71084, -12.28846, -66.23443, -109.83758, -586.31996, 311.09606, 1070.75040, 2094.34080, 3839.04103, -1797.34193, -0.01216, 0.01244, -0.01666, 0.02627, 0.00687, -0.01291, 0.00939, -0.01905, 0.09401, 0.05027, -0.09398, 0.23942, -0.00379, 0.00834, 0.05632, -0.01907, -0.04654, -0.21243, 0.00255, 0.00179, 0.00540, 0.00497, 0.01427, 0.00243, -0.00697, -0.02792, -0.01524, 0.00810, -0.00461, 0.00238, 0.00899, -0.01515, -0.01011, -0.04390, -0.00447, -0.00992, -0.06110, 0.00975, -0.00261, 0.03415, -0.02336, -0.08776, -0.00883, 0.01346, -0.00229, -0.00895, 42.18049, -48.21316, -148.61588, -171.57236, -414.27195, 343.09118, 394.59044, 511.79914, -0.00911, -0.00220, -0.06315, -0.00988, 0.04357, -0.02389, 0.00004, 0.00232, 0.00581, -0.00317, 0.00948, -0.00497, -0.00734, 0.00300, 0.01883, -0.01055, -0.00365, -0.00126, 24.18074, 12.28004, 43.18187, -58.69806, -102.40566, -79.48349, -74.81060, 89.71332, 0.00241, -0.00135, -0.00136, -0.01617, 0.00818, 0.00873, 0.00368, 0.00383, -2.25893, 10.18542, 20.73104, 9.07389, 13.73458, -29.10491, -20.62071, -10.63404, 0.00382, -0.00143, -3.77385, 0.12725, -1.30842, 6.75795, 7.94463, 1.79092, 1.24458, -4.73211, -0.36978, -1.25710, -2.06373, 0.06194, -0.00509, 2.08851, 1.07491, 0.04112, -0.28582, -0.51413, -0.53312, 0.11936, 0.04447, 0.23945, 0.12450, -0.11821, -0.06100, -0.12924, -0.05193, 0.02219, 0.01977, -0.02933, -0.00771, -0.01077, 0.00109, -0.00273], 11 | arg_tbl: [0, 3, 3, 1, 1, -10, 3, 11, 4, 0, 2, 2, 5, -5, 6, 2, 3, 5, 1, -14, 2, 2, 3, 1, 3, 1, 1, -5, 2, 4, 3, 0, 1, 1, 6, 0, 1, 2, 6, 0, 3, 2, 1, -7, 2, 3, 3, 0, 1, 1, 5, 2, 2, 1, 1, -4, 3, 2, 1, 2, 5, 2, 2, 2, 1, -5, 2, 2, 1, 3, 5, 0, 2, 4, 1, -10, 2, 1, 2, 3, 1, -8, 2, 0, 2, 1, 1, -3, 2, 2, 2, 1, 1, -2, 2, 2, 1, 1, 3, 0, 2, 3, 1, -7, 2, 1, 2, 1, 1, -3, 3, 0, 1, 1, 2, 0, 2, 2, 1, -4, 2, 1, 2, 4, 1, -9, 2, 0, 1, 2, 3, 0, 2, 1, 1, -2, 3, 0, 2, 1, 1, -4, 2, 0, 2, 1, 1, -1, 2, 0, 2, 3, 1, -6, 2, 0, 1, 3, 3, 0, 2, 2, 1, -7, 2, 0, 2, 1, 1, -2, 4, 0, 2, 1, 1, -1, 3, 0, 1, 2, 2, 2, 2, 2, 1, -3, 2, 2, 2, 4, 1, -8, 2, 0, 2, 3, 1, -10, 2, 0, 2, 1, 1, -4, 5, 0, 2, 1, 1, -3, 5, 2, 2, 1, 1, -5, 2, 2, 2, 1, 1, -5, 6, 0, 2, 1, 1, -2, 5, 1, 3, 1, 1, -4, 5, 5, 6, 0, 1, 4, 3, 0, 2, 1, 1, -3, 6, 1, 2, 1, 1, -1, 5, 0, 2, 1, 1, -2, 6, 0, 2, 1, 1, -1, 6, 0, 2, 1, 1, -2, 7, 0, 2, 1, 1, -1, 7, 0, 3, 4, 1, -14, 2, 2, 3, 0, 3, 1, 1, 2, 5, -5, 6, 0, 1, 1, 1, 6, 3, 2, 1, -10, 3, 11, 4, 0, 3, 1, 1, -2, 5, 5, 6, 0, 3, 6, 1, -14, 2, 2, 3, 0, 2, 1, 1, 1, 6, 0, 2, 1, 1, 2, 6, 0, 2, 1, 1, 1, 5, 1, 2, 2, 1, -4, 3, 1, 2, 1, 1, 2, 5, 0, 2, 3, 1, -5, 2, 2, 2, 1, 1, 3, 5, 0, 2, 5, 1, -10, 2, 0, 1, 3, 2, 0, 2, 2, 1, -2, 2, 0, 2, 1, 1, 1, 3, 0, 2, 4, 1, -7, 2, 0, 2, 2, 1, -3, 3, 0, 2, 1, 1, 1, 2, 0, 2, 3, 1, -4, 2, 0, 2, 5, 1, -9, 2, 0, 2, 1, 1, 2, 3, 0, 2, 2, 1, -2, 3, 0, 1, 4, 2, 0, 2, 2, 1, -1, 2, 0, 2, 4, 1, -6, 2, 0, 2, 2, 1, -2, 4, 0, 2, 2, 1, -1, 3, 0, 2, 1, 1, 2, 2, 1, 2, 3, 1, -3, 2, 0, 2, 5, 1, -8, 2, 0, 2, 2, 1, -3, 5, 0, 1, 5, 2, 1, 2, 2, 1, -2, 5, 0, 2, 1, 1, 4, 3, 0, 2, 2, 1, -3, 6, 0, 2, 2, 1, -1, 5, 0, 2, 2, 1, -2, 6, 0, 1, 2, 1, 4, 2, 2, 1, 1, 5, 0, 2, 3, 1, -4, 3, 0, 2, 2, 1, 2, 5, 0, 2, 4, 1, -5, 2, 2, 2, 1, 1, 3, 2, 0, 2, 3, 1, -2, 2, 1, 2, 3, 1, -3, 3, 0, 2, 2, 1, 1, 2, 0, 2, 4, 1, -4, 2, 0, 2, 3, 1, -2, 3, 0, 2, 3, 1, -1, 2, 0, 2, 3, 1, -1, 3, 0, 2, 2, 1, 2, 2, 0, 2, 4, 1, -3, 2, 0, 2, 3, 1, -3, 5, 0, 2, 1, 1, 5, 2, 1, 2, 3, 1, -2, 5, 0, 2, 3, 1, -1, 5, 0, 2, 3, 1, -2, 6, 0, 1, 3, 1, 3, 2, 4, 1, -4, 3, 0, 2, 5, 1, -5, 2, 0, 2, 4, 1, -2, 2, 0, 2, 5, 1, -4, 2, 0, 2, 4, 1, -2, 3, 0, 2, 5, 1, -3, 2, 0, 2, 2, 1, 5, 2, 0, 2, 4, 1, -2, 5, 0, 2, 4, 1, -1, 5, 0, 1, 4, 1, 3, 2, 6, 1, -5, 2, 1, 2, 5, 1, -2, 2, 0, 2, 5, 1, -2, 5, 0, 1, 5, 1, 3, 2, 7, 1, -5, 2, 0, 1, 6, 1, 3, 1, 7, 1, 3, 1, 8, 1, 2, 1, 9, 1, 2, 1, 10, 1, 1, 1, 11, 1, 0, -1] 12 | }; 13 | -------------------------------------------------------------------------------- /astronomy/moshier/transit.js: -------------------------------------------------------------------------------- 1 | $ns.transit = { 2 | /* Earth radii per au */ 3 | DISFAC: 2.3454780e4, 4 | 5 | /* cosine of 90 degrees 50 minutes: */ 6 | COSSUN: -0.014543897651582657, 7 | /* cosine of 90 degrees 34 minutes: */ 8 | COSZEN: -9.8900378587411476e-3, 9 | 10 | /* Returned transit, rise, and set times in radians (2 pi = 1 day) */ 11 | r_trnsit: 0.0, 12 | r_rise: 0.0, 13 | r_set: 0.0, 14 | elevation_threshold: 0.0, 15 | semidiameter: 0.0, 16 | f_trnsit: 0, // int 17 | southern_hemisphere: 0, // int 18 | 19 | /* Julian dates of rise, transet and set times. */ 20 | t_rise: 0.0, 21 | t_trnsit: 0.0, 22 | elevation_trnsit: 0.0, 23 | t_set: 0.0, 24 | 25 | STEP_SCALE: 0.5 26 | }; 27 | 28 | /* Calculate time of transit 29 | * assuming RA and Dec change uniformly with time 30 | */ 31 | $ns.transit.calc = function (date, lha, dec, result) { 32 | var x, y, z, N, D; // double 33 | var lhay, cosdec, sindec, coslat, sinlat; // double 34 | 35 | result = result || {}; 36 | 37 | this.f_trnsit = 0; 38 | /* Initialize to no-event flag value. */ 39 | this.r_rise = -10.0; 40 | this.r_set = -10.0; 41 | /* observer's geodetic latitude, in radians */ 42 | x = $const.glat * $const.DTR; 43 | coslat = Math.cos(x); 44 | sinlat = Math.sin(x); 45 | 46 | cosdec = Math.cos(dec); 47 | sindec = Math.sin(dec); 48 | 49 | if (sinlat < 0) { 50 | this.southern_hemisphere = 1; 51 | } else { 52 | this.southern_hemisphere = 0; 53 | } 54 | 55 | /* Refer to same start of date as iter_trnsit, 56 | so r_trnsit means the same thing in both programs. */ 57 | x = Math.floor(date.universal - 0.5) + 0.5; // UT 58 | x = (date.universal - x) * $const.TPI; // UT 59 | /* adjust local hour angle */ 60 | y = lha; 61 | /* printf ("%.7f,", lha); */ 62 | while( y < -Math.PI ) { 63 | y += $const.TPI; 64 | } 65 | while( y > Math.PI ) { 66 | y -= $const.TPI; 67 | } 68 | lhay = y; 69 | y = y/( -$const.dradt/$const.TPI + 1.00273790934); 70 | this.r_trnsit = x - y; 71 | /* printf ("rt %.7f ", r_trnsit); */ 72 | /* Ordinarily never print here. */ 73 | result.approxLocalMeridian = $util.hms (this.r_trnsit); 74 | result.UTdate = this.r_trnsit/$const.TPI; 75 | 76 | if( !((coslat == 0.0) || (cosdec == 0.0)) ) { 77 | /* The time at which the upper limb of the body meets the 78 | * horizon depends on the body's angular diameter. 79 | */ 80 | switch( $const.body.key ) { 81 | /* Sun */ 82 | case 'sun': 83 | N = this.COSSUN; 84 | this.semidiameter = 0.2666666666666667; 85 | this.elevation_threshold = -0.8333333333333333; 86 | break; 87 | 88 | /* Moon, elevation = -34' - semidiameter + parallax 89 | * semidiameter = 0.272453 * parallax + 0.0799" 90 | */ 91 | case 'moon': 92 | N = 1.0/(this.DISFAC*$const.body.position.polar [2]); 93 | D = Math.asin( N ); /* the parallax */ 94 | this.semidiameter = 0.2725076*D + 3.874e-7; 95 | N = -9.890199094634534e-3 - this.semidiameter + D; 96 | this.semidiameter *= $const.RTD; 97 | this.elevation_threshold = -34.0/60.0 - this.semidiameter; 98 | N = Math.sin(N); 99 | break; 100 | 101 | /* Other object */ 102 | default: 103 | N = this.COSZEN; 104 | this.semidiameter = 0.0; 105 | this.elevation_threshold = -0.5666666666666666; 106 | break; 107 | } 108 | y = (N - sinlat*sindec)/(coslat*cosdec); 109 | 110 | if( (y < 1.0) && (y > -1.0) ) 111 | { 112 | this.f_trnsit = 1; 113 | /* Derivative of y with respect to declination 114 | * times rate of change of declination: 115 | */ 116 | z = -$const.ddecdt*(sinlat + this.COSZEN*sindec); 117 | z /= $const.TPI*coslat*cosdec*cosdec; 118 | /* Derivative of acos(y): */ 119 | z /= Math.sqrt( 1.0 - y*y); 120 | y = Math.acos(y); 121 | D = -$const.dradt/$const.TPI + 1.00273790934; 122 | this.r_rise = x - (lhay + y)*(1.0 + z)/D; 123 | this.r_set = x - (lhay - y)*(1.0 - z)/D; 124 | /* Ordinarily never print here. */ 125 | 126 | result.dApproxRiseUT = this.r_rise; 127 | result.dApproxSetUT = this.r_set; 128 | result.approxRiseUT = $util.hms (this.r_rise); 129 | result.approxSetUT = $util.hms (this.r_set); 130 | } 131 | } 132 | return result; 133 | }; 134 | 135 | /* Compute estimate of lunar rise and set times for iterative solution. */ 136 | $ns.transit.iterator = function (julian, callback) { 137 | var date = { 138 | julian: julian 139 | }; 140 | 141 | $moshier.toGregorian (date); 142 | $moshier.julian.calc (date); 143 | $moshier.delta.calc (date); 144 | 145 | $moshier.kepler (date, $moshier.body.earth); 146 | 147 | callback (); 148 | }; 149 | 150 | /* Iterative computation of rise, transit, and set times. */ 151 | $ns.transit.iterateTransit = function (callback, result) { 152 | //var JDsave, TDTsave, UTsave; // double 153 | var date, date_trnsit, t0, t1; // double 154 | var rise1, set1, trnsit1, loopctr, retry; // double 155 | var isPrtrnsit = false; 156 | 157 | result = result || {}; 158 | 159 | loopctr = 0; 160 | //JDsave = JD; 161 | //TDTsave = TDT; 162 | //UTsave = UT; 163 | retry = 0; 164 | /* Start iteration at time given by the user. */ 165 | t1 = $moshier.body.earth.position.date.universal; // UT 166 | 167 | /* Find transit time. */ 168 | do { 169 | t0 = t1; 170 | date = Math.floor (t0 - 0.5) + 0.5; 171 | this.iterator (t0, callback); 172 | t1 = date + this.r_trnsit / $const.TPI; 173 | if (++loopctr > 10) { 174 | break; 175 | // goto no_trnsit; 176 | } 177 | } while (Math.abs (t1 - t0) > .0001); 178 | 179 | if (!(loopctr > 10)) { 180 | this.t_trnsit = t1; 181 | this.elevation_trnsit = $moshier.altaz.elevation; 182 | trnsit1 = this.r_trnsit; 183 | set1 = this.r_set; 184 | if (this.f_trnsit == 0) { 185 | /* Rise or set time not found. Apply a search technique to 186 | check near inferior transit if object is above horizon now. */ 187 | this.t_rise = -1.0; 188 | this.t_set = -1.0; 189 | if ($moshier.altaz.elevation > this.elevation_threshold) { 190 | this.noRiseSet (this.t_trnsit, callback); 191 | } 192 | // goto prtrnsit; 193 | } else { 194 | /* Set current date to be that of the transit just found. */ 195 | date_trnsit = date; 196 | t1 = date + this.r_rise / $const.TPI; 197 | /* Choose rising no later than transit. */ 198 | if (t1 >= this.t_trnsit) { 199 | date -= 1.0; 200 | t1 = date + this.r_rise / $const.TPI; 201 | } 202 | loopctr = 0; 203 | do { 204 | t0 = t1; 205 | this.iterator (t0, callback); 206 | /* Skip out if no event found. */ 207 | if (this.f_trnsit == 0) { 208 | /* Rise or set time not found. Apply search technique. */ 209 | this.t_rise = -1.0; 210 | this.t_set = -1.0; 211 | this.noRiseSet (this.t_trnsit, callback); 212 | isPrtrnsit = true; 213 | // goto prtrnsit; 214 | } else { 215 | if (++loopctr > 10) { 216 | // Rise time did not converge 217 | this.f_trnsit = 0; 218 | isPrtrnsit = true; 219 | // goto prtrnsit; 220 | } else { 221 | t1 = date + this.r_rise / $const.TPI; 222 | if (t1 > this.t_trnsit) { 223 | date -= 1; 224 | t1 = date + this.r_rise / $const.TPI; 225 | } 226 | } 227 | } 228 | } while (Math.abs (t1 - t0) > .0001); 229 | 230 | if (!isPrtrnsit) { 231 | isPrtrnsit = false; 232 | rise1 = this.r_rise; 233 | this.t_rise = t1; 234 | 235 | /* Set current date to be that of the transit. */ 236 | date = date_trnsit; 237 | this.r_set = set1; 238 | /* Choose setting no earlier than transit. */ 239 | t1 = date + this.r_set / $const.TPI; 240 | if (t1 <= this.t_trnsit) { 241 | date += 1.0; 242 | t1 = date + this.r_set / $const.TPI; 243 | } 244 | loopctr = 0; 245 | do { 246 | t0 = t1; 247 | this.iterator (t0, callback); 248 | if (this.f_trnsit == 0) { 249 | /* Rise or set time not found. Apply search technique. */ 250 | this.t_rise = -1.0; 251 | this.t_set = -1.0; 252 | this.noRiseSet (this.t_trnsit, callback); 253 | isPrtrnsit = true; 254 | //goto prtrnsit; 255 | } else { 256 | if (++loopctr > 10) { 257 | // Set time did not converge 258 | this.f_trnsit = 0; 259 | isPrtrnsit = true; 260 | //goto prtrnsit; 261 | } else { 262 | t1 = date + this.r_set / $const.TPI; 263 | if (t1 < this.t_trnsit) { 264 | date += 1.0; 265 | t1 = date + this.r_set / $const.TPI; 266 | } 267 | } 268 | } 269 | } while (fabs(t1 - t0) > .0001); 270 | 271 | if (!isPrtrnsit) { 272 | this.t_set = t1; 273 | this.r_trnsit = trnsit1; 274 | this.r_rise = rise1; 275 | } 276 | } 277 | } 278 | // prtrnsit: 279 | result.localMeridianTransit = $moshier.julian.toGregorian ({julian: this.t_trnsit}); 280 | if (this.t_rise != -1.0) { 281 | result.riseDate = $moshier.julian.toGregorian ({julian: this.t_rise}); 282 | } 283 | if (this.t_set != -1.0) { 284 | result.setDate = $moshier.julian.toGregorian ({julian: this.t_set}); 285 | if (this.t_rise != -1.0) { 286 | t0 = this.t_set - this.t_rise; 287 | if ((t0 > 0.0) && (t0 < 1.0)) { 288 | result.visibleHaours = 24.0 * t0; 289 | } 290 | } 291 | } 292 | 293 | if ( 294 | (Math.abs($moshier.body.earth.position.date.julian - this.t_rise) > 0.5) && 295 | (Math.abs($moshier.body.earth.position.date.julian - this.t_trnsit) > 0.5) && 296 | (Math.abs($moshier.body.earth.position.date.julian - this.t_set) > 0.5) 297 | ) { 298 | // wrong event date 299 | result.wrongEventDate = true; 300 | } 301 | } 302 | // no_trnsit: 303 | //JD = JDsave; 304 | //TDT = TDTsave; 305 | //UT = UTsave; 306 | /* Reset to original input date entry. */ 307 | // update(); 308 | //prtflg = prtsave; 309 | this.f_trnsit = 1; 310 | return result; 311 | }; 312 | 313 | /* If the initial approximation fails to locate a rise or set time, 314 | this function steps between the transit time and the previous 315 | or next inferior transits to find an event more reliably. */ 316 | $ns.transit.noRiseSet = function (t0, callback) { 317 | var t_trnsit0 = this.t_trnsit; // double 318 | var el_trnsit0 = this.elevation_trnsit; // double 319 | var t, e; // double 320 | var t_above, el_above, t_below, el_below; // double 321 | 322 | /* Step time toward previous inferior transit to find 323 | whether a rise event was missed. The step size is a function 324 | of the azimuth and decreases near the transit time. */ 325 | t_above = t_trnsit0; 326 | el_above = el_trnsit0; 327 | t_below = -1.0; 328 | el_below = el_above; 329 | t = t_trnsit0 - 0.25; 330 | e = 1.0; 331 | while (e > 0.005) { 332 | this.iterator (t, callback); 333 | if ($moshier.altaz.elevation > this.elevation_threshold) { 334 | /* Object still above horizon. */ 335 | t_above = t; 336 | el_above = $moshier.altaz.elevation; 337 | } else { 338 | /* Object is below horizon. Rise event is bracketed. 339 | Proceed to interval halving search. */ 340 | t_below = t; 341 | el_below = $moshier.altaz.elevation; 342 | break; // goto search_rise; 343 | } 344 | /* Step time by an amount proportional to the azimuth deviation. */ 345 | e = azimuth/360.0; 346 | if (azimuth < 180.0) 347 | { 348 | if (this.southern_hemisphere == 0) { 349 | t -= this.STEP_SCALE * e; 350 | } else { 351 | t += this.STEP_SCALE * e; 352 | } 353 | } else { 354 | e = 1.0 - e; 355 | if (this.southern_hemisphere == 0) { 356 | t += this.STEP_SCALE * e; 357 | } else { 358 | t -= this.STEP_SCALE * e; 359 | } 360 | } 361 | } 362 | 363 | /* No rise event detected. */ 364 | if ($moshier.altaz.elevation > this.elevation_threshold) { 365 | /* printf ("Previous inferior transit is above horizon.\n"); */ 366 | this.t_rise = -1.0; 367 | // goto next_midnight; 368 | } else { 369 | /* Find missed rise time. */ 370 | // search_rise: 371 | this.t_rise = this.searchHalve (t_below, el_below, t_above, el_above, callback); 372 | this.f_trnsit = 1; 373 | } 374 | 375 | // next_midnight: 376 | /* Step forward in time toward the next inferior transit. */ 377 | t_above = t_trnsit0; 378 | el_above = el_trnsit0; 379 | t_below = -1.0; 380 | el_below = el_above; 381 | t = t_trnsit0 + 0.25; 382 | e = 1.0; 383 | while (e > 0.005) { 384 | this.iterator (t, callback); 385 | if ($moshier.altaz.elevation > this.elevation_threshold) { 386 | /* Object still above horizon. */ 387 | t_above = t; 388 | el_above = $moshier.altaz.elevation; 389 | } else { 390 | /* Object is below horizon. Event is bracketed. 391 | Proceed to interval halving search. */ 392 | t_below = t; 393 | el_below = $moshier.altaz.elevation; 394 | break; // goto search_set; 395 | } 396 | /* Step time by an amount proportional to the azimuth deviation. */ 397 | e = $moshier.altaz.azimuth/360.0; 398 | if ($moshier.altaz.azimuth < 180.0) { 399 | if (this.southern_hemisphere == 0) { 400 | t -= this.STEP_SCALE * e; 401 | } else { 402 | t += this.STEP_SCALE * e; /* Southern hemisphere observer. */ 403 | } 404 | } else { 405 | e = 1.0 - e; 406 | if (this.southern_hemisphere == 0) { 407 | t += this.STEP_SCALE * e; 408 | } else { 409 | t -= this.STEP_SCALE * e; 410 | } 411 | } 412 | } 413 | 414 | if ($moshier.altaz.elevation > this.elevation_threshold) { 415 | /* printf ("Next inferior transit is above horizon.\n"); */ 416 | this.t_set = -1.0; 417 | // return 0; 418 | } else { 419 | /* Find missed set time. */ 420 | // search_set: 421 | this.t_set = search_halve (t, elevation, this.t_trnsit, this.elevation_trnsit, callback); 422 | this.f_trnsit = 1; 423 | } 424 | }; 425 | 426 | /* Search rise or set time by simple interval halving 427 | after the event has been bracketed in time. */ 428 | $ns.transit.searchHalve = function (t1, y1, t2, y2, callback) { 429 | var e2, e1, em, tm, ym; // double 430 | 431 | e2 = y2 - this.elevation_threshold; 432 | e1 = y1 - this.elevation_threshold; 433 | tm = 0.5 * (t1 + t2); 434 | 435 | while( Math.abs(t2 - t1) > .00001 ) { 436 | /* Evaluate at middle of current interval. */ 437 | tm = 0.5 * (t1 + t2); 438 | this.iterator (tm, callback); 439 | ym = $moshier.altaz.elevation; 440 | em = ym - this.elevation_threshold; 441 | /* Replace the interval boundary whose error has the same sign as em. */ 442 | if( em * e2 > 0 ) { 443 | y2 = ym; 444 | t2 = tm; 445 | e2 = em; 446 | } else { 447 | y1 = ym; 448 | t1 = tm; 449 | e1 = em; 450 | } 451 | } 452 | return tm; 453 | }; -------------------------------------------------------------------------------- /astronomy/moshier/plan404/earth.js: -------------------------------------------------------------------------------- 1 | $ns.earth = { 2 | maxargs: 12, 3 | max_harmonic: [2, 11, 14, 19, 6, 10, 2, 2, 0, 1, 1, 4, 0, 0, 0, 0, 0, 0], 4 | max_power_of_t: 3, 5 | distance: 1.0001398729597080e+00, 6 | timescale: 3.6525000000000000e+06, 7 | trunclvl: 1.0000000000000000e-04, 8 | lon_tbl: [-242809, -178223, -6154, -6547, 15526, -79460, 66185, -19531, -12754, 4389, 3153, -1151, 768, 1750, -248, 657, -80, 0, -4, -29, -3020, 301, -360, 412, -1463, 2266, -41, 30, -39868, -14275, -25052, 1583, 15695, 10018, -113, -122, -243, 18, -33, 31, -134, -171, 243, -115, 18, 148, -120, -129, 19, -220, -30, 19, 8, 23, -162, -124, 189, -315, 73, 77, 32006, -11295, 11595, 5629, -838, 1728, 0, 4, 38, 15, 142, -228, 92, 32, -2274, -1500, -2277, 3143, 3204, 127, -20, -11, 5186, 1054, 996, 1769, -231, 163, -88, -19, -2, -145, -27, 48, -8, 421, -7, 148, -16, -2, -3964, 4259, -11192, -8385, 11513, -13415, 103, -43, -289, -79, -29, 163, -117, 559, -190, -15, 7108, 5345, 12933, -7709, 3485, -26023, 11, -5, 311, 78, 22, 76, 2846, -3922, 2329, 43, 34, 442, 3, -245, -5, -3, -17, 5, 318, 15963, 2520, 7115, 2548, -9836, -7063, 1950, -4471, -8326, 4964, -3101, 563, -80, -1444, -472, 8, -22, 1558, -88, 235, 359, 293, -16, 144, 209, -13, -7, 812, -744, 150, -740, -2569, -956, 69, -2475, 1009, -55, -1707, -2525, 1071, -1761, 550, 279, -14, 36, -10442, 3344, -6759, -21551, 24737, -434, 504, -385, 191, 96, -2760, -1068, 85, -2617, 1062, -43, 192, -16, 30, 42, -2446, 588, -1522, -2933, 1746, -1070, 511, -1401, 139, 729, -12, 29, -2618, -2076, 2079, -3711, -21, -2727, -80, -19, 113, 2420, 325, 1058, 379, -1478, 296, -251, -265, -409, -10, 20, 15, -15, 11, 143, -83, 19, 266, -17, 40, 59, 19, -105, 5, 48331, 21, -16, -97, -318, 158, -171, 456, -351, 168, 85, 12, -2, 20, -15, 15, 2, 385, -1125, 521, -23, -815, -2088, 1644, -1329, 7, 14, -582, 234, -67, -467, -167, -51, -684, -2302, 1315, -797, 6, -70, -118, -406, 67, -63, -4848, 3713, -8483, -8776, 13049, -9404, -23, 34, -12, 1, -24, -10, -21, 0, -1, 24, -3, 28, -3032, -2494, 2498, -4342, -6538, 1899, -4414, -13249, 15540, -292, -228, 176, -40, -161, -20, -36, -800, -172, -36, -208, -249, -374, -1410, -72118, -745, 213, -23, 196, -14, -2, -239, -341, 1015, -291, 33, -94, 90, -20431, 4, -39, 75, 216, -23, 41, 116, 24, 5, 26, -45, -4178, -9, -23, 12, 18, 68, -2, 36, -19, 42, -8, 6, -106, 4, -38, -73, 259, 107, -293, -12, -44, 37, 13, 73, -46, 17, 8, 5832, 1989, -1404, 4469, -1619, -743, -1796, -2206, 461, -291, 153, 1104, 19195, 652503, 5587, -5252787, 47, -17340051, -32, 68926621, 1054, -230, -1601, 356, -562, -998, 124, -446, -171, 66, 26, 60, -7, 0, -88, -43, 65, -400, 4, 183, -1014, 2043, -1076, 126, -41, -205, -127, -85, -15, 68, 0, 0, -320, 75, -42, 285, -303, 771, 616, 400, -470, 48, -76, -103, -190, -11, -139, -5, -48, -87, -22, -362, -271, 1233, -392, 353, -154, -71, -109, 112, 17, 8, 1, -17, -170, 623, -279, 21, 139, -151, -107, -55199, 588, -188, 397, 674, -406, 269, 166, -207, 585, 333, -386, 754, 29, -65, 35, 10, 63, 1291, 62, 8, 239, 1323, -1434, 53, 19, -1, 34, 82, -15, -16, 265, -338, -729, -207, 3, 17, 697, 399, 274, 760, -12, 2, -48, -9, 3, 64, 147, 36, 9, 46, 77, 144, -76, 65, 2329, 1763, 987, 5506, 66, -123, -41, -24, -12, 1, -19, 94, 19, 8, -1, -18, 142, 77, -78, 187, 6, 18, 607, 163, 17, 158, 27, -208, 154, 27317, 587, -143, 22, -153, 5, -34, 75, 330, 98, -128, -67, -6542, -115, -236, 217, -12, 10, -6, -250, 653, 1611, -209, 4, 1072, -129, 216, 402, 81, 117, 11, 0, 20, 24, -28, 245, 437, -16, 59, 527952, -74895, 169682, 177186, -376, -362869, -60, 719658, -151, -382, -22, -43, 5, -5, 14, 5, -9, 13, 83, 296, -369, -1, -14, -6, 42, 8, -31, 7, -354, 634, 1132, 243, -38, 42, -14, 68, -6, 31, -36, -13, 7, -2104, 16, 67, 9, -4, 174, 144, 58, 438, -15, 5, -16, 19, -135, 1642, -140, -11, -4, 27, 253, -382, -651, -221, 11, 1, -12, -6, 136, 23, -1, 43, 3, 38, -26, -5, 17864, -4244, 5704, 7754, -36, -7891, -3, 10418, 2, -844, -1, 126, -7, 32, -67, -5, 39, 10, 5, 52, -13, 159, -49, -21, 1, -394, 7, -15, -4, -245, 1, 172, -36, -3, 13, 5, 0, 1, -1, 0, 0, -202, -2, 19, -20, -2, 5, 3, 0, -110, -12, -1, 0, -62, 0, -36, 0, -22, -13, 3], 9 | lat_tbl: [-428091, -488399, 746850, 6, 210, -93, 32, 1, -365, 332, -105, 76, -7, 2, -8, 14, -1, 2, 0, 0, -65, 12, -17, 7, -1, 1, 0, 0, -15, 65, -4, 26, -2, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, -1, -3, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, -1, 0, -30, 28, -6, 10, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, -16, 20, -6, -41, -9, -3, 0, 0, -6, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -96, 33, -12, 228, -23, -21, 0, 0, -12, -2, -4, 4, -1, 0, 1, 0, -329, -22, -34, -726, -147, -21, 0, 0, -2, 4, -1, 0, 2, -7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 36, 88, -162, -19, -11, 21, 31, 37, -31, 53, -5, -15, -3, -11, 9, 3, 0, 0, -2, 0, 1, 0, 2, -1, 0, 0, 0, 0, -162, -102, -37, 30, 19, 23, -18, 9, 1, -6, -6, 22, -2, 3, 1, -2, 0, -1, 26, -25, 66, 52, -641, -153, -13, -9, 2, -3, -29, 8, -6, -2, 0, -6, 2, -4, 1, 0, -26, -11, -1, -10, -6, -13, 66, -1337, -879, -207, 1, -1, 8, -30, -24, -18, -16, 1, 9, 1, -24, -8, 9, -17, -13, 75, 19, -8, -29, 24, 0, 0, -1, 1, -25, 36, -7, -22, 0, -3, 1, -1, 187, -46, -6, 74, 5, -10, -5, -4, -16, 10, -5, -5, 2, -4, 5, -2, -2, 1, -1, 0, -16, -12, 1, -13, -17, -111, -186, 73, -1, -2, -277, -77, -27, 106, 16, 5, -12, -15, -13, -30, -1, 1, 0, 36, -10, 4, 607, 262, 533, -1530, -1630, 304, 8, -6, 1, 1, 0, -1, 5, -2, 0, -1, -1, -4, -44, -22, -64, -46, 537, 430, 268, -1553, -2040, -486, -3, -23, 20, 41, -1, 2, -21, -4, -1, -3, -84, 50, -177, 26, 5, -12, 2, -4, 7, 1, -115, -305, -310, 138, -186, 246, -96, 17, 0, 0, 4, -2, 1, 1, -3, 2, -1, 0, -15, 68, 0, 2, -3, 0, -5, 0, -1, 1, -5, 6, 0, 0, 0, 0, -235, -98, -2, 2, 9, -40, -1, -2, -33, -9, -5, -4, 5662, -3849, 1941, -124, 210, 160, -24721, -72945, 4099, -21914, 1345, -555, 23637393, -5516830, 17737677, 43330654, -44668315, 14540723, -824, -2086, -4423, -41801, 5562, -11664, 960, -125, 2001, -149, 587, -350, 23, -52, -3, 3, -248, -148, -40, 86, 2, 0, 21, -82, 11, 8, -8, 0, -30, -33, -22, 46, 0, -191, -168, -135, 27, -85, 14, 232, 217, 59, 5, 12, -5, 2, -24, -26, -52, 13, -3, 18, 26, 45, 32, -169, 14, -6, -3, 4, -5, 2, 6, 2, -2, 3, 20, -15, 0, 10, -486, -8, 4, -114, 102, -188, 23, -67, 6, 12, -43, -1, -32, 2, 15, 9, 16, -36, -6, -2, 14, -5, 17, -15, -28, 307, 289, 69, 2, -7, 3, -1, -1, 1, -16, -811, 287, -68, 0, 0, 0, -1, 16, -7, 0, 0, 0, 2, 0, 0, 0, -1, 1, 0, -3, -4, 2, 3, -29, 34, 59, -15, -3, -3, -1, 0, -2, -3, 3, -19, 0, 0, 0, 0, -15, 1, 5, 2, 0, 0, -1, -5, 0, -1, -120, 84, 7, -30, -7, -3, -1, 0, 0, -1, 9, -6, -186, -11, 13, -57, 1, 4, 1, -1, 0, 0, -5, 796, 46, 5, -1, -6, -10, 228, 5, -6, 1, -5, 0, 0, -6, -2, 148, 137, 10, 28, 430546, -279834, 488902, 664558, -746515, 243112, -39, -37, -13, -174, 6, -25, 2, -3, -4, -2, 0, 4, -5, 70, 82, 20, 0, 1, 1, 1, 0, 1, -27, 430, 226, -53, 1, 1, 0, 1, 1, -7, 2, 1, -3, -8, 1, 0, -1, 12, -2, -5, 4, 0, 0, 1, 1, 1, 1, 9, 33, 4, 0, 0, 0, -321, 4, 1, 0, 0, 1, 0, 106, -22, 0, 0, 4, 0, 0, 2, 7006, -9443, 12833, 11137, -14037, 4575, -2, 0, -1, -6, 1, 1, 4, 6, 16, 2, 55, -10, 1, 0, 0, 1, 0, 2, 0, -4, -2, 0, -351, 24, 0, 0, 8, 1, 30, -5, -12, 10, -4, 1, -1, -2, 0, 0, 4, 0, 17, -3, 0, -2, 2, 0, 0, -1, 0, -1, 0, 0, 0, 0], 10 | rad_tbl: [14575, -26192, -144864, 2, -22, 15, -8, -21, -148, -104, -14, -75, 15, 2, -5, -3, -1, 0, 0, 0, 0, 21, -2, 7, -5, -3, 0, 0, 83, -94, 9, -67, -29, 50, 1, -1, 3, 2, 0, 0, 4, 3, 1, 1, -1, -1, 0, -1, 2, -1, 0, 1, 0, 0, -2, 3, -5, -2, -1, 1, 197, 511, -82, 189, -28, -12, 0, 0, 0, -1, 6, -1, 0, 1, 30, -30, -37, -25, 6, 21, 0, 0, 16, -139, 43, -28, 4, 6, 0, 3, 4, 0, 1, 1, -13, 0, -4, 0, 0, 1, 150, 135, -291, 436, -560, -343, 1, 3, 8, -15, -13, -5, -17, -3, 1, -6, -314, 428, 606, 758, 1230, -411, 0, -1, 11, -14, 4, 1, 221, 157, 1, 132, -25, 3, 12, 0, 0, 0, 0, -1, 1487, -108, 707, -79, -950, -190, 177, 582, -676, 399, -281, -396, 0, 52, 39, -130, 2, 1, 12, 148, -34, 23, 1, 27, -20, 13, 1, -1, 198, -34, -21, -80, -99, 332, -307, 9, -15, -125, 330, -231, 236, 139, -36, 74, 7, 3, -588, -1722, 3623, -1245, 187, 4366, -72, -75, 11, -33, 174, -467, 444, 9, 11, 180, -6, -39, 8, -7, -126, -500, 599, -317, 224, 355, -590, -39, 134, -379, -7, -3, 494, -628, 893, 490, 712, -7, -7, 35, -720, 50, -321, 72, 443, 106, 74, 82, 112, -84, -6, -3, 5, 4, 58, 7, -2, 38, 6, 92, -20, 14, 33, 13, -11189, -2, -11, -8, 106, -35, 58, 52, 132, 170, -32, 63, -2, -6, 6, 7, -1, 6, 452, 155, 9, 209, 788, -318, 511, 616, -5, 3, 142, 303, -280, 32, 21, -69, 984, -291, 340, 562, 30, 2, 171, -51, 27, 28, -1570, -2053, 3702, -3593, 4012, 5467, -14, -9, -1, -6, 4, -11, 0, -9, -11, 0, 15, 2, 1133, -1366, 1961, 1134, -867, -3010, 6041, -2049, 142, 7138, -79, -103, 73, -18, 17, -9, 79, -372, 97, -17, 182, -118, 33577, -675, -99, -347, -91, -11, 1, -7, 158, -111, 136, 474, 50, 16, 9739, 51, 19, 2, -105, 36, -20, -11, -12, 56, -13, 2, 2030, -22, 11, -4, 9, -6, 1, 33, 10, 18, 4, 21, 53, 3, 19, 2, 130, 37, -147, -54, -22, 6, 7, -19, 22, 36, -4, 8, -949, 2911, -2221, -697, 371, -808, 1203, -1117, 191, 189, -549, 77, -321201, 19788, 2622593, 5990, 8667033, 114, -34455835, 86, -92, -493, 179, 807, -499, 281, 225, 51, -34, -88, -30, 13, 0, -3, 20, -43, 201, 33, -93, 2, -1034, -518, -63, -545, 104, -20, 43, -64, -34, -7, 0, 0, -61, -159, -143, -8, -392, -157, -204, 309, -24, -248, 55, -40, -6, 91, -16, 57, -41, 18, 197, -20, -668, -150, -192, -216, 39, -84, -62, -59, -4, 8, -7, -1, -352, -100, -10, -158, 61, 55, 32493, -49, 107, 344, -395, 227, -154, -238, 123, 104, -205, 348, -449, -236, -54, -19, -6, 21, -790, 27, -5, 30, -846, 154, -26, -920, 0, 12, -54, 21, 11, -10, 137, 132, 109, -337, -11, 2, -272, 467, -511, 179, -1, -8, 7, -32, -44, 2, -26, 101, -32, 6, -98, 48, -42, -53, -1222, 1601, -3775, 656, 83, 46, 16, -28, 0, 7, -66, -14, -6, 13, 12, 0, -58, 91, -123, -58, -12, 4, -114, 423, -111, 12, 112, 27, -19072, 71, 100, 410, 107, 15, 24, 3, -214, 30, 49, 44, 5017, -27, 167, -80, 8, 153, 4, 7, -219, -35, 244, 694, -762, 2, -84, -49, -28, 158, -4, 56, -14, 0, 9, 12, 7, 18, 2, -7, -15426, 91, 25800, -15, 144767, -53, -287824, -24, 19, -9, 6, 7, 0, 0, -3, 8, -5, -3, -232, 53, -1, -271, 4, -12, -8, 30, -8, -25, -253, -150, -105, 470, -37, -29, -59, -6, -24, -5, 9, -18, 1784, 3, -54, 13, -12, 7, -116, 144, -353, 52, -4, -12, -17, -14, -1340, -64, 10, -116, -24, -2, 190, 131, 130, -307, -1, 9, 5, -7, -10, 56, -33, 0, -14, 3, 2, -12, -635, -160, 64, -44, 2712, -3, -3606, -1, 774, 1, 133, -1, -19, 0, 5, -59, -5, 14, -45, 5, -140, -8, 15, -28, 379, 1, 6, 3, 55, 0, -54, 0, 3, -33, -3, 4, 0, -4, 0, -1, 200, 0, -17, -1, 2, -20, -2, 0, 111, 0, 1, -12, 64, 0, 38, 0, 23, 0, 3, 13], 11 | arg_tbl: [0, 3, 3, 4, 3, -8, 4, 3, 5, 1, 2, 2, 5, -5, 6, 2, 4, 4, 3, -8, 4, 5, 5, -5, 6, 1, 3, 2, 2, 1, 3, -8, 4, 0, 3, 3, 2, -7, 3, 4, 4, 2, 3, 7, 3, -13, 4, -1, 5, 0, 2, 8, 2, -13, 3, 2, 3, 1, 3, -2, 4, 2, 6, 0, 3, 1, 2, -8, 3, 12, 4, 1, 3, 6, 2, -10, 3, 3, 5, 1, 1, 1, 7, 0, 2, 1, 5, -2, 6, 1, 2, 1, 5, -3, 6, 0, 3, 1, 3, -2, 4, 1, 5, 0, 3, 3, 3, -6, 4, 2, 5, 1, 3, 1, 1, -5, 2, 4, 3, 0, 2, 8, 3, -15, 4, 2, 3, 4, 3, -7, 4, -3, 5, 0, 3, 2, 2, -7, 3, 7, 4, 0, 2, 2, 5, -4, 6, 1, 1, 1, 6, 2, 2, 2, 5, -6, 6, 0, 2, 9, 3, -17, 4, 2, 3, 3, 2, -5, 3, 1, 5, 0, 3, 2, 3, -4, 4, 2, 5, 0, 3, 2, 3, -4, 4, 1, 5, 0, 3, 3, 2, -5, 3, 2, 5, 0, 2, 1, 5, -1, 6, 0, 3, 3, 2, -6, 3, 2, 4, 0, 2, 1, 3, -2, 4, 2, 2, 2, 5, -3, 6, 0, 1, 2, 6, 1, 2, 3, 5, -5, 6, 1, 1, 1, 5, 2, 3, 4, 3, -8, 4, 2, 5, 0, 2, 1, 5, -5, 6, 1, 2, 7, 3, -13, 4, 2, 2, 2, 5, -2, 6, 0, 2, 10, 3, -19, 4, 0, 2, 3, 5, -4, 6, 0, 2, 3, 2, -5, 3, 2, 2, 2, 3, -4, 4, 2, 2, 5, 2, -8, 3, 1, 2, 3, 5, -3, 6, 0, 2, 6, 3, -11, 4, 1, 2, 1, 1, -4, 3, 1, 2, 4, 5, -5, 6, 0, 1, 2, 5, 1, 2, 3, 3, -6, 4, 2, 2, 5, 3, -9, 4, 2, 2, 6, 2, -10, 3, 0, 2, 2, 2, -3, 3, 2, 2, 4, 3, -8, 4, 1, 2, 4, 3, -7, 4, 2, 2, 5, 3, -10, 4, 1, 2, 3, 3, -5, 4, 2, 2, 1, 2, -2, 3, 1, 2, 7, 2, -11, 3, 0, 2, 2, 3, -3, 4, 1, 2, 1, 3, -1, 4, 0, 2, 4, 2, -7, 3, 0, 2, 4, 2, -6, 3, 2, 1, 1, 4, 1, 2, 8, 3, -14, 4, 0, 2, 1, 3, -5, 5, 0, 2, 1, 3, -3, 4, 1, 2, 7, 3, -12, 4, 1, 2, 1, 2, -1, 3, 1, 2, 2, 3, -5, 4, 0, 2, 1, 3, -4, 5, 1, 2, 6, 3, -10, 4, 1, 2, 3, 3, -7, 4, 0, 3, 1, 3, -4, 5, 2, 6, 0, 3, 1, 3, -1, 5, -5, 6, 0, 2, 5, 3, -8, 4, 1, 2, 1, 3, -3, 5, 1, 3, 1, 3, -5, 5, 5, 6, 0, 2, 2, 2, -4, 3, 1, 2, 6, 2, -9, 3, 0, 2, 4, 3, -6, 4, 1, 3, 1, 3, -3, 5, 2, 6, 0, 2, 1, 3, -5, 6, 1, 2, 1, 3, -2, 5, 2, 3, 1, 3, -4, 5, 5, 6, 0, 3, 1, 3, -1, 5, -2, 6, 0, 3, 1, 3, -3, 5, 3, 6, 0, 2, 1, 3, -4, 6, 0, 3, 1, 3, -2, 5, 1, 6, 0, 2, 5, 2, -9, 3, 0, 2, 3, 3, -4, 4, 1, 2, 3, 2, -4, 3, 2, 2, 1, 3, -3, 6, 1, 3, 1, 3, -2, 5, 2, 6, 0, 3, 1, 3, 1, 5, -5, 6, 1, 2, 1, 3, -1, 5, 1, 3, 1, 3, -3, 5, 5, 6, 1, 3, 1, 3, 2, 5, -7, 6, 0, 2, 1, 3, -2, 6, 1, 2, 2, 3, -2, 4, 1, 3, 3, 2, -4, 3, 1, 5, 0, 2, 10, 3, -17, 4, 1, 3, 1, 3, 2, 5, -6, 6, 1, 2, 1, 3, -1, 6, 0, 3, 1, 3, -2, 5, 4, 6, 0, 2, 7, 3, -15, 4, 0, 2, 1, 3, -2, 7, 0, 3, 1, 3, 1, 5, -3, 6, 0, 2, 1, 3, -2, 8, 0, 2, 1, 3, -1, 7, 0, 2, 1, 3, -1, 8, 0, 2, 8, 2, -14, 3, 1, 3, 3, 2, -8, 3, 4, 4, 1, 3, 1, 3, 4, 5, -10, 6, 1, 3, 1, 3, 2, 5, -5, 6, 2, 3, 5, 3, -8, 4, 3, 5, 2, 1, 1, 12, 3, 3, 3, 3, -8, 4, 3, 5, 2, 3, 1, 3, -2, 5, 5, 6, 2, 3, 3, 2, -6, 3, 4, 4, 0, 2, 8, 2, -12, 3, 1, 3, 1, 3, 1, 5, -2, 6, 0, 2, 9, 3, -15, 4, 2, 2, 1, 3, 1, 6, 1, 2, 1, 10, -1, 11, 0, 1, 2, 4, 1, 2, 1, 3, 1, 5, 1, 2, 8, 3, -13, 4, 1, 2, 3, 2, -6, 3, 0, 2, 1, 3, -4, 4, 1, 2, 5, 2, -7, 3, 1, 2, 7, 3, -11, 4, 1, 2, 1, 1, -3, 3, 0, 2, 1, 3, 2, 5, 0, 2, 2, 3, -6, 4, 0, 2, 6, 3, -9, 4, 1, 2, 2, 2, -2, 3, 1, 2, 5, 3, -7, 4, 2, 2, 4, 3, -5, 4, 2, 2, 1, 2, -3, 3, 0, 2, 7, 2, -10, 3, 0, 2, 3, 3, -3, 4, 0, 2, 2, 3, -1, 4, 0, 2, 4, 2, -5, 3, 1, 2, 1, 3, 1, 4, 0, 2, 2, 3, -5, 5, 0, 2, 8, 3, -12, 4, 0, 1, 1, 2, 1, 3, 2, 3, -5, 5, 2, 6, 0, 2, 2, 3, -4, 5, 1, 3, 2, 3, -6, 5, 5, 6, 0, 2, 7, 3, -10, 4, 0, 3, 2, 3, -4, 5, 2, 6, 0, 3, 2, 3, -1, 5, -5, 6, 1, 2, 6, 3, -8, 4, 1, 2, 2, 3, -3, 5, 1, 3, 2, 3, -5, 5, 5, 6, 1, 2, 2, 2, -5, 3, 0, 2, 6, 2, -8, 3, 0, 3, 2, 3, -4, 5, 3, 6, 0, 3, 2, 3, -3, 5, 1, 6, 0, 2, 5, 3, -6, 4, 1, 3, 2, 3, -3, 5, 2, 6, 0, 2, 2, 3, -5, 6, 1, 2, 2, 3, -2, 5, 1, 3, 2, 3, -4, 5, 5, 6, 1, 2, 2, 3, -4, 6, 0, 2, 4, 3, -4, 4, 0, 2, 3, 2, -3, 3, 1, 2, 2, 3, -3, 6, 1, 3, 2, 3, -2, 5, 2, 6, 0, 2, 2, 3, -1, 5, 1, 2, 2, 3, -2, 6, 0, 2, 3, 3, -2, 4, 1, 2, 2, 3, -1, 6, 0, 2, 2, 3, -2, 7, 0, 3, 2, 3, 2, 5, -5, 6, 0, 3, 6, 3, -8, 4, 3, 5, 1, 1, 2, 12, 3, 3, 2, 3, -8, 4, 3, 5, 1, 3, 2, 3, -2, 5, 5, 6, 0, 2, 8, 2, -11, 3, 0, 2, 2, 3, 1, 5, 0, 2, 5, 2, -6, 3, 1, 2, 8, 3, -11, 4, 0, 2, 1, 1, -2, 3, 0, 2, 7, 3, -9, 4, 0, 2, 2, 2, -1, 3, 1, 2, 6, 3, -7, 4, 0, 2, 5, 3, -5, 4, 0, 2, 7, 2, -9, 3, 0, 2, 4, 3, -3, 4, 0, 2, 4, 2, -4, 3, 0, 2, 3, 3, -5, 5, 0, 2, 1, 2, 1, 3, 0, 2, 3, 3, -4, 5, 1, 2, 8, 3, -10, 4, 0, 2, 7, 3, -8, 4, 0, 2, 3, 3, -3, 5, 0, 2, 6, 2, -7, 3, 0, 2, 6, 3, -6, 4, 0, 2, 3, 3, -2, 5, 1, 2, 3, 3, -4, 6, 0, 2, 5, 3, -4, 4, 0, 2, 3, 2, -2, 3, 0, 2, 3, 3, -3, 6, 0, 2, 3, 3, -1, 5, 0, 2, 3, 3, -2, 6, 0, 1, 3, 12, 3, 2, 5, 2, -5, 3, 0, 2, 1, 1, -1, 3, 0, 1, 2, 2, 0, 2, 7, 2, -8, 3, 0, 2, 4, 2, -3, 3, 0, 2, 4, 3, -5, 5, 0, 2, 4, 3, -4, 5, 0, 2, 4, 3, -3, 5, 0, 2, 6, 2, -6, 3, 0, 2, 4, 3, -2, 5, 0, 1, 4, 12, 1, 2, 8, 2, -9, 3, 0, 2, 5, 2, -4, 3, 0, 1, 1, 1, 0, 2, 7, 2, -7, 3, 1, 2, 5, 3, -5, 5, 0, 2, 9, 2, -10, 3, 0, 2, 6, 2, -5, 3, 0, 2, 8, 2, -8, 3, 0, 2, 10, 2, -11, 3, 0, 2, 9, 2, -9, 3, 0, 2, 10, 2, -10, 3, 0, 2, 11, 2, -11, 3, 0, 2, 2, 1, -1, 3, 0, -1] 12 | }; -------------------------------------------------------------------------------- /astronomy/moshier/plan404/moonlat.js: -------------------------------------------------------------------------------- 1 | $ns.moonlat = { 2 | maxargs: 14, 3 | max_harmonic: [0, 26, 29, 8, 3, 5, 0, 0, 0, 6, 5, 3, 5, 1, 0, 0, 0, 0], 4 | max_power_of_t: 3, 5 | distance: 2.5735686895300000e-03, 6 | timescale: 3.6525000000000000e+06, 7 | trunclvl: 1.0000000000000000e-04, 8 | lon_tbl: [-3, -4, 4, -1856, 0, 8043, -9, -1082, -1, -310, -1, -522, -330, -1449, -853, 4656, -66, 7, -1, 9996928, -66, 6, 23, 183, 0, 173, 0, -56, 0, 50, 0, -785, 1, 51, 0, -60, 1, 11843, 0, -50754, 0, 1834, 1, -7910, 0, -48060, 1, 56, 0, 13141, -1, -56318, 0, 2541, -1, -649, -133, 778, -46, 8, 1, 1665737, -47, 7, 0, 65, 0, 45, 0, -138, 0, -1005, 0, -2911, 0, -47, 0, 96, 0, -394, 2, 76, 2, -17302, 0, 74337, 0, -101, 0, 58, 0, -171, 0, -77, 0, -1283, 0, 2686, 0, -55, 0, 99, 0, 55, 0, 397, 0, 540, 0, 626, -1, -5188, 0, 10857, 0, -216, -2, -123, 0, 6337, 2, 224, -152, -23472, -29, -74336, 0, 295775, -20, 149, -2, 84, 9, 304, 0, -3051, -70, -6, -57, 34, 0, -638, 0, -201, -73, 9, 0, -100, -101, -8, 0, -57, 0, -207, -3, 80, -45, 45, -5, 102, -59, -23, 52, 201, -48, 233, -220, 71, 4, 2810, 0, 6236541, -61, 218, -216, 67, 51, 201, -59, -23, -144, -837, -457, 3029, -45, 42, -15, 73, -6, -169, 0, 135, -64, -7, 0, -16245, 0, -81, -74, -10, 0, 702, 0, -3013, 0, -5889, 1, 141, 58, 9598, 12, 30443, 1, -120946, -1, -84, -2, 11246, -1, -48391, 0, 1393, 0, 200, -136, -17, 0, 558, -64, -8, 0, -71, 0, 317577, -28, 183, 1, 219, 0, 421, 0, -133, 501, -139, 3, 354, -101, -13, 74, 7, 144, -84, 59, -2, 1, 64, -2931, 12559, -4641, 2638, -303, -2058, -13, -100, -123, -79, -19214, 6084, 1494, 26993, 15213, -82219, 42, 52, 48, -101, -53, -4, 4, 47, 58, -131, 46, 14, -21, -6, -1311, -8791, 10198, -4185, 2815, 5640, 167, 422, -229, 83, 3140, 39, 1221, 120, 96, -30, -1, 184612405, 187, 416, -226, 81, -1985, -10083, 9983, -4464, 2807, 5643, -21, -9, 113, -367, 120, 580, -667, 27, 8, 66, -56, -6, 337, 95, -87, 3303, -1, 65, 68, -374, 0, -574, 15, -94, 0, -53, 0, -1303, 0, -236, 283, 36, -1, -54, 269, -35, 0, -83, 0, -52, 0, 730, 0, -3129, 0, 813, 0, -4299, 1, 59, -6, 5130, 1, 16239, -1, -64603, 0, -80, 91, 12, 0, -561, 133, -17, 0, 250, -12, 71, 0, 155664, 82, -11, 0, 106, 0, -604, 0, 21862, 55, -7, 0, -1514, 0, 6501, 0, 906, 0, -68, 0, 241, 0, 366, 0, 70, 0, -1382, 0, 5957, 0, 113, 0, -51, 0, -55, 0, 731, 0, -264, 0, 65788, 1, -1504, 0, 3147, 0, 217, 0, -4105, 0, 17658, 1, 69, 0, -3518, 0, -1767, -43, -7044, -10, -22304, 0, 88685, 3, 91, 0, -485, 0, -57, -1, 333548, -24, 172, 11, 544, 1, -1132, 0, 353, 0, -188, 0, 53, 0, 77, 158, -887, 35, 131, -54, 13, 0, 1994821, -53, 14, 36, 125, 2, 56, 0, -243, 0, -364, -2, 1916, 0, -8227, 0, 15700, -1, -67308, 1, 66, 0, -53686, 1, 3058, 1, -13177, 0, -72, 0, -72, 0, 61, 0, 15812, 0, 165, 8, -96, 318, 1341, 803, -4252, 24, 193, 1137, -226, 310, 622, -56, 30, -3, 10101666, -56, 30, 1096, -225, 300, 600, -31, 409, -1, -507, 0, -287, 0, -1869, 0, 8026, 1, 544, -1, -1133, 0, 27984, 0, -62, 0, -249, 0, 187, 0, -1096, 1, 53, 2, 12388, 0, -53107, 0, -322, 0, -94, 0, 15157, 0, -582, 0, 3291, 0, 565, 0, 106, 0, 112, 0, 306, 0, 809, 0, 130, 0, -961, 0, 4149, 0, 174, 0, -105, 0, 2196, 0, 59, 0, 36737, -1, -1832, 0, 3835, 0, -139, 0, 24138, 0, 1325, 1, 64, 0, -361, 0, -1162, -44, -6320, -10, -20003, 0, 79588, 2, 80, 0, -2059, 0, -304, 0, 21460, 0, -166, 0, -87, 89, -493, 32, 114, 34, 510, 1, 1172616, 31, 113, -1, 57, 0, 214, 0, -656, 0, -646, 0, 1850, 0, -7931, 0, -6674, 0, 2944, 0, -12641, 0, 916, 45, -255, 16, 60, -1, 619116, 16, 57, 0, -58, 0, 1045, 0, -156, -15, 88, 0, -62964, 0, -126, 0, 1490, 0, -6387, 0, 119, 0, 1338, 0, -56, 0, 204, 0, 153, 0, 940, 0, 251, 0, 312, 0, 584, 0, -786, 0, 3388, 0, -52, 0, 4733, 0, 618, 0, 29982, 0, 101, 0, -174, 0, -2637, 0, 11345, 0, -284, 0, -524, 0, -121, 0, 1464, 11, -60, -1, 151205, 0, 139, 0, -2448, 0, -51, 0, -768, 0, -638, 0, 552, 0, -2370, 0, 70, 0, 64, 0, 57, 0, 39840, 0, 104, 0, -10194, 0, -635, 0, 69, 0, 113, 0, 67, 0, 96, 0, 367, 0, 134, 0, 596, 0, 63, 0, 1622, 0, 483, 0, 72, 0, 11917, 0, -63, 0, 1273, 0, -66, 0, -262, 0, -97, 0, 103, 0, 15196, 0, -1445, 0, -66, 0, -55, 0, -323, 0, 2632, 0, -1179, 0, 59, 0, -56, 0, 78, 0, 65, 0, 422, 0, 309, 0, 2125, 0, -66, 0, 124, 0, -57, 0, 1379, 0, -304, 0, 177, 0, -118, 0, 146, 0, 283, 0, 119], 9 | lat_tbl: [], 10 | rad_tbl: [], 11 | arg_tbl: [0, 1, 3, 1, 10, 1, 12, -1, 11, 1, 4, 2, 10, 2, 12, -1, 13, -1, 11, 0, 5, 2, 10, -1, 13, -1, 11, 3, 2, -3, 3, 0, 5, 2, 10, -1, 13, -1, 11, 2, 3, -2, 5, 0, 2, -1, 13, 1, 14, 1, 5, -1, 13, 1, 11, 4, 3, -8, 4, 3, 5, 0, 2, 1, 13, -1, 11, 0, 5, 1, 13, -1, 11, 4, 3, -8, 4, 3, 5, 0, 5, 2, 10, -1, 13, -1, 11, 2, 3, -3, 5, 0, 4, 1, 10, 1, 12, -2, 13, 1, 11, 0, 4, 1, 13, -1, 11, 1, 2, -1, 3, 0, 5, 2, 10, -1, 13, -1, 11, 2, 2, -2, 3, 0, 3, 1, 10, -2, 13, 1, 11, 0, 4, 1, 13, -1, 11, 1, 3, -1, 5, 0, 4, -1, 13, 1, 11, 1, 2, -1, 3, 0, 3, 1, 12, 1, 13, -1, 11, 1, 4, 2, 10, 1, 12, -1, 13, -1, 11, 1, 2, 1, 10, -1, 11, 0, 4, -1, 13, 1, 11, 1, 3, -1, 5, 0, 3, 1, 12, -1, 13, 1, 11, 1, 3, 2, 10, -3, 13, 1, 11, 0, 3, 2, 12, 1, 13, -1, 11, 0, 3, -2, 10, 1, 13, 1, 14, 0, 6, -2, 10, 1, 13, 1, 11, 4, 3, -8, 4, 3, 5, 0, 3, 2, 10, -1, 13, -1, 11, 0, 6, 2, 10, -1, 13, -1, 11, 4, 3, -8, 4, 3, 5, 0, 4, -1, 13, 1, 11, 2, 3, -2, 5, 0, 4, -1, 13, 1, 11, 3, 2, -3, 3, 0, 3, 1, 10, -1, 12, -1, 11, 0, 3, 2, 12, -1, 13, 1, 11, 0, 3, 2, 10, 1, 13, -3, 11, 0, 5, -2, 10, 1, 13, 1, 11, 1, 2, -1, 3, 0, 4, 2, 10, -1, 12, -3, 13, 1, 11, 0, 3, 3, 10, -2, 13, -1, 11, 0, 5, -2, 10, 1, 13, 1, 11, 1, 3, -1, 5, 0, 4, 2, 10, -1, 12, -1, 13, -1, 11, 1, 2, 3, 10, -3, 11, 0, 5, -2, 10, 1, 13, 1, 11, 2, 2, -2, 3, 0, 4, 2, 10, -1, 12, 1, 13, -3, 11, 0, 3, 4, 10, -3, 13, -1, 11, 0, 4, 2, 10, -2, 12, -1, 13, -1, 11, 1, 3, 4, 10, -1, 13, -3, 11, 0, 4, 2, 10, -3, 12, -1, 13, -1, 11, 0, 3, 4, 10, -1, 12, -3, 11, 0, 3, 2, 10, -3, 12, -1, 11, 0, 4, 4, 10, -1, 12, -2, 13, -1, 11, 0, 2, 4, 10, -3, 11, 0, 3, 2, 10, -2, 12, -1, 11, 1, 4, 3, 10, -1, 12, -1, 13, -1, 11, 0, 4, -2, 10, 1, 11, 2, 3, -2, 5, 0, 3, 4, 10, -2, 13, -1, 11, 0, 4, -2, 10, 1, 11, 2, 2, -2, 3, 0, 3, 2, 10, -1, 12, -1, 11, 2, 3, -2, 10, 1, 12, 1, 14, 0, 4, -2, 10, 1, 11, 2, 3, -2, 4, 0, 4, -2, 10, 1, 11, 1, 3, -1, 5, 0, 3, 3, 10, -1, 13, -1, 11, 0, 4, -2, 10, 1, 11, 3, 2, -4, 3, 0, 4, -2, 10, 1, 11, 1, 3, -2, 5, 0, 4, 2, 10, -1, 12, -2, 13, 1, 11, 0, 4, -2, 10, 1, 11, 1, 2, -1, 3, 0, 2, -1, 10, 1, 2, 0, 3, 2, 10, 2, 13, -3, 11, 0, 4, -2, 10, 1, 11, 2, 2, -3, 3, 0, 3, 2, 12, -2, 13, 1, 11, 0, 4, 1, 10, -1, 12, 1, 13, -1, 11, 0, 3, -2, 10, 1, 11, 1, 5, 0, 4, 2, 10, -1, 11, 1, 3, -2, 4, 0, 3, 2, 10, -2, 11, 1, 14, 0, 4, -2, 10, 1, 11, 8, 2, -13, 3, 0, 5, -2, 10, -1, 13, 1, 11, 18, 2, -16, 3, 0, 5, 2, 10, -1, 11, 4, 3, -8, 4, 3, 5, 1, 2, 2, 10, -1, 11, 1, 5, -2, 10, 1, 11, 4, 3, -8, 4, 3, 5, 1, 5, 2, 10, -1, 13, -1, 11, 18, 2, -16, 3, 0, 4, 2, 10, -1, 11, 8, 2, -13, 3, 0, 2, -2, 10, 1, 14, 1, 4, -2, 10, 1, 11, 1, 3, -2, 4, 0, 3, 2, 10, -1, 11, 1, 5, 0, 2, 2, 12, -1, 11, 0, 4, 3, 10, 1, 12, -1, 13, -1, 11, 0, 4, 2, 10, -1, 11, 2, 2, -3, 3, 0, 3, 2, 10, -2, 13, 1, 11, 0, 4, 2, 10, -1, 11, 1, 2, -1, 3, 0, 3, 1, 10, 1, 2, -2, 3, 0, 3, 1, 12, -2, 13, 1, 11, 1, 3, 1, 10, 1, 13, -1, 11, 0, 4, 2, 10, -1, 11, 1, 3, -1, 5, 0, 3, 2, 10, 1, 12, -1, 11, 2, 3, -2, 10, -1, 12, 1, 14, 0, 2, 1, 12, -1, 11, 1, 3, 1, 10, -1, 13, 1, 11, 0, 4, 2, 10, -1, 11, 2, 2, -2, 3, 0, 3, 1, 10, 2, 2, -3, 3, 0, 4, 2, 10, 1, 12, -2, 13, 1, 11, 0, 3, -1, 10, 1, 2, -2, 3, 0, 3, -1, 11, 1, 2, -1, 3, 0, 2, 2, 13, -1, 11, 0, 2, -2, 13, 1, 14, 0, 4, 2, 10, -1, 11, 2, 3, -2, 5, 0, 4, 2, 10, -1, 11, 3, 2, -3, 3, 0, 4, 2, 10, 2, 12, -2, 13, -1, 11, 0, 3, 1, 10, 1, 3, -2, 5, 0, 4, 1, 10, 1, 12, 1, 13, -1, 11, 0, 3, 1, 10, 3, 2, -4, 3, 0, 3, 1, 10, 1, 3, -1, 5, 0, 3, 1, 10, 1, 3, -2, 6, 0, 3, 1, 10, 2, 3, -2, 4, 0, 4, 1, 10, 1, 12, -1, 13, -1, 11, 0, 3, 2, 10, 2, 12, -1, 11, 2, 4, 1, 10, 1, 3, 2, 5, -5, 6, 1, 1, 1, 14, 2, 3, 1, 10, 8, 2, -12, 3, 1, 5, -2, 10, 1, 13, -1, 11, 20, 2, -21, 3, 0, 5, 2, 10, -2, 13, 1, 11, 2, 3, -3, 5, 0, 3, 1, 10, 1, 3, 1, 6, 0, 4, -1, 13, -1, 11, 26, 2, -29, 3, 0, 3, -1, 11, 8, 2, -13, 3, 0, 4, -1, 13, -1, 11, 18, 2, -16, 3, 2, 4, -1, 13, 1, 11, 10, 2, -3, 3, 1, 1, 1, 11, 3, 4, -1, 13, -1, 11, 10, 2, -3, 3, 1, 4, -1, 13, 1, 11, 18, 2, -16, 3, 2, 3, 1, 11, 8, 2, -13, 3, 0, 2, 1, 10, 2, 4, 0, 4, 2, 10, -1, 11, 5, 2, -6, 3, 1, 5, 2, 10, -2, 13, -1, 11, 2, 3, -3, 5, 0, 5, -2, 10, 1, 13, 1, 11, 20, 2, -21, 3, 0, 3, 1, 10, 1, 3, 1, 5, 0, 2, -2, 11, 1, 14, 0, 5, 2, 10, -2, 13, 1, 11, 2, 3, -2, 5, 0, 3, 1, 10, 5, 2, -7, 3, 0, 4, 1, 10, 1, 12, -1, 13, 1, 11, 0, 3, 1, 10, 2, 2, -2, 3, 0, 4, 2, 10, 2, 12, -2, 13, 1, 11, 0, 2, 2, 13, -3, 11, 0, 4, 2, 10, -1, 11, 4, 2, -4, 3, 0, 3, 1, 10, 4, 2, -5, 3, 0, 3, 1, 10, -3, 13, 1, 11, 0, 2, 1, 10, 1, 2, 0, 3, 1, 11, 1, 2, -1, 3, 0, 4, 2, 10, -1, 11, 3, 3, -3, 5, 0, 3, 1, 12, 2, 13, -1, 11, 1, 4, 2, 10, 1, 12, -2, 13, -1, 11, 0, 3, 1, 10, -1, 13, -1, 11, 0, 3, 1, 11, 1, 3, -1, 5, 0, 2, 1, 12, 1, 11, 2, 4, 2, 10, -1, 11, 5, 2, -5, 3, 0, 3, 1, 10, 5, 2, -6, 3, 0, 3, 2, 10, 1, 12, -3, 11, 0, 3, 1, 10, 2, 2, -1, 3, 0, 3, 2, 10, -4, 13, 1, 11, 0, 3, -2, 10, 2, 13, 1, 14, 0, 3, 2, 10, -2, 13, -1, 11, 0, 3, 1, 10, 3, 2, -2, 3, 0, 4, 1, 10, -1, 12, -1, 13, -1, 11, 0, 2, 2, 12, 1, 11, 0, 2, 2, 10, -3, 11, 0, 3, 1, 10, 4, 2, -3, 3, 0, 4, 2, 10, -1, 12, -2, 13, -1, 11, 1, 3, 2, 10, -1, 12, -3, 12 | 11, 0, 3, 4, 10, -4, 13, -1, 11, 0, 4, 2, 10, -2, 12, -2, 13, -1, 11, 0, 4, 4, 10, -2, 12, -1, 13, -1, 11, 0, 3, 6, 10, -3, 13, -1, 11, 0, 4, 4, 10, -1, 12, -1, 13, -1, 11, 1, 4, 2, 10, -3, 12, -1, 13, 1, 11, 0, 3, 5, 10, -2, 13, -1, 11, 0, 3, 4, 10, 1, 13, -3, 11, 0, 4, 2, 10, -2, 12, 1, 13, -1, 11, 0, 3, 3, 10, -1, 12, -1, 11, 0, 3, 4, 10, -1, 13, -1, 11, 0, 4, 2, 10, -2, 12, -1, 13, 1, 11, 1, 3, 4, 10, -3, 13, 1, 11, 0, 4, 2, 10, -1, 12, 1, 13, -1, 11, 1, 5, -2, 10, 1, 13, -1, 11, 2, 2, -2, 3, 0, 2, 3, 10, -1, 11, 0, 4, 4, 10, 1, 12, -1, 13, -1, 11, 0, 4, 2, 10, -1, 12, -1, 13, 1, 11, 2, 5, -2, 10, 1, 13, -1, 11, 1, 3, -1, 5, 0, 3, 3, 10, -2, 13, 1, 11, 0, 5, -2, 10, 1, 13, -1, 11, 1, 2, -1, 3, 0, 3, 2, 10, 1, 13, -1, 11, 0, 3, -2, 10, -1, 13, 1, 14, 0, 3, 2, 12, -1, 13, -1, 11, 1, 3, 3, 10, 1, 12, -1, 11, 0, 3, 1, 10, -1, 12, 1, 11, 0, 4, -1, 13, -1, 11, 3, 2, -3, 3, 0, 4, -1, 13, -1, 11, 2, 3, -2, 5, 0, 3, 2, 10, -1, 13, 1, 14, 0, 4, -2, 10, -1, 11, 18, 2, -16, 3, 0, 6, 2, 10, -1, 13, 1, 11, 4, 3, -8, 4, 3, 5, 0, 3, 2, 10, -1, 13, 1, 11, 0, 6, -2, 10, 1, 13, -1, 11, 4, 3, -8, 4, 3, 5, 0, 5, 2, 10, -2, 13, 1, 11, 18, 2, -16, 3, 0, 4, -2, 10, 1, 13, -2, 11, 1, 14, 0, 3, 1, 12, -3, 13, 1, 11, 0, 3, 1, 10, 2, 13, -1, 11, 0, 4, 2, 10, 1, 12, 1, 13, -1, 11, 1, 3, 1, 12, -1, 13, -1, 11, 1, 4, -1, 13, -1, 11, 1, 3, -1, 5, 0, 2, 1, 10, 1, 11, 0, 4, 2, 10, 1, 12, -1, 13, 1, 11, 1, 3, 1, 12, 1, 13, -3, 11, 0, 4, -1, 13, -1, 11, 1, 2, -1, 3, 0, 5, 2, 10, -1, 13, 1, 11, 2, 2, -2, 3, 0, 2, 3, 13, -1, 11, 0, 4, 1, 10, 1, 12, -2, 13, -1, 11, 0, 4, 2, 10, 2, 12, 1, 13, -1, 11, 0, 2, 1, 13, 1, 14, 1, 5, 2, 10, -1, 13, 1, 11, 2, 3, -3, 5, 0, 4, -2, 13, -1, 11, 18, 2, -16, 3, 1, 5, 1, 13, 1, 11, 4, 3, -8, 4, 3, 5, 0, 2, 1, 13, 1, 11, 0, 5, -1, 13, -1, 11, 4, 3, -8, 4, 3, 5, 0, 3, 1, 11, 18, 2, -16, 3, 1, 3, -1, 13, -2, 11, 1, 14, 0, 5, 2, 10, -1, 13, 1, 11, 2, 3, -2, 5, 0, 5, 2, 10, -1, 13, 1, 11, 3, 2, -3, 3, 0, 3, 1, 10, 1, 12, 1, 11, 1, 4, 2, 10, 2, 12, -1, 13, 1, 11, 1, 2, 1, 13, -3, 11, 0, 4, 1, 13, 1, 11, 1, 2, -1, 3, 0, 3, 1, 12, 3, 13, -1, 11, 0, 4, 2, 10, 1, 12, -3, 13, -1, 11, 0, 3, 1, 10, -2, 13, -1, 11, 0, 4, 1, 13, 1, 11, 1, 3, -1, 5, 0, 3, 1, 12, 1, 13, 1, 11, 1, 2, 1, 10, -3, 11, 0, 3, 1, 12, -1, 13, 3, 11, 0, 3, 2, 10, -3, 13, -1, 11, 0, 3, 2, 12, 1, 13, 1, 11, 0, 3, 2, 10, -1, 13, -3, 11, 0, 4, 2, 10, -1, 12, -3, 13, -1, 11, 0, 4, 2, 10, -1, 12, -1, 13, -3, 11, 0, 4, 6, 10, -1, 12, -2, 13, -1, 11, 0, 3, 4, 10, -2, 12, -1, 11, 0, 3, 6, 10, -2, 13, -1, 11, 0, 4, 4, 10, -2, 12, -2, 13, 1, 11, 0, 3, 4, 10, -1, 12, -1, 11, 1, 3, 2, 10, -3, 12, 1, 11, 0, 3, 5, 10, -1, 13, -1, 11, 0, 4, 4, 10, -1, 12, -2, 13, 1, 11, 0, 4, 2, 10, -2, 12, 2, 13, -1, 11, 0, 2, 4, 10, -1, 11, 0, 3, 2, 10, -2, 12, 1, 11, 1, 4, 3, 10, -1, 12, -1, 13, 1, 11, 0, 3, 4, 10, -2, 13, 1, 11, 0, 4, 2, 10, -1, 12, 2, 13, -1, 11, 0, 4, -2, 10, -1, 11, 2, 2, -2, 3, 0, 3, 3, 10, 1, 13, -1, 11, 0, 3, 4, 10, 1, 12, -1, 11, 0, 3, 2, 10, -1, 12, 1, 11, 2, 4, -2, 10, -1, 11, 1, 3, -1, 5, 0, 3, 3, 10, -1, 13, 1, 11, 0, 4, 4, 10, 1, 12, -2, 13, 1, 11, 0, 3, 2, 10, 2, 13, -1, 11, 0, 3, 2, 12, -2, 13, -1, 11, 0, 4, 1, 10, -1, 12, 1, 13, 1, 11, 0, 2, 2, 10, 1, 14, 0, 5, -2, 10, -1, 13, -1, 11, 18, 2, -16, 3, 0, 2, 2, 10, 1, 11, 1, 5, 2, 10, -1, 13, 1, 11, 18, 2, -16, 3, 0, 3, -2, 10, -2, 11, 1, 14, 0, 4, 3, 10, 1, 12, -1, 13, 1, 11, 0, 3, 2, 10, -2, 13, 3, 11, 0, 4, 2, 10, 1, 12, 2, 13, -1, 11, 0, 3, 1, 12, -2, 13, -1, 11, 1, 3, 1, 10, 1, 13, 1, 11, 0, 3, 2, 10, 1, 12, 1, 11, 1, 2, 4, 13, -1, 11, 0, 2, 2, 13, 1, 14, 0, 4, -3, 13, -1, 11, 18, 2, -16, 3, 0, 2, 2, 13, 1, 11, 0, 4, 1, 13, 1, 11, 18, 2, -16, 3, 0, 4, 2, 10, 1, 11, 2, 3, -2, 5, 0, 4, 1, 10, 1, 12, 1, 13, 1, 11, 0, 3, 2, 10, 2, 12, 1, 11, 0, 2, 2, 11, 1, 14, 0, 1, 3, 11, 0, 3, 1, 10, -3, 13, -1, 11, 0, 3, 1, 12, 2, 13, 1, 11, 1, 2, 1, 12, 3, 11, 0, 3, 2, 10, -4, 13, -1, 11, 0, 3, 2, 12, 2, 13, 1, 11, 0, 3, 2, 10, -2, 13, -3, 11, 0, 4, 6, 10, -1, 12, -1, 13, -1, 11, 0, 3, 6, 10, -1, 13, -1, 11, 0, 4, 4, 10, -2, 12, -1, 13, 1, 11, 0, 3, 6, 10, -3, 13, 1, 11, 0, 4, 4, 10, -1, 12, 1, 13, -1, 11, 0, 4, 4, 10, -1, 12, -1, 13, 1, 11, 1, 3, 5, 10, -2, 13, 1, 11, 0, 3, 4, 10, 1, 13, -1, 11, 0, 4, 2, 10, -2, 12, 1, 13, 1, 11, 0, 3, 4, 10, -1, 13, 1, 11, 0, 4, 2, 10, -1, 12, 3, 13, -1, 11, 0, 4, 4, 10, 1, 12, 1, 13, -1, 11, 0, 4, 2, 10, -1, 12, 1, 13, 1, 11, 1, 2, 3, 10, 1, 11, 0, 4, 4, 10, 1, 12, -1, 13, 1, 11, 0, 4, 2, 10, -1, 12, -1, 13, 3, 11, 0, 3, 2, 10, 3, 13, -1, 11, 0, 3, 2, 10, 1, 13, 1, 14, 0, 3, 2, 10, 1, 13, 1, 11, 0, 3, 3, 10, 1, 12, 1, 11, 0, 3, 2, 10, -1, 13, 3, 11, 0, 4, 2, 10, 1, 12, 3, 13, -1, 11, 0, 3, 1, 12, -3, 13, -1, 11, 0, 3, 1, 10, 2, 13, 1, 11, 0, 4, 2, 10, 1, 12, 1, 13, 1, 11, 1, 3, 1, 12, -1, 13, -3, 11, 0, 2, 1, 10, 3, 11, 0, 2, 5, 13, -1, 11, 0, 2, 3, 13, 1, 11, 0, 4, 1, 10, 1, 12, 2, 13, 1, 11, 0, 2, 1, 13, 3, 11, 0, 3, 1, 12, 3, 13, 1, 11, 0, 3, 1, 12, 1, 13, 3, 11, 0, 3, 2, 10, -5, 13, -1, 11, 0, 3, 6, 10, -1, 12, -1, 11, 0, 4, 6, 10, -1, 12, -2, 13, 1, 11, 0, 2, 6, 13 | 10, -1, 11, 0, 3, 4, 10, -2, 12, 1, 11, 0, 3, 6, 10, -2, 13, 1, 11, 0, 4, 4, 10, -1, 12, 2, 13, -1, 11, 0, 3, 4, 10, -1, 12, 1, 11, 0, 3, 4, 10, 2, 13, -1, 11, 0, 4, 2, 10, -2, 12, 2, 13, 1, 11, 0, 2, 4, 10, 1, 11, 0, 3, 4, 10, -2, 13, 3, 11, 0, 4, 2, 10, -1, 12, 2, 13, 1, 11, 0, 3, 3, 10, 1, 13, 1, 11, 0, 3, 4, 10, 1, 12, 1, 11, 0, 3, 2, 10, -1, 12, 3, 11, 0, 3, 2, 10, 4, 13, -1, 11, 0, 3, 2, 10, 2, 13, 1, 11, 0, 2, 2, 10, 3, 11, 0, 3, 1, 12, -4, 13, -1, 11, 0, 3, 1, 10, 3, 13, 1, 11, 0, 4, 2, 10, 1, 12, 2, 13, 1, 11, 0, 2, 4, 13, 1, 11, 0, 2, 2, 13, 3, 11, 0, 1, 5, 11, 0, 3, 1, 12, 4, 13, 1, 11, 0, 4, 6, 10, -1, 12, -1, 13, 1, 11, 0, 3, 6, 10, 1, 13, -1, 11, 0, 3, 6, 10, -1, 13, 1, 11, 0, 4, 4, 10, -1, 12, 1, 13, 1, 11, 0, 3, 4, 10, 1, 13, 1, 11, 0, 3, 4, 10, -1, 13, 3, 11, 0, 4, 2, 10, -1, 12, 3, 13, 1, 11, 0, 4, 4, 10, 1, 12, 1, 13, 1, 11, 0, 3, 2, 10, 3, 13, 1, 11, 0, 3, 2, 10, 1, 13, 3, 11, 0, 2, 5, 13, 1, 11, 0, 2, 3, 13, 3, 11, 0, 2, 6, 10, 1, 11, 0, 3, 4, 10, 2, 13, 1, 11, 0, 3, 2, 10, 4, 13, 1, 11, 0, -1] 14 | }; --------------------------------------------------------------------------------