火星计算器公式翻译
Formula translation for Mars calculator
我需要将这个公式翻译成Python:
δs = arcsin {0.42565 sin Ls)} + 0.25° sin Ls
考虑到 Ls 值为 122.985º(以度为单位)
我使用的代码是:
Ls = 122.985
Ds = math.asin(math.radians(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))
Ds 的结果约为 0.2159º... 而应约为 21,128º。
我做错了什么?
请注意,公式的第二项有度数标记。意思是 "take the arcsine of 0.42565 times sine(Ls). That is an angle, which can be expressed in degrees. To it, add 0.25 degrees times sine(Ls)".
angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
correction = 0.25 * math.sin(math.radians(Ls)) # this is a value in degrees
Ds = angle1 + correction
或者组合成一个公式,我在上面为了清楚起见把它分解了
Ds = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))
使用您的示例:
>>> Ls = 122.985
>>> angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
>>> angle1
20.918572663722518
>>> correction = 0.25 * math.sin(math.radians(Ls))
>>> correction
0.20970328134223665
>>> angle1 + correction
21.128275945064754
不要过分强调我将第二项标记为更正,我是从 http://www.oregonl5.org/mist/docs/Mars24J/help/notes.html 中的讨论中得到的,特别是:
For an accurate account of the solar illumination relative to the
plane of a locally flat surface, the solar declination can be
corrected for the small difference appropriate to the so-called
planetographic measure of latitude on an oblate sphere, as it is in
the Mars24 sunclock.
但我可能误解了那句话的意思。我确定的主要事情是这些值经过测试并且单位合理地执行。
我需要将这个公式翻译成Python:
δs = arcsin {0.42565 sin Ls)} + 0.25° sin Ls
考虑到 Ls 值为 122.985º(以度为单位)
我使用的代码是:
Ls = 122.985
Ds = math.asin(math.radians(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))
Ds 的结果约为 0.2159º... 而应约为 21,128º。
我做错了什么?
请注意,公式的第二项有度数标记。意思是 "take the arcsine of 0.42565 times sine(Ls). That is an angle, which can be expressed in degrees. To it, add 0.25 degrees times sine(Ls)".
angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
correction = 0.25 * math.sin(math.radians(Ls)) # this is a value in degrees
Ds = angle1 + correction
或者组合成一个公式,我在上面为了清楚起见把它分解了
Ds = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls)))) + 0.25 * math.sin(math.radians(Ls))
使用您的示例:
>>> Ls = 122.985
>>> angle1 = math.degrees(math.asin(0.42565 * math.sin(math.radians(Ls))))
>>> angle1
20.918572663722518
>>> correction = 0.25 * math.sin(math.radians(Ls))
>>> correction
0.20970328134223665
>>> angle1 + correction
21.128275945064754
不要过分强调我将第二项标记为更正,我是从 http://www.oregonl5.org/mist/docs/Mars24J/help/notes.html 中的讨论中得到的,特别是:
For an accurate account of the solar illumination relative to the plane of a locally flat surface, the solar declination can be corrected for the small difference appropriate to the so-called planetographic measure of latitude on an oblate sphere, as it is in the Mars24 sunclock.
但我可能误解了那句话的意思。我确定的主要事情是这些值经过测试并且单位合理地执行。