4 double mnom, msun, noded, dmoon;
10 double dlong, lsun, psun;
11 double eccm, eccs, chp, cpe;
12 double v0, t0, m0, j0;
13 double arg1, arg2, arg3, arg4, arg5, arg6, arg7;
14 double arg8, arg9, arg10;
15 double dgamma, k5, k6;
16 double lterms, sterms, cterms, nterms, pterms, spterms;
17 double gamma1, gamma2, gamma3, arglat;
22 * the fundamental elements - all referred to the epoch of
23 * Jan 0.5, 1900 and to the mean equinox of date.
26 dlong = 270.434164 + 13.1763965268*eday - .001133*capt2
28 argp = 334.329556 + .1114040803*eday - .010325*capt2
30 node = 259.183275 - .0529539222*eday + .002078*capt2
32 lsun = 279.696678 + .9856473354*eday + .000303*capt2;
33 psun = 281.220833 + .0000470684*eday + .000453*capt2
36 dlong = fmod(dlong, 360.);
37 argp = fmod(argp, 360.);
38 node = fmod(node, 360.);
39 lsun = fmod(lsun, 360.);
40 psun = fmod(psun, 360.);
43 eccs = .01675104 - .00004180*capt;
49 * some subsidiary elements - they are all longitudes
50 * and they are referred to the epoch 1/0.5 1900 and
51 * to the fixed mean equinox of 1850.0.
54 v0 = 342.069128 + 1.6021304820*eday;
55 t0 = 98.998753 + 0.9856091138*eday;
56 m0 = 293.049675 + 0.5240329445*eday;
57 j0 = 237.352319 + 0.0830912295*eday;
60 * the following are periodic corrections to the
61 * fundamental elements and constants.
62 * arg3 is the "Great Venus Inequality".
65 arg1 = 41.1 + 20.2*(capt+.5);
66 arg2 = dlong - argp + 33. + 3.*t0 - 10.*v0 - 2.6*(capt+.5);
67 arg3 = dlong - argp + 151.1 + 16.*t0 - 18.*v0 - (capt+.5);
69 arg5 = node + 276.2 - 2.3*(capt+.5);
70 arg6 = 313.9 + 13.*t0 - 8.*v0;
71 arg7 = dlong - argp + 112.0 + 29.*t0 - 26.*v0;
72 arg8 = dlong + argp - 2.*lsun + 273. + 21.*t0 - 20.*v0;
73 arg9 = node + 290.1 - 0.9*(capt+.5);
74 arg10 = 115. + 38.5*(capt+.5);
94 + 0.126*sin(arg8))/3600.;
101 - 0.593*sin(arg6))/3600.;
108 + 1.86*sin(arg9))/3600.;
112 - 1.89*sin(arg6))/3600.;
116 + 1.89*sin(arg6))/3600.;
118 dgamma = - 4.318*cos(arg4)
126 * the following factors account for the fact that the
127 * eccentricity, solar eccentricity, inclination and
128 * parallax used by Brown to make up his coefficients
129 * are both wrong and out of date. Brown did the same
130 * thing in a different way.
135 k3 = 1. + 2.708e-6 + .000108008*dgamma;
140 * the principal arguments that are used to compute
141 * perturbations are the following differences of the
142 * fundamental elements.
147 noded = dlong - node;
148 dmoon = dlong - lsun;
151 * solar terms in longitude
159 lterms += sinx(mp->f,
161 mp->c[2], mp->c[3], 0.0);
167 * planetary terms in longitude
170 lterms += sinx(0.822, 0,0,0,0, t0-v0);
171 lterms += sinx(0.307, 0,0,0,0, 2.*t0-2.*v0+179.8);
172 lterms += sinx(0.348, 0,0,0,0, 3.*t0-2.*v0+272.9);
173 lterms += sinx(0.176, 0,0,0,0, 4.*t0-3.*v0+271.7);
174 lterms += sinx(0.092, 0,0,0,0, 5.*t0-3.*v0+199.);
175 lterms += sinx(0.129, 1,0,0,0, -t0+v0+180.);
176 lterms += sinx(0.152, 1,0,0,0, t0-v0);
177 lterms += sinx(0.127, 1,0,0,0, 3.*t0-3.*v0+180.);
178 lterms += sinx(0.099, 0,0,0,2, t0-v0);
179 lterms += sinx(0.136, 0,0,0,2, 2.*t0-2.*v0+179.5);
180 lterms += sinx(0.083, -1,0,0,2, -4.*t0+4.*v0+180.);
181 lterms += sinx(0.662, -1,0,0,2, -3.*t0+3.*v0+180.0);
182 lterms += sinx(0.137, -1,0,0,2, -2.*t0+2.*v0);
183 lterms += sinx(0.133, -1,0,0,2, t0-v0);
184 lterms += sinx(0.157, -1,0,0,2, 2.*t0-2.*v0+179.6);
185 lterms += sinx(0.079, -1,0,0,2, -8.*t0+6.*v0+162.6);
186 lterms += sinx(0.073, 2,0,0,-2, 3.*t0-3.*v0+180.);
187 lterms += sinx(0.643, 0,0,0,0, -t0+j0+178.8);
188 lterms += sinx(0.187, 0,0,0,0, -2.*t0+2.*j0+359.6);
189 lterms += sinx(0.087, 0,0,0,0, j0+289.9);
190 lterms += sinx(0.165, 0,0,0,0, -t0+2.*j0+241.5);
191 lterms += sinx(0.144, 1,0,0,0, t0-j0+1.0);
192 lterms += sinx(0.158, 1,0,0,0, -t0+j0+179.0);
193 lterms += sinx(0.190, 1,0,0,0, -2.*t0+2.*j0+180.0);
194 lterms += sinx(0.096, 1,0,0,0, -2.*t0+3.*j0+352.5);
195 lterms += sinx(0.070, 0,0,0,2, 2.*t0-2.*j0+180.);
196 lterms += sinx(0.167, 0,0,0,2, -t0+j0+178.5);
197 lterms += sinx(0.085, 0,0,0,2, -2.*t0+2.*j0+359.2);
198 lterms += sinx(1.137, -1,0,0,2, 2.*t0-2.*j0+180.3);
199 lterms += sinx(0.211, -1,0,0,2, -t0+j0+178.4);
200 lterms += sinx(0.089, -1,0,0,2, -2.*t0+2.*j0+359.2);
201 lterms += sinx(0.436, -1,0,0,2, 2.*t0-3.*j0+7.5);
202 lterms += sinx(0.240, 2,0,0,-2, -2.*t0+2.*j0+179.9);
203 lterms += sinx(0.284, 2,0,0,-2, -2.*t0+3.*j0+172.5);
204 lterms += sinx(0.195, 0,0,0,0, -2.*t0+2.*m0+180.2);
205 lterms += sinx(0.327, 0,0,0,0, -t0+2.*m0+224.4);
206 lterms += sinx(0.093, 0,0,0,0, -2.*t0+4.*m0+244.8);
207 lterms += sinx(0.073, 1,0,0,0, -t0+2.*m0+223.3);
208 lterms += sinx(0.074, 1,0,0,0, t0-2.*m0+306.3);
209 lterms += sinx(0.189, 0,0,0,0, node+180.);
212 * solar terms in latitude
219 sterms += sinx(mp->f,
221 mp->c[2], mp->c[3], 0);
230 cterms += cosx(mp->f,
232 mp->c[2], mp->c[3], 0);
241 nterms += sinx(mp->f,
243 mp->c[2], mp->c[3], 0);
249 * planetary terms in latitude
253 sinx(0.215, 0,0,0,0, dlong);
256 * solar terms in parallax
263 spterms += cosx(mp->f,
265 mp->c[2], mp->c[3], 0);
270 * planetary terms in parallax
276 * computation of longitude
279 lambda = (dlong + lterms/3600.)*radian;
282 * computation of latitude
285 arglat = (noded + sterms/3600.)*radian;
286 gamma1 = 18519.700 * k3;
287 gamma2 = -6.241 * k3*k3*k3;
288 gamma3 = 0.004 * k3*k3*k3*k3*k3;
290 k6 = (gamma1 + cterms) / gamma1;
292 beta = k6 * (gamma1*sin(arglat) + gamma2*sin(3.*arglat)
293 + gamma3*sin(5.*arglat) + nterms)
300 * computation of parallax
303 spterms = k5 * spterms *radsec;
304 hp = spterms + (spterms*spterms*spterms)/6.;
308 semi = .0799 + .272453*(hp/radsec);
314 * change to equatorial coordinates
319 xmp = rp*cos(lambda)*cos(beta);
320 ymp = rp*(sin(lambda)*cos(beta)*cos(obl2) - sin(obl2)*sin(beta));
321 zmp = rp*(sin(lambda)*cos(beta)*sin(obl2) + cos(obl2)*sin(beta));
323 alpha = atan2(ymp, xmp);
324 delta = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
332 sinx(double coef, int i, int j, int k, int m, double angle)
336 x = i*mnom + j*msun + k*noded + m*dmoon + angle;
337 x = coef*sin(x*radian);
357 cosx(double coef, int i, int j, int k, int m, double angle)
361 x = i*mnom + j*msun + k*noded + m*dmoon + angle;
362 x = coef*cos(x*radian);