且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

月亮/月相算法

更新时间:2023-02-26 20:26:08

前段时间我将一些代码移植到 Python 中.我打算只是链接到它,但事实证明它同时从网上掉下来了,所以我不得不把它擦掉并重新上传.请参阅 moon.py 其中源自 John Walker 的 moontool.

I ported some code to Python for this a while back. I was going to just link to it, but it turns out that it fell off the web in the meantime, so I had to go dust it off and upload it again. See moon.py which is derived from John Walker's moontool.

我找不到关于这两个时间跨度准确的参考,但似乎作者非常严谨.这意味着是的,它确实使用了 trig,但我无法想象你会使用它来做什么,这会使其在计算上令人望而却步.Python 函数调用开销可能超过了三角操作的成本.计算机的计算速度非常快.

I can't find a reference for this for what time spans it's accurate for either, but seems like the authors were pretty rigorous. Which means yes, it does use trig, but I can't imagine what the heck you would be using this for that would make it computationally prohibitive. Python function call overhead is probably more than the cost of the trig operations. Computers are pretty fast at computing.

代码中使用的算法来源于以下来源:

The algorithms used in the code are drawn from the following sources:

米厄斯,让.天文算法.里士满:Willmann-Bell,1991 年.ISBN 0-943396-35-2.

必备;如果你只买一本书,请确保是这本书.算法以数学方式呈现,而不是作为计算机程序,但实现本书中许多算法的源代码可以从 QuickBasic、Turbo Pascal 或 C 中的出版商单独订购.Meeus 提供了许多对调试至关重要的计算示例您的代码,并且经常提出几种算法,它们在准确性、速度、复杂性和长期(世纪和千年)有效性之间进行了不同的权衡.

A must-have; if you only buy one book, make sure it's this one. Algorithms are presented mathematically, not as computer programs, but source code implementing many of the algorithms in the book can be ordered separately from the publisher in either QuickBasic, Turbo Pascal, or C. Meeus provides many worked examples of calculations which are essential to debugging your code, and frequently presents several algorithms with different tradeoffs among accuracy, speed, complexity, and long-term (century and millennia) validity.

达菲特-史密斯,彼得.实用天文学与您的计算器.第三版.剑桥:剑桥大学出版社,1981 年.ISBN 0-521-28411-2.

尽管标题中有计算器一词;如果您有兴趣开发计算行星位置、轨道、日食等的软件,这是一个有价值的参考.提供了比 Meeus 更多的背景信息,这有助于那些尚未精通天文学的人学习经常令人困惑的术语.给出的算法比 Meeus 提供的算法更简单、更不准确,但适用于大多数实际工作.

Despite the word Calculator in the title; this is a valuable reference if you're interested in developing software which calculates planetary positions, orbits, eclipses, and the like. More background information is given than in Meeus, which helps those not already versed in astronomy learn the often-confusing terminology. The algorithms given are simpler and less accurate than those provided by Meeus, but are suitable for most practical work.