Documentation ¶
Overview ¶
Perihelion: Chapter 38, Planets in Perihelion and Aphelion.
Functions Aphelion and Perihelion implement algorithms from the book to return approximate results.
For accurate results, Meeus describes the general technique of interpolating from a precise ephemeris but does not give a complete algorithm. The algorithm implemented here for Aphelion2 and Perihelion2 is to start with the approximate result and then crawl along the curve at the specified time resolution until the desired extremum is found. This algorithm slows down as higher accuracy is demanded. 1 day accuracy is generally quick for planets other than Neptune.
Meeus doesn't give an algorithm to handle the double extrema of Neptune. The algorithm here is to pick starting points several years either side of the approximate date and follow the slopes inward. The consequence of starting farther from the extremum is that these functions are particularly slow for Neptune. They are offered here though as a simple implementation of Meeus's presentation in the book.
Index ¶
Examples ¶
Constants ¶
const ( Mercury = iota Venus Earth Mars Jupiter Saturn Uranus Neptune EMBary )
Planet constants for first argument of Perihelion and Aphelion functions.
Variables ¶
This section is empty.
Functions ¶
func Aphelion ¶
Aphelion returns an approximate jde of the aphelion event nearest the given time.
Argument p must be one of the planet constants above, y is a year number indicating a time near the aphelion event.
Example ¶
package main import ( "fmt" "math" "time" "github.com/soniakeys/meeus/v3/julian" pa "github.com/soniakeys/meeus/v3/perihelion" ) func main() { // Example 38.b, p. 270 j := pa.Aphelion(pa.Mars, 2032.5) fmt.Printf("%.3f\n", j) y, m, df := julian.JDToCalendar(j) d, f := math.Modf(df) fmt.Printf("%d %s %d at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5)) }
Output: 2463530.456 2032 October 24 at 23ʰ
func Aphelion2 ¶
Aphelion2 returns the aphelion event nearest the given time.
Argument p must be one of the planet constants Mercury through Neptune; EMBary is not allowed. Y is a year number near the perihelion event. D is the desired precision of the time result, in days. V must be a planetposition.V87Planet object consistent with argument p.
Result jde is the time of the event, r is the distance of the planet from the Sun in AU.
func Perihelion ¶
Perihelion returns an approximate jde of the perihelion event nearest the given time.
Argument p must be one of the planet constants above, y is a year number indicating a time near the perihelion event.
Example ¶
package main import ( "fmt" "math" "time" "github.com/soniakeys/meeus/v3/julian" pa "github.com/soniakeys/meeus/v3/perihelion" ) func main() { // Example 38.a, p. 270 j := pa.Perihelion(pa.Venus, 1978.79) fmt.Printf("%.3f\n", j) y, m, df := julian.JDToCalendar(j) d, f := math.Modf(df) fmt.Printf("%d %s %d at %dʰ\n", y, time.Month(m), int(d), int(f*24+.5)) }
Output: 2443873.704 1978 December 31 at 5ʰ
func Perihelion2 ¶
Perihelion2 returns the perihelion event nearest the given time.
Argument p must be one of the planet constants Mercury through Neptune; EMBary is not allowed. Y is a year number near the perihelion event. D is the desired precision of the time result, in days. V must be a planetposition.V87Planet object consistent with argument p.
Result jde is the time of the event, r is the distance of the planet from the Sun in AU.
Types ¶
This section is empty.