Module: When::Ephemeris

Includes:
Math
Included in:
Coordinates::Spatial, CelestialObject, Coords, Formula, Hindu::Graha, Moon, Sun
Defined in:
lib/when_exe/ephemeris.rb,
lib/when_exe/ephemeris/sun.rb,
lib/when_exe/region/indian.rb,
lib/when_exe/ephemeris/moon.rb,
lib/when_exe/region/chinese.rb,
lib/when_exe/ephemeris/planets.rb

Overview

天体の位置計算用モジュール

Defined Under Namespace

Modules: V50 Classes: CelestialObject, ChineseTrueLunation, Coords, Datum, Earth, Formula, Hindu, JGD2000, MeanLunation, Moon, Shadow, Star, Sun

Constant Summary collapse

DAY =

日 / 秒

86400.0
BCENT =

ベッセル世紀

36524.2194
JCENT =

ユリウス世紀

36525.0
JYEAR =

ユリウス年

JCENT/100
EPOCH1800 =

1800 I 0.5

2378496.0
EPOCH1900 =

1900 I 1.5

2415021.0
EPOCH1975 =

1975 I 0.0

2442412.5
EPOCH2000 =

2000 I 1.5

2451545.0
DEG =

度 / radian

PI / 180
CIRCLE =

全円周 / radian

2 * PI
AU =

天文単位距離 / km

1.49597870E8
C0 =

光速度 / (km/ユリウス世紀)

299792.458*86400*JCENT
PSEC =

パーセク / AU

360.0*60.0*60.0/(2*PI)
FARAWAY =

遠距離物体のための仮定義

10000.0 * PSEC
LIN =

演算の番号

-1
SIN =
0
COS =
1
SINT =
2
COST =
3
SINL =
4
COSL =
5
SINLT =
6
COSLT =
7
AcS =
8
P3L =

太陽の地心黄経

[[LIN   ,  279.0357964 ,     360.007693787, 3.02500E-8],
[SIN   ,  353.06      ,     719.981008 ,   0.02009 ,-2.98832E-8],
[SIN   ,  248.64      ,     -19.34136  ,  -0.0048  ],
[SIN   ,  285.0       ,     329.6446699,   0.0020  ,+8.0E-9    ],
[SIN   ,  334.2       ,   -4452.671109 ,   0.0018  ,-0.1634E-6 ],

[SIN   ,  293.7       ,      -0.2020   ,   0.00178 ],
[SIN   ,  242.4       ,     450.3688   ,   0.0015  ,+1.4E-9    ],
[SIN   ,  211.1       ,     225.1844   ,   0.0013  ,+0.7E-9    ],
[SIN   ,  208.0       ,     659.2893   ,   0.0008  ,+1.6E-8    ],
[SIN   ,   53.5       ,      90.3783   ,   0.0007  ],

[SIN   ,   12.1       ,     -30.35     ,   0.0007  ],
[SIN   ,  239.1       ,     337.18     ,   0.0006  ],
[SIN   ,   10.1       ,      -1.50     ,   0.0005  ],
[SIN   ,   99.1       ,     -22.81     ,   0.0005  ],
[SIN   ,  264.8       ,     315.56     ,   0.0004  ],

[SIN   ,  233.8       ,     299.30     ,   0.0004  ],
[SIN   ,  198.1       ,     720.02     ,  -0.0004  ],
[SIN   ,  349.6       ,    1079.97     ,   0.0003  ],
[SIN   ,  241.2       ,     -44.43     ,   0.0003  ]]
P3Q =

[SIN , 65.0 , -44.43 , 0.0003 ]], 旧版 太陽の動径の対数

[[COS   ,  356.53      ,     359.990504 ,  -0.007261 ,-1.49416E-8],
[COST  ,  356.53      ,     359.990504 ,   0.0000002,-1.49416E-8],
[COS   ,  353.1       ,     719.981008 ,  -0.000091 ,-2.98832E-8],
[COS   ,  205.8       ,    4452.671109 ,   0.000013 ,-0.1634E-6 ],
[COS   ,   62.0       ,     450.4      ,   0.000007 ,+1.4E-9    ],
[COS   ,  105.0       ,     329.6      ,   0.000007 ,+8.0E-9    ]]
P0dL =

月の地心黄経

[[SIN   ,   93.8       ,      -1.33     ,  0.0040   ],
[SIN   ,  248.6       ,     -19.34     ,  0.0020   ],
[SIN   ,   66.0       ,       0.2      ,  0.0006   ],
[SIN   ,  249.0       ,     -19.3      ,  0.0006   ]]
P0L =
[[LIN   ,  124.8757417 ,  4812.6788201  , -1.330000E-7],
[SINL  ,  338.9158263 ,  4771.9886313  ,  6.2887   ,+8.99400E-7], # 中心差 
[SIN   ,  107.236832  ,   -4133.3536154,  1.2740   ,+1.22612E-6], # 出差
[SIN   ,   51.678963  ,    8905.3422467,  0.6583   ,-0.32672E-6], # 二均差
[SIN   ,  317.831653  ,    9543.9772627,  0.2136   ,+1.7988E-6 ], # 中心差 x 2
[SIN   ,  176.528826  ,     359.990504 ,  0.1856   ,-1.561E-8  ], # 年差

[SIN   ,  292.463     ,    9664.0403505,  0.1143   ,-0.6812E-6 ],
[SIN   ,   86.16      ,     638.63475182, 0.0588   ,+2.1256E-6 ],
[SIN   ,  103.78      ,   -3773.36305278, 0.0572   ,-1.22769E-6],
[SIN   ,   30.58      ,   13677.331    ,  0.0533   ],
[SIN   ,  124.86      ,   -8545.352    ,  0.0459   ],

[SIN   ,  342.38      ,    4411.998    ,  0.0410   ],
[SIN   ,   25.83      ,    4452.671    ,  0.0348   ], # 月角差( 二均差 / 2)
[SIN   ,  155.45      ,    5131.979    ,  0.0305   ],
[SIN   ,  240.79      ,     758.698    ,  0.0153   ],
[SIN   ,  271.38      ,   14436.029    ,  0.0125   ],

[SIN   ,  226.45      ,   -4892.052    ,  0.0110   ],
[SIN   ,   55.58      ,  -13038.696    ,  0.0107   ],
[SIN   ,  296.75      ,   14315.966    ,  0.0100   ],
[SIN   ,   34.5       ,   -8266.71     ,  0.0085   ],
[SIN   ,  290.7       ,   -4493.34     ,  0.0079   ],

[SIN   ,  228.2       ,    9265.33     ,  0.0068   ],
[SIN   ,  133.1       ,     319.32     ,  0.0052   ],
[SIN   ,  202.4       ,    4812.66     ,  0.0050   ],
[SIN   ,   68.6       ,     -19.34     ,  0.0048   ],
[SIN   ,   34.1       ,   13317.34     ,  0.0040   ],

[SIN   ,    9.5       ,   18449.32     ,  0.0040   ],
[SIN   ,   93.8       ,      -1.33     ,  0.0040   ],
[SIN   ,  103.3       ,   17810.68     ,  0.0039   ],
[SIN   ,   65.1       ,    5410.62     ,  0.0037   ],
[SIN   ,  321.3       ,    9183.99     ,  0.0027   ],

[SIN   ,  174.8       ,  -13797.39     ,  0.0026   ],
[SIN   ,   82.7       ,     998.63     ,  0.0024   ],
[SIN   ,    4.7       ,    9224.66     ,  0.0024   ],
[SIN   ,  121.4       ,   -8185.36     ,  0.0022   ],
[SIN   ,  134.4       ,    9903.97     ,  0.0021   ],

[SIN   ,  173.1       ,     719.98     ,  0.0021   ],
[SIN   ,  100.3       ,   -3413.37     ,  0.0021   ],
[SIN   ,  248.6       ,     -19.34     ,  0.0020   ],
[SIN   ,   98.1       ,    4013.29     ,  0.0018   ],
[SIN   ,  344.1       ,   18569.38     ,  0.0016   ],

[SIN   ,   52.1       ,  -12678.71     ,  0.0012   ],
[SIN   ,  250.3       ,   19208.02     ,  0.0011   ],
[SIN   ,   81.0       ,   -8586.0      ,  0.0009   ],
[SIN   ,  207.0       ,   14037.3      ,  0.0008   ],
[SIN   ,   31.0       ,   -7906.7      ,  0.0008   ],

[SIN   ,  346.0       ,    4052.0      ,  0.0007   ],
[SIN   ,  294.0       ,   -4853.3      ,  0.0007   ],
[SIN   ,   90.0       ,     278.6      ,  0.0007   ],
[SIN   ,  237.0       ,    1118.7      ,  0.0006   ],
[SIN   ,   82.0       ,   22582.7      ,  0.0005   ],

[SIN   ,  276.0       ,   19088.0      ,  0.0005   ],
[SIN   ,   73.0       ,  -17450.7      ,  0.0005   ],
[SIN   ,  112.0       ,    5091.3      ,  0.0005   ],
[SIN   ,  116.0       ,    -398.7      ,  0.0004   ],
[SIN   ,   25.0       ,    -120.1      ,  0.0004   ],

[SIN   ,  181.0       ,    9584.7      ,  0.0004   ],
[SIN   ,   18.0       ,     720.0      ,  0.0004   ],
[SIN   ,   60.0       ,   -3814.0      ,  0.0003   ],
[SIN   ,   13.0       ,   -3494.7      ,  0.0003   ],
[SIN   ,   13.0       ,   18089.3      ,  0.0003   ],

[SIN   ,  152.0       ,    5492.0      ,  0.0003   ],
[SIN   ,  317.0       ,     -40.7      ,  0.0003   ],
[SIN   ,  348.0       ,   23221.3      ,  0.0003   ]]
P0dB =

月の地心黄緯

[[SIN   ,   68.64      ,     -19.341    ,  0.0267   ],
[SIN   ,  342.0       ,     -19.36     ,  0.0043   ],
[SIN   ,   93.8       ,      -1.33     ,  0.0040   ],
[SIN   ,  248.6       ,     -19.34     ,  0.0020   ],
[SIN   ,  358.0       ,     -19.4      ,  0.0005   ]]
P0B =
[[SINL  ,  236.231     ,    4832.0201248,  5.1281218,-0.3406E-6 ],
[SIN   ,  215.147     ,    9604.0088   ,  0.2806   ],
[SIN   ,   77.316     ,      60.0316   ,  0.2777   ],
[SIN   ,    4.563     ,   -4073.3220   ,  0.1732   ],
[SIN   ,  308.98      ,    8965.374    ,  0.0554   ],

[SIN   ,  343.48      ,     698.667    ,  0.0463   ],
[SIN   ,  287.90      ,   13737.362    ,  0.0326   ],
[SIN   ,  194.06      ,   14375.997    ,  0.0172   ],
[SIN   ,   25.6       ,   -8845.31     ,  0.0093   ],
[SIN   ,   98.4       ,   -4711.96     ,  0.0088   ],

[SIN   ,    1.1       ,   -3713.33     ,  0.0082   ],
[SIN   ,  322.4       ,    5470.66     ,  0.0043   ],
[SIN   ,  266.8       ,   18509.35     ,  0.0042   ],
[SIN   ,  188.0       ,   -4433.31     ,  0.0034   ],
[SIN   ,  312.5       ,    8605.38     ,  0.0025   ],

[SIN   ,  291.4       ,   13377.37     ,  0.0022   ],
[SIN   ,  340.0       ,    1058.66     ,  0.0021   ],
[SIN   ,  218.6       ,    9244.02     ,  0.0019   ],
[SIN   ,  291.8       ,   -8206.68     ,  0.0018   ],
[SIN   ,   52.8       ,    5192.01     ,  0.0018   ],

[SIN   ,  168.7       ,   14496.06     ,  0.0017   ],
[SIN   ,   73.8       ,     420.02     ,  0.0016   ],
[SIN   ,  262.1       ,    9284.69     ,  0.0015   ],
[SIN   ,   31.7       ,    9964.00     ,  0.0015   ],
[SIN   ,  260.8       ,    -299.96     ,  0.0014   ],

[SIN   ,  239.7       ,    4472.03     ,  0.0013   ],
[SIN   ,   30.4       ,     379.35     ,  0.0013   ],
[SIN   ,  304.9       ,    4812.68     ,  0.0012   ],
[SIN   ,   12.4       ,   -4851.36     ,  0.0012   ],
[SIN   ,  173.0       ,   19147.99     ,  0.0011   ],

[SIN   ,  312.9       ,  -12978.66     ,  0.0010   ],
[SIN   ,    1.0       ,   17870.7      ,  0.0008   ],
[SIN   ,  190.0       ,    9724.1      ,  0.0008   ],
[SIN   ,   22.0       ,   13098.7      ,  0.0007   ],
[SIN   ,  117.0       ,    5590.7      ,  0.0006   ],

[SIN   ,   47.0       ,  -13617.3      ,  0.0006   ],
[SIN   ,   22.0       ,   -8485.3      ,  0.0005   ],
[SIN   ,  150.0       ,    4193.4      ,  0.0005   ],
[SIN   ,  119.0       ,   -9483.9      ,  0.0004   ],
[SIN   ,  246.0       ,   23281.3      ,  0.0004   ],

[SIN   ,  301.0       ,   10242.6      ,  0.0004   ],
[SIN   ,  126.0       ,    9325.4      ,  0.0004   ],
[SIN   ,  104.0       ,   14097.4      ,  0.0004   ],
[SIN   ,  340.0       ,   22642.7      ,  0.0003   ],
[SIN   ,  270.0       ,   18149.4      ,  0.0003   ],

[SIN   ,  358.0       ,   -3353.3      ,  0.0003   ],
[SIN   ,  148.0       ,   19268.0      ,  0.0003   ]]
P0P =

月の視差

[[COS   ,  338.92      ,    4771.98849108, 0.0518   ,+9.19178E-7],
[COS   ,  287.2       ,   -4133.35355678, 0.0095   ,+1.2262E-6 ],
[COS   ,   51.7       ,    8905.34223034, 0.0078   ,-0.3268E-6 ],
[COS   ,  317.8       ,    9543.97698216, 0.0028   ,+1.7988E-6 ],
[COS   ,   31.0       ,   13677.3      ,  0.0009   ],

[COS   ,  305.0       ,   -8545.4      ,  0.0005   ],
[COS   ,  284.0       ,   -3773.4      ,  0.0004   ],
[COS   ,  342.0       ,    4412.0      ,  0.0003   ]]
P1L =

水星の日心黄経

[[LIN   ,  252.2502    ,  149474.0714   ,  0.0003   ],
[COS   ,   84.7947    ,  149472.5153   , 23.4405   ],
[COST  ,   84.7947    ,  149472.5153   ,  0.0023   ],
[COS   ,  259.589     ,  298945.031    ,  2.9818   ],
[COST  ,  259.589     ,  298945.031    ,  0.0006   ],
[COS   ,   74.38      ,  448417.55     ,  0.5258   ],
[COS   ,  137.84      ,  298945.77     ,  0.1796   ],
[COS   ,  249.2       ,  597890.1      ,  0.1061   ],
[COS   ,  143.0       ,  149473.3      ,  0.085    ],
[COS   ,  312.6       ,  448418.3      ,  0.076    ],
[COS   ,  127.4       ,  597890.8      ,  0.0256   ],
[COS   ,   64.0       ,  747362.6      ,  0.023    ],
[COS   ,  302.0       ,  747363.0      ,  0.0081   ],
[COS   ,  148.0       ,       1.0      ,  0.0069   ],
[COS   ,  239.0       ,  896835.0      ,  0.0052   ],
[COS   ,  117.0       ,  896836.0      ,  0.0023   ],
[COS   ,   85.0       ,    6356.0      ,  0.0019   ],
[COS   ,   54.0       , 1046308.0      ,  0.0011   ],
[COS   ,  234.0       ,   32437.0      ,  0.001    ],
[COS   ,  171.0       ,  143403.0      ,  0.0009   ],
[COS   ,  268.0       ,  155828.0      ,  0.0006   ],
[COS   ,  292.0       , 1046308.0      ,  0.0005   ],
[COS   ,   84.0       ,  143117.0      ,  0.0004   ],
[COS   ,   63.0       ,  181909.0      ,  0.0003   ],
[COS   ,  288.0       ,  123392.0      ,  0.0003   ],
[COS   ,   11.0       ,  448419.0      ,  0.0003   ]]
P1B =

水星の日心黄緯

[[COS   ,  113.919     ,  149472.886    ,  6.7057   ],
[COST  ,  113.919     ,  149472.886    ,  0.0017   ],
[COS   ,  119.12      ,       0.37     ,  1.4396   ],
[COST  ,  119.12      ,       0.37     ,  0.0005   ],
[COS   ,  288.71      ,  298945.4      ,  1.3643   ],
[COST  ,  288.71      ,  298945.4      ,  0.0005   ],
[COS   ,  103.51      ,  448417.92     ,  0.3123   ],
[COS   ,  278.3       ,  597890.4      ,  0.0753   ],
[COS   ,   55.7       ,  149472.1      ,  0.0367   ],
[COS   ,   93.1       ,  747362.9      ,  0.0187   ],
[COS   ,  230.0       ,  298945.0      ,  0.005    ],
[COS   ,  268.0       ,  896835.0      ,  0.0047   ],
[COS   ,  342.0       ,  448419.0      ,  0.0028   ],
[COS   ,  347.0       ,  298946.0      ,  0.0023   ],
[COS   ,  157.0       ,  597891.0      ,  0.002    ],
[COS   ,   83.0       , 1046308.0      ,  0.0012   ],
[COS   ,  331.0       ,  747364.0      ,  0.0009   ],
[COS   ,   45.0       ,  448417.0      ,  0.0009   ],
[COS   ,  352.0       ,  149474.0      ,  0.0005   ],
[COS   ,  146.0       ,  896836.0      ,  0.0003   ]]
P1R =

水星の動径

[[LIN   ,    0.395283  ,       0.000002 ,  0.0      ],
[COS   ,  354.795     ,  149472.515    ,  0.078341 ],
[COST  ,  354.795     ,  149472.515    ,  0.000008 ],
[COS   ,  169.59      ,  298945.03     ,  0.007955 ],
[COST  ,  169.59      ,  298945.03     ,  0.000002 ],
[COS   ,  344.38      ,  448417.55     ,  0.001214 ],
[COS   ,  159.2       ,  597890.0      ,  0.000218 ],
[COS   ,  334.0       ,  747363.0      ,  0.000042 ],
[COS   ,  149.0       ,  896835.0      ,  0.000006 ]]
P2L =

金星の日心黄経

[[LIN   , 310.1735     ,    +585.19212  ,  3E-8     ],
[SINL  , 107.44       ,   +1170.37     , -0.0503   ],
[SIN   , 248.6        ,     -19.34     , -0.0048   ],
[SIN   , 198          ,    +720.0      , -0.0004   ]]
P2dL =

金星の日心黄経の補正

[[SIN   , 178.954      ,    +585.1781011,  0.7775   ,+1.38E-7   ],
[SINT  , 178.954      ,    +585.1781011, -0.00005  ,+1.38E-7   ],
[SIN   , 357.9        ,   +1170.35     , +0.0033   ],
[SIN   , 242.3        ,    +450.37     , +0.0031   ],
[SIN   , 273.5        ,    +675.55     , +0.0020   ],
[SIN   ,  31.1        ,    +225.18     , +0.0014   ],
[SIN   , 233.1        ,     +90.38     , +0.0010   ],
[SIN   , 350          ,      +1.5      , +0.0008   ],
[SIN   , 136          ,    +554.8      , +0.0008   ],
[SIN   , 295          ,    +540.7      , +0.0004   ],
[SIN   ,  61          ,     -44.4      , +0.0004   ],
[SIN   ,  17          ,     -30.3      , +0.0004   ],
[SIN   , 125          ,    +900.7      , +0.0003   ],
[SIN   ,  44          ,     +11.0      , +0.0003   ]]
P2B =

金星の日心黄緯

[[SINL  , 233.72       ,    +585.183    , +0.05922  ]]
P2Q =

金星の動径の対数

[[LIN   ,  -0.140658   ,       0.0      ,  0.0      ],
[COS   , 178.954      ,    +585.178    , -0.002931 ],
[COS   , 357.9        ,   +1170.35     , -0.000015 ],
[COS   ,  62.3        ,    +450.37     , +0.000010 ],
[COS   ,  93          ,    +675.6      , +0.000008 ]]
P4L =

火星の日心黄経

[[LIN   , 249.3542     ,    +191.4169632,  3.11E-8  ],
[SINL  ,  40.01       ,    +382.8184846, -0.0149   ,6.22E-8],
[SIN   , 248.6        ,     -19.34136  , -0.00478  ],
[SIN   , 198          ,    +720.01539  , -0.00037  ]]
P4dL =

火星の日心黄経の補正

[[SIN   , 273.768      ,    +191.39855  ,+10.6886   ,1.76E-8   ],
[SINT  , 273.768      ,    +191.39855  , +0.00010  ,1.76E-8   ],
[SIN   , 187.54       ,    +382.79710  , +0.6225   ,3.52E-8   ],
[SIN   , 101.31       ,    +574.19566  , +0.0503   ,5.28E-8   ],
[SIN   ,  62.31       ,      +0.198    , +0.0146   ],
[SIN   ,  71.8        ,    +161.05     , +0.0071   ,10E-8     ],
[SIN   , 230.2        ,    +130.71     , +0.0061   ,18E-8     ],
[SIN   ,  15.1        ,    +765.5942   , +0.0046   , 8E-8     ],
[SIN   , 147.5        ,    +322.11     , +0.0045   ],
[SIN   , 279.3        ,     -22.81     , +0.0039   ],
[SIN   , 207.7        ,    +168.59     , +0.0024   ],
[SIN   , 140.1        ,    +145.78     , +0.0020   ],
[SIN   , 224.7        ,     +10.98     , +0.0018   ],
[SIN   , 221.8        ,     -45.62     , +0.0014   ],
[SIN   ,  91.4        ,     -30.34     , +0.0010   ],
[SIN   , 268          ,    +100.4      , +0.0009   ],
[SIN   , 343          ,     352.5      , +0.0009   ],
[SIN   ,  71          ,    +123.0      , +0.0007   ],
[SIN   , 203          ,    +291.8      , +0.0007   ],
[SIN   ,  62          ,    +513.5      , +0.0006   ],
[SIN   , 289          ,    +957.0      , +0.0005   ],
[SIN   ,  13          ,    +167.0      , +0.0005   ],
[SIN   , 318          ,     -60.7      , +0.0004   ],
[SIN   , 318          ,    +179.2      , +0.0004   ],
[SIN   ,  85          ,      +8.9      , +0.0004   ],
[SIN   ,  57          ,    +483.2      , +0.0004   ],
[SIN   ,   7          ,    -214.2      , +0.0004   ],
[SIN   ,   1          ,    +100.2      , +0.0003   ]]
P4B =

火星の日心黄緯

[[SINL  , 200.00       ,    +191.4092423,  0.03227  , 2.949E-8  ],
[SINLT , 200.00       ,    +191.4092423, -1.06029E-7,2.949E-8  ]]
P4Q =

火星の動径の対数

[[LIN   ,  +0.183844   ,       0.0      ,  0.0      ],
[COS   , 273.768      ,    +191.39855  , -0.040421 ,1.76E-8   ],
[COS   , 187.54       ,    +382.79710  , -0.002825 ,3.52E-8   ],
[COS   , 101.31       ,    +574.19566  , -0.000249 ,5.28E-8   ],
[COS   ,  15.1        ,    +765.5942   , -0.000024 ,7.04E-8   ],
[COS   , 251.7        ,    +161.05     , +0.000023 ],
[COS   , 327.6        ,    +322.11     , +0.000022 ],
[COS   ,  50.2        ,    +130.71     , +0.000017 ],
[COS   ,  27          ,    +168.6      , +0.000007 ],
[COS   , 320          ,    +145.8      , +0.000006 ]]
P5L =

木星の日心平均黄経

[[LIN   , 355.1734     ,     +30.36303  ,  2.24E-8  ]]
P5dL =

木星の日心黄経の補正

[[LIN   , 341.5208     ,     +30.3490575,  2.24E-8  ],
[LIN   ,  +0.0004     ,       0.0      ,  0.0      ],
[SIN   , 245.94       ,     -30.3490575, +0.0350   ,-2.24E-8   ],
[SINT  , 245.94       ,     -30.3490575, +0.00028  ,-2.24E-8   ],
[SIN   , 162.78       ,      +0.38394  , -0.0019   ],
[SINT  , 162.78       ,      +0.38394  , -0.000015 ],
[SIN   , 162.78       ,      +0.38394  , +0.3323   ],
[SIN   ,  38.46       ,     -36.25584  , +0.0541   ,+5.92E-8   ],
[SIN   , 293.42       ,     -29.94148  , +0.0447   ,+1.93E-7   ],
[SIN   ,  44.50       ,      -5.90678  , +0.0342   ,+8.15E-8   ],
[SIN   , 201.25       ,     -24.03470  , +0.0230   ,+1.11E-7   ],
[SIN   , 109.99       ,     -18.12792  , +0.0222   ,+2.96E-8   ],
[SIN   , 248.6        ,     -19.34     , -0.0048   ],
[SIN   , 184.6        ,     -11.81     , +0.0047   ],
[SIN   , 150.1        ,     -54.38     , +0.0045   ],
[SIN   , 130.7        ,     -42.16     , +0.0042   ],
[SIN   ,   7.6        ,      +6.31     , +0.0039   ],
[SIN   , 163.2        ,     +12.22     , +0.0031   ],
[SIN   , 145.6        ,      +0.77     , +0.0031   ],
[SIN   , 191.3        ,      -0.23     , +0.0024   ],
[SIN   , 148.4        ,     +24.44     , +0.0019   ],
[SIN   , 197.9        ,     -29.941    , +0.0017   ],
[SIN   , 307.9        ,     +36.66     , +0.0010   ],
[SIN   , 227.5        ,     -72.51     , +0.0010   ],
[SIN   , 269.0        ,     -60.29     , +0.0010   ],
[SIN   , 278.7        ,     -29.53     , +0.0010   ],
[SIN   ,  52          ,     -66.6      , +0.0008   ],
[SIN   ,  24          ,     -35.8      , +0.0008   ],
[SIN   , 356          ,      -5.5      , +0.0005   ],
[SIN   , 186          ,     -23.6      , +0.0005   ],
[SIN   , 344          ,      -5.9      , +0.0004   ],
[SIN   , 222          ,     -48.1      , +0.0004   ],
[SIN   , 198          ,    +720.0      , -0.0004   ],
[SIN   , 140          ,     -48.5      , +0.0004   ],
[SIN   , 104          ,     -24.0      , +0.0004   ],
[SIN   , 317          ,     -30.3      , +0.0003   ],
[SIN   , 280          ,     -17.7      , +0.0003   ],
[SIN   , 262          ,     -60.7      , +0.0003   ],
[SIN   , 211          ,     -26.1      , +0.0003   ],
[SIN   , 209          ,     +42.6      , +0.0003   ],
[SIN   ,   1          ,     -90.6      , +0.0003   ]]
P5B =

木星の日心黄緯

[[SIN   , 291.9        ,     -29.94     , +0.0010   ],
[SIN   , 196          ,     -24.0      , +0.0003   ]]
P5Q =

木星の動径の対数

[[COS   , 245.93       ,     -30.3490575,  0.000132 ,-2.24E-8   ],
[COST  , 245.93       ,     -30.3490575, +0.0000011,-2.24E-8   ],
[COS   ,  38.47       ,     -36.25584  , +0.000230 ,+5.92E-8   ],
[COS   , 293.36       ,     -29.94148  , -0.000168 ,+1.93E-7   ],
[COS   , 200.5        ,     -24.03470  , +0.000074 ,+1.11E-7   ],
[COS   , 110.0        ,     -18.12792  , +0.000055 ,+2.96E-8   ],
[COS   ,  39.3        ,      -5.90678  , +0.000038 ,+8.15E-8   ],
[COS   , 150.9        ,     -54.33     , +0.000024 ],
[COS   , 336.4        ,      +0.41     , +0.000023 ],
[COS   , 131.7        ,     -42.16     , +0.000019 ],
[COS   , 180          ,     -11.8      , +0.000009 ],
[COS   , 277          ,     -60.3      , +0.000007 ],
[COS   , 330          ,     +24.4      , +0.000006 ],
[COS   ,  53          ,     -66.6      , +0.000006 ],
[COS   , 188          ,      +6.3      , +0.000006 ],
[COS   , 251          ,     -72.5      , +0.000006 ],
[COS   , 198          ,     -29.9      , +0.000006 ],
[COS   , 353.5        ,     +12.22     , +0.000005 ]]
P5n =

木星への土星からの摂動項

[+5.5280,     +0.1666, +0.0079, +0.0003]
P5l =
[+0.0075,     +5.94,  +13.6526, +0.01396925]
P5t =
[+0.022889, +272.975,  +0.0128, +0.00010,  +35.52]
P5r =
[+5.190688,   +0.048254]
P6L =

土星の日心平均黄経

[[LIN   , 104.1602     ,     +12.2351075,  5.195E-8 ]]
P6dL =

土星の日心黄経の補正

[[LIN   ,  12.3042     ,     +12.2211383,  5.195E-8 ],
[LIN   ,  +0.0008     ,       0.0      ,  0.0      ],
[SIN   , 250.29       ,     +12.2211383, +0.0934   ,5.195E-8  ],
[SINT  , 250.29       ,     +12.2211383, +0.00075  ,5.195E-8  ],
[SIN   , 265.8        ,     -11.8135619, +0.0057   ,1.631E-7  ],
[SINT  , 265.8        ,     -11.8135619, +0.00005  ,1.631E-7  ],
[SIN   , 162.7        ,      +0.38394  , +0.0049   ],
[SINT  , 162.7        ,      +0.38394  , +0.00004  ],
[SIN   , 262.0        ,     +24.44     , +0.0019   ],
[SINT  , 262.0        ,     +24.44     , +0.00002  ],
[SIN   , 342.74       ,      +0.38394  , +0.8081   ],
[SIN   ,   3.57       ,     -11.8135619, +0.1900   ,+1.63E-7   ],
[SIN   , 224.52       ,      -5.9067809, +0.1173   ,+8.153E-8  ],
[SIN   , 176.6        ,      +6.31     , +0.0093   ],
[SIN   , 218.5        ,     -36.26     , +0.0089   ],
[SIN   ,  10.4        ,      -0.23     , +0.0080   ],
[SIN   ,  56.8        ,      +0.63     , +0.0078   ],
[SIN   , 325.4        ,      +0.77     , +0.0074   ],
[SIN   , 209.4        ,     -24.03     , +0.0073   ],
[SIN   , 202.0        ,     -11.59     , +0.0064   ],
[SIN   , 248.6        ,     -19.34     , -0.0048   ],
[SIN   , 105.2        ,     -30.35     , +0.0034   ],
[SIN   ,  23.6        ,     -15.87     , +0.0034   ],
[SIN   , 348.4        ,     -11.41     , +0.0025   ],
[SIN   , 102.5        ,      -7.94     , +0.0022   ],
[SIN   ,  53.5        ,      -3.65     , +0.0021   ],
[SIN   , 220.4        ,     -18.13     , +0.0020   ],
[SIN   , 326.7        ,     -54.38     , +0.0018   ],
[SIN   , 173.0        ,      -5.50     , +0.0017   ],
[SIN   , 165.5        ,      -5.91     , +0.0014   ],
[SIN   , 307.9        ,     -42.16     , +0.0013   ],
[SIN   , 292          ,     -29.9      , +0.0009   ],
[SIN   , 287          ,     -17.7      , +0.0009   ],
[SIN   , 299          ,     -48.5      , +0.0008   ],
[SIN   , 146          ,     +24.4      , +0.0007   ],
[SIN   , 155          ,     +12.2      , +0.0007   ],
[SIN   , 123          ,     +12.6      , +0.0007   ],
[SIN   , 199.7        ,     -12.4      , +0.0005   ],
[SIN   , 146          ,     -10.0      , +0.0005   ],
[SIN   ,   6          ,     +12.6      , +0.0005   ],
[SIN   ,  75          ,     -72.5      , +0.0005   ],
[SIN   ,  57          ,     -60.3      , +0.0004   ],
[SIN   , 137          ,     -23.8      , +0.0004   ],
[SIN   , 187          ,     -23.6      , +0.0004   ],
[SIN   , 198          ,    +720.0      , -0.0004   ],
[SIN   , 255          ,      -0.2      , +0.0003   ],
[SIN   , 202          ,      -7.3      , +0.0003   ],
[SIN   , 182          ,      +4.3      , +0.0003   ],
[SIN   , 122          ,      -7.9      , +0.0003   ],
[SIN   ,  87          ,      +6.3      , +0.0003   ],
[SIN   , 116          ,     -24.0      , +0.0003   ],
[SIN   , 111          ,     -20.1      , +0.0003   ]]
P6B =

土星の日心黄緯

[[SIN   ,   3.9        ,     -11.81     , +0.0024   ],
[SIN   , 269          ,      -5.9      , +0.0008   ],
[SIN   , 135          ,     -30.3      , +0.0005   ]]
P6Q =

土星の動径の対数

[[LIN   ,  +0.000183   ,       0.0      ,  0.0      ],
[COS   ,  70.28       ,     +12.2211383,  0.000354 ,5.195E-8  ],
[COST  ,  70.28       ,     +12.2211383, +0.0000028,5.195E-8  ],
[COS   , 265.8        ,     -11.8135619, +0.000021 ,1.631E-7  ],
[COST  , 265.8        ,     -11.8135619, +0.0000002,1.631E-7  ],
[COS   ,   3.43       ,     -11.8135619, +0.000701 ,1.631E-7  ],
[COS   , 110.54       ,     -18.1279192, +0.000378 ,2.958E-8  ],
[COS   , 219.13       ,      -5.9067809, +0.000244 ,+8.153E-7 ],
[COS   , 158.22       ,      +0.38394  , +0.000114 ],
[COS   , 218.1        ,     -36.26     , +0.000064 ],
[COS   , 215.8        ,     -24.03     , +0.000042 ],
[COS   , 201.8        ,     -11.59     , +0.000024 ],
[COS   ,   1.3        ,      +6.31     , +0.000024 ],
[COS   , 307.7        ,     +12.22     , +0.000019 ],
[COS   , 326.3        ,     -54.38     , +0.000015 ],
[COS   , 311.1        ,     -42.16     , +0.000010 ],
[COS   ,  83.2        ,     +24.44     , +0.000010 ],
[COS   , 348          ,     -11.4      , +0.000009 ],
[COS   , 129          ,     -30.3      , +0.000008 ],
[COS   , 295          ,     -29.9      , +0.000006 ],
[COS   , 148          ,     -48.5      , +0.000006 ],
[COS   , 103          ,      -7.9      , +0.000006 ],
[COS   , 318          ,     +24.4      , +0.000005 ],
[COS   ,  24          ,     -15.9      , +0.000005 ]]
P6n =

土星への木星からの摂動項

[+6.4215,     +0.2248, +0.0109, +0.0006]
P6l =
[+0.0272,   +135.53,  +91.8560, +0.01396925]
P6t =
[+0.043519, +337.763,  +0.0286, +0.00023,  +77.06]
P6r =
[+9.508863,   +0.056061]
P7L =

天王星の日心黄経

[[LIN   ,  313.33676   ,     428.7288   ,  0.0003   ],
[COS   ,   48.8503    ,     460.61987  ,  5.35857  ],
[COST  ,  114.0274    ,     705.15539  ,  3.20671  ],
[COST  ,  317.7651    ,     597.77389  ,  2.69325  ],
[COS   ,  188.3245    ,     919.0429   ,  0.58964  ],
[COS   ,  354.5935    ,    1065.1192   ,  0.12397  ],
[COS   ,  351.028     ,    2608.702    ,  0.01475  ],
[COS   ,  247.7       ,    1968.3      ,  0.0009   ],
[COS   ,   10.4       ,    5647.4      ,  0.00036  ],
[COS   ,  183.6       ,    2356.6      ,  0.00017  ],
[COS   ,  321.9       ,    2873.2      ,  0.00017  ],
[COS   ,  313.4       ,    3798.6      ,  0.00015  ],
[COS   ,  308.1       ,    3157.9      ,  0.00014  ]]
P7B =

天王星の日心黄緯

[[COST  ,  188.32394   ,     507.52281  ,  1.78488  ],
[COS   ,  128.15303   ,     419.91739  ,  1.15483  ],
[COS   ,  273.6644    ,     652.9504   ,  0.67756  ],
[COST  ,  354.9571    ,     892.2869   ,  0.56518  ],
[COS   ,   83.3517    ,     998.0302   ,  0.1349   ],
[LIN   ,   -0.02997   ,       0.0      ,  0.0      ],
[COST  ,  263.0       ,    1526.5      ,  0.00036  ],
[COS   ,  194.2       ,    3030.9      ,  0.00025  ]]
P7R =

天王星の動径

[[LIN   ,   19.203034  ,       0.0      ,  0.0      ],
[COS   ,  320.313     ,     408.729    ,  0.90579  ],
[COST  ,   19.879     ,     440.702    ,  0.361949 ],
[COST  ,  307.419     ,     702.024    ,  0.166685 ],
[COS   ,   67.99      ,     799.95     ,  0.06271  ],
[LIN   ,    0.0       ,       0.042617 ,  0.0      ],
[COS   ,   80.4       ,    2613.7      ,  0.004897 ],
[COS   ,  202.0       ,    1527.0      ,  0.000656 ],
[COS   ,  321.0       ,    2120.0      ,  0.000223 ],
[COS   ,   37.0       ,    3104.0      ,  0.000205 ],
[COS   ,  100.0       ,    5652.0      ,  0.00012  ]]
P8L =

海王星の日心黄経

[[LIN   ,  -55.13323   ,     219.93503  ,  0.0003   ],
[COS   ,  167.7269    ,     221.3904   ,  0.9745   ],
[COST  ,  332.797     ,     684.128    ,  0.04403  ],
[COST  ,  342.114     ,     904.371    ,  0.02928  ],
[COS   ,   50.826     ,     986.281    ,  0.01344  ],
[COS   ,    0.09      ,    2815.89     ,  0.00945  ],
[COS   ,  309.35      ,    2266.5      ,  0.00235  ],
[COS   ,  127.61      ,    2279.43     ,  0.00225  ],
[COS   ,   19.2       ,    5851.6      ,  0.00023  ]]
P8B =

海王星の日心黄緯

[[COS   ,   83.11018   ,     218.87906  ,  1.76958  ],
[LIN   ,    0.01725   ,       0.0      ,  0.0      ],
[COS   ,  338.864     ,     447.128    ,  0.01366  ],
[COS   ,  224.7       ,    1107.1      ,  0.00015  ],
[COS   ,  187.5       ,    2596.7      ,  0.00015  ],
[COS   ,  243.9       ,    3035.0      ,  0.00012  ]]
P8R =

海王星の動径

[[LIN   ,   30.073033  ,       0.0      ,  0.0      ],
[COS   ,   79.994     ,     222.371    ,  0.260457 ],
[COST  ,  195.7       ,     515.2      ,  0.009784 ],
[COS   ,   90.1       ,    2815.4      ,  0.004944 ],
[COS   ,  308.1       ,     524.0      ,  0.003364 ],
[COS   ,  104.0       ,    1025.1      ,  0.002579 ],
[COS   ,  111.0       ,    5845.0      ,  0.00012  ]]
P9L =

冥王星の日心黄経

[[LIN   ,  241.82574   ,     179.09519  , -0.0091   ],
[COS   ,  298.348019  ,     246.556453 , 15.81087  ],
[COS   ,  351.67676   ,     551.3471   ,  1.18379  ],
[COS   ,   41.989     ,     941.622    ,  0.07886  ],
[COS   ,   60.35      ,    2836.46     ,  0.00861  ],
[COS   ,  112.91      ,    1306.75     ,  0.0059   ],
[COS   ,   19.01      ,    2488.14     ,  0.00145  ],
[COS   ,   77.9       ,    5861.8      ,  0.00022  ],
[COS   ,  293.0       ,    3288.8      ,  0.00013  ]]
P9B =

冥王星の日心黄緯

[[COS   ,   42.574982  ,     172.554318 , 17.0455   ],
[COS   ,   66.1535    ,     415.6063   ,  2.4531   ],
[LIN   ,   -2.30285   ,       0.0      ,  0.0      ],
[COS   ,  105.084     ,     713.1227   ,  0.26775  ],
[COS   ,  146.66      ,    1089.202    ,  0.01855  ],
[COS   ,  293.06      ,    2658.22     ,  0.00119  ],
[COS   ,   18.8       ,    3055.6      ,  0.00098  ],
[COS   ,  213.7       ,    1532.6      ,  0.0009   ],
[COS   ,  254.2       ,    2342.3      ,  0.00042  ]]
P9R =

冥王星の動径

[[LIN   ,   38.662489  ,       0.0      ,  0.0      ],
[COS   ,  198.4973    ,     181.3383   ,  8.670489 ],
[COS   ,  228.717     ,     475.963    ,  0.333884 ],
[COS   ,  252.9       ,     909.8      ,  0.008426 ],
[COST  ,   31.0       ,    1425.9      ,  0.007619 ],
[COS   ,  149.4       ,    2831.6      ,  0.004902 ],
[COST  ,  199.5       ,    2196.1      ,  0.002543 ],
[COS   ,  114.1       ,    1748.0      ,  0.001188 ],
[COS   ,   15.0       ,    3188.0      ,  0.00039  ],
[COS   ,  169.0       ,    5860.0      ,  0.000116 ]]
Mercury =

水星

Datum::Far.new(   2440.0,  0.00347  ,  1.16, {:phi=>P1L, :theta=>P1B,  :radius=>P1R})
Venus =

金星

Datum::Near.new(  5988.0,  0.00484  , -4.00, {:phi=>P2L, :dl=>P2dL, :theta=>P2B, :radius=>P2Q})
Mars =

火星

Datum::Near.new(  3397.0,  0.00700  , -1.30, {:phi=>P4L, :dl=>P4dL, :theta=>P4B, :radius=>P4Q})
Jupiter =

木星

Datum::Big.new(  71398.0,  0.01298  , -8.93, {:phi=>P5L, :nn=>P5dL, :theta=>P5B, :radius=>P5Q,
:jsn=>P5n, :jsl=>P5l, :jst=>P5t, :jsr=>P5r})
Saturn =

土星

Datum::Big.new(  60330.0,  0.01756  , -8.68, {:phi=>P6L, :nn=>P6dL, :theta=>P6B, :radius=>P6Q,
:jsn=>P6n, :jsl=>P6l, :jst=>P6t, :jsr=>P6r})
Uranus =

天王星

Datum::Far.new(  25400.0,  0.02490  , -6.85, 2433283, 2473460, {:phi=>P7L, :theta=>P7B, :radius=>P7R})
Neptune =

海王星

Datum::Far.new(  24300.0,  0.03121  , -7.05, 2433283, 2473460, {:phi=>P8L, :theta=>P8B, :radius=>P8R})
Pluto =

冥王星

Datum::Far.new(   1180.0,  0.03461  , -1.00, 2433283, 2473460, {:phi=>P9L, :theta=>P9B, :radius=>P9R})

Class Method Summary collapse

Class Method Details

._adjust(y1, y0, delta) ⇒ Object

y が周期量である場合の周期の補正



347
348
349
# File 'lib/when_exe/ephemeris.rb', line 347

def _adjust(y1, y0, delta)
  (-2..+2).to_a.map {|i| y1 + i * delta}.sort_by {|y| (y-y0).abs}[0]
end

._rot(x, y, t) ⇒ Array<Numeric>

回転(2次元)

Parameters:

Returns:



217
218
219
220
# File 'lib/when_exe/ephemeris.rb', line 217

def _rot(x, y, t)
  c, s = cosc(t), sinc(t)
  return [x*c - y*s, x*s + y*c]
end

._to_p2(x, y) ⇒ Array<Numeric>

直交座標→極座標(2次元)

Parameters:

Returns:

  • (Array<Numeric>)

    ( phi, radius )

    phi - 経度 / CIRCLE
    radius - 距離


201
202
203
204
# File 'lib/when_exe/ephemeris.rb', line 201

def _to_p2(x, y)
  return [0.0, 0.0] if x==0 && y==0
  return [atan2(y,x)/CIRCLE, sqrt(x*x+y*y)]
end

._to_p3(x, y, z) ⇒ Array<Numeric>

直交座標→極座標(3次元)

Parameters:

Returns:

  • (Array<Numeric>)

    ( phi, theta, radius )

    phi - 経度 / CIRCLE
    theta - 緯度 / CIRCLE
    radius - 距離


185
186
187
188
189
# File 'lib/when_exe/ephemeris.rb', line 185

def _to_p3(x, y, z)
  phi, radius = _to_p2(x,  y)
  theta, radius = _to_p2(radius, z)
  return [phi, theta, radius]
end

._to_r3(phi, theta, radius) ⇒ Array<Numeric>

極座標→直交座標(3次元)

Parameters:

Returns:

  • (Array<Numeric>)

    ( x, y, z )

    x - x 座標
    y - y 座標
    z - z 座標


168
169
170
171
# File 'lib/when_exe/ephemeris.rb', line 168

def _to_r3(phi, theta, radius)
  c, s = cosc(theta), sinc(theta)
  return [radius*c*cosc(phi), radius*c*sinc(phi), radius*s]
end

.acos(x) ⇒ Numeric

arc cos / radian

Parameters:

Returns:



110
111
112
# File 'lib/when_exe/ephemeris.rb', line 110

def acos(x)
  atan2(sqrt(1-x*x), x)
end

.asin(x) ⇒ Numeric

arc sin / radian

Parameters:

Returns:



103
104
105
# File 'lib/when_exe/ephemeris.rb', line 103

def asin(x)
  atan2(x, sqrt(1-x*x))
end

.cosc(x) ⇒ Numeric

円周単位のcos

Parameters:

Returns:



138
139
140
# File 'lib/when_exe/ephemeris.rb', line 138

def cosc(x)
  cos(x * CIRCLE)
end

.cosd(x) ⇒ Numeric

度のcos

Parameters:

Returns:



117
118
119
# File 'lib/when_exe/ephemeris.rb', line 117

def cosd(x)
  cos(x * DEG)
end

.delta_e(c) ⇒ Numeric Also known as: deltaE

Δε

Parameters:

  • c (Numeric)

    2000年からの経過世紀

Returns:

  • (Numeric)

    緯度の章動 / CIRCLE



248
249
250
251
252
# File 'lib/when_exe/ephemeris.rb', line 248

def delta_e(c)
  trigonometric(c, 
    [[COS   ,  125.04      ,   -1934.136    , +0.00256  ],
     [COS   ,  200.93      ,  +72001.539    , +0.00016  ]]) / 360
end

.delta_p(c) ⇒ Numeric Also known as: deltaP

Δφ

Parameters:

  • c (Numeric)

    2000年からの経過世紀

Returns:

  • (Numeric)

    経度の章動 / CIRCLE



261
262
263
264
265
# File 'lib/when_exe/ephemeris.rb', line 261

def delta_p(c)
  trigonometric(c, 
    [[SIN   ,  125.04      ,   -1934.136    , -0.00478  ],
     [SIN   ,  200.93      ,  +72001.539    , +0.00037  ]]) / 360
end

.julian_century_from_2000(tt) ⇒ Numeric

時間の単位の換算 - 2000年元期の dynamical_time / ユリウス世紀

Parameters:

  • tt (Numeric)

    ユリウス日(Terrestrial Time)

Returns:



238
239
240
# File 'lib/when_exe/ephemeris.rb', line 238

def julian_century_from_2000(tt)
  return (tt - EPOCH2000) / JCENT
end

.julian_year_from_1975(tt) ⇒ Numeric

時間の単位の換算 - 1975年元期の dynamical_time / ユリウス年

Parameters:

  • tt (Numeric)

    ユリウス日(Terrestrial Time)

Returns:



228
229
230
# File 'lib/when_exe/ephemeris.rb', line 228

def julian_year_from_1975(tt)
  return (tt - EPOCH1975) / JYEAR
end

.obl(c) ⇒ Numeric

黄道傾角

Parameters:

  • c (Numeric)

    2000年からの経過世紀

Returns:

  • (Numeric)

    黄道傾角 / CIRCLE



274
275
276
# File 'lib/when_exe/ephemeris.rb', line 274

def obl(c)
  return (23.43929 + -0.013004*c + 1.0*delta_e(c)) / 360
end

.polynomial(t, equ) ⇒ Numeric

多項式

Parameters:

Returns:



69
70
71
# File 'lib/when_exe/ephemeris.rb', line 69

def polynomial(t, equ)
  equ.reverse.inject(0) {|sum, v| sum * t + v}
end

.root(t0, y0 = nil, delta = 0, count = 10, error = 1E-6, &func) ⇒ Numeric

func の逆変換

Parameters:

  • t0 (Numeric)

    独立変数の初期近似値

  • y0 (Numeric) (defaults to: nil)

    逆変換される関数値(nil なら極値を求める)

  • delta (Numeric) (defaults to: 0)

    戻り値が周期量である場合の周期

  • count (Numeric) (defaults to: 10)

    収束までの最大繰り返し回数

  • error (Float) (defaults to: 1E-6)

    収束と判断する誤差

  • func (Block)

    逆変換される関数

Returns:

Raises:

  • (RangeError)


289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/when_exe/ephemeris.rb', line 289

def root(t0, y0=nil, delta=0, count=10, error=1E-6, &func)

  # 近似値0,1
  diff  = [0.01, error*1000].min
  t     = [t0-diff,         t0+diff        ]
  y     = [func.call(t[0]), func.call(t[1])]
  y.map! {|y1| _adjust(y1, y0, delta)} unless delta==0

  # 近似値2(1次関数による近似)
  t << (y0 ? (t[1]-t[0])/(y[1]-y[0])*(y0-y[0])+t[0] : t0)

  # 繰り返し
  i = count
  while ((t[2]-t[1]).abs > error) && (i > 0)
    # 予備計算
    y << func.call(t[2])
    y[2] = _adjust(y[2], y0, delta) unless delta==0
    break if y0 && (y[2]-y0).abs <= error / 10

    # printf("t=%20.7f,L=%20.7f\n",t[2],y[2])
    t01     = t[0]-t[1]
    t02,y02 = t[0]-t[2], y[0]-y[2]
    t12,y12 = t[1]-t[2], y[1]-y[2]

    # 2次関数の係数
    a = ( y02     / t02 - y12     / t12) / t01
    b = (-y02*t12 / t02 + y12*t02 / t12) / t01
    c = y[2]

    if y0
      # 判別式
      if (discriminant = b*b-4*a*(c-y0)) < 0
        # 近似値(1次関数による近似)
        if y12 == 0
          i = -1
          break
        end
        t << t12/y12*(y0-y[1]) + t[1]
      else
        # 近似値(2次関数による近似)
        sqrtd = Math.sqrt(discriminant)
        sqrtd = -sqrtd if b < 0
        t << (t[2] + 2*(y0-c)/(b+sqrtd)) # <-桁落ち回避
      end
    else
      t << (t[2] - b / (2*a))
    end

    t.shift
    y.shift
    i -= 1
  end
  return t[2] if i > 0
  return t[1] + (t[0]-t[1]) / (y[0]-y[1]) * (y0-y[1]) if y0 && count < 6
  raise RangeError, "The result does not converge - #{t}->#{y}."
end

.sinc(x) ⇒ Numeric

円周単位のsin

Parameters:

Returns:



145
146
147
# File 'lib/when_exe/ephemeris.rb', line 145

def sinc(x)
  sin(x * CIRCLE)
end

.sind(x) ⇒ Numeric

度のsin

Parameters:

Returns:



124
125
126
# File 'lib/when_exe/ephemeris.rb', line 124

def sind(x)
  sin(x * DEG)
end

.tanc(x) ⇒ Numeric

円周単位のtan

Parameters:

Returns:



152
153
154
# File 'lib/when_exe/ephemeris.rb', line 152

def tanc(x)
  tan(x * CIRCLE)
end

.tand(x) ⇒ Numeric

度のtan

Parameters:

Returns:



131
132
133
# File 'lib/when_exe/ephemeris.rb', line 131

def tand(x)
  tan(x * DEG)
end

.trigonometric(t, equ, dl = 0.0, count = 0) ⇒ Numeric

三角関数の和

Parameters:

  • t (Numeric)

    独立変数

  • equ (Array<Numeric>)

    係数の Array

  • dl (Numeric) (defaults to: 0.0)

    位相補正値(デフォルト 補正なし)

  • count (Integer) (defaults to: 0)

    打ち切り項数(デフォルト 打ち切りなし)

Returns:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/when_exe/ephemeris.rb', line 83

def trigonometric(t, equ, dl=0.0, count=0)
  t2 = t * t
  equ[0..(count-1)].inject(0) do |sum, v|
    op, epoch, freq, amp, sqr = v
    ds = epoch + t * freq
    if (op < 0) # 直線
      ds += t2 * amp
    else        # 三角関数
      ds += t2 * sqr if sqr
      ds += dl  if (op[2]==1) # delta L is exist
      ds  = amp * ((op[0]==1) ? cosd(ds) : sind(ds))
      ds *= t   if (op[1]==1) # time proportional
    end
    sum += ds
  end
end