func ExampleParallax() { // Example 47.a, p. 342. _, _, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12)) π := moonposition.Parallax(Δ) fmt.Printf("π = %.6f\n", π.Deg()) // Output: // π = 0.991990 }
func TestParallax(t *testing.T) { // test case from ch 40, p. 280 got := moonposition.Parallax(.37276 * base.AU).Sec() want := 23.592 if math.Abs(got-want) > .001 { t.Error(got, want) } }
// Lacking a worked example from the text, test using meeus/moonposition. func TestPerigeeParallax(t *testing.T) { got := apsis.PerigeeParallax(1997.93) _, _, d := moonposition.Position(apsis.Perigee(1997.93)) want := moonposition.Parallax(d) Δ := math.Abs((got - want).Sec()) // for this case anyway it's within a tenth of an arc second if Δ > .1 { t.Fatal("got", got, "want (about)", want) } }