User talk:47.154.74.145

/* Apsidal Precession */ new section
Orbital elements are useless without a function to use them. Here is what you cannot find - as if nobody knows how ...

function SolveKepler(M,ec) { var E = M; var delta, d = E - ec * Math.sin(E) - M; for (var i=0;Math.abs(d) > 0.00000001;i++) { delta = d / (1.0 - ec * Math.cos(E) ); E -= delta; d = E - ec * Math.sin(E) - M; } return E; }

function epoch2day(j) { return j - 2440587.5; ///ctime Stamp }

function skyUpdate(id) {

var e = id.e, n, E, r, v, o, x = [0,0,0]; var ap = id.lp - id.o; var M = (id.ml - id.lp) % PI2; E = SolveKepler(M,e); r = IDS(id.a0) * (1.0 - (e * Math.cos(E))); v = 2.0 * Math.atan(Math.sqrt((1.0 + e) / (1.0 - e)) * Math.tan(E / 2.0)); v = (PI2 + v + ap) % PI2; o = id.o; e = Math.sin(v); v = Math.cos(v); n = Math.sin(o); o = Math.cos(o); M = Math.cos(id.i); x[0] = r * (o * v - (n * e * M)); x[1] = -r * e * Math.sin(id.i); x[2] = r * (n * v + (o * e * M)); x = popmatrix(orbitmatrix,x); return x; }

function orbit(id) {

var M, n, e, E, r, v, o, x = [0,0,0]; M = ctime / 86400000 - id.t; M = (M*dtor(id.dm)+dtor(id.ma)) % PI2; e = id.e; E = SolveKepler(M,e); r = IDS(id.a) * (1.0 - (e * Math.cos(E))); v = 2.0 * Math.atan(Math.sqrt((1.0 + e) / (1.0 - e)) * Math.tan(E / 2.0)); v = (PI2 + v + dtor(id.ap)) % PI2; /// True Anomaly o = dtor(id.o); e = Math.sin(v); v = Math.cos(v); n = Math.sin(o); o = Math.cos(o); M = Math.cos(dtor(id.i)); x[0] = r * (o * v - (n * e * M)); x[1] = -r * e * Math.sin(dtor(id.i)); x[2] = r * (n * v + (o * e * M)); return x; // alert(vlen(x)+ "   "+ IDS(au2km(id.a)) * (1-id.e)); }