示例#1
0
func TestEarth(t *testing.T) {
	// p. 273
	j := pa.Perihelion(pa.EMBary, 1990)
	y, m, d := julian.JDToCalendar(j)
	if y != 1990 || m != 1 || int(d) != 3 {
		t.Fatal(y, m, d)
	}
	j = pa.Perihelion(pa.Earth, 1990)
	y, m, df := julian.JDToCalendar(j)
	d, f := math.Modf(df)
	if y != 1990 || m != 1 || int(d) != 4 || int(f*24+.5) != 16 {
		t.Fatal(y, m, df)
	}
}
示例#2
0
func ExamplePerihelion() {
	// 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ʰ
}
示例#3
0
文件: node_test.go 项目: pjh59/meeus
func ExampleEllipticAscending_venus() {
	// Example 39.c, p. 278
	var k elementplanet.Elements
	elementplanet.Mean(elementplanet.Venus,
		julian.CalendarGregorianToJD(1979, 1, 1), &k)
	t, _ := node.EllipticAscending(k.Axis, k.Ecc,
		k.Peri-k.Node,
		perihelion.Perihelion(perihelion.Venus, 1979))
	y, m, d := julian.JDToCalendar(t)
	fmt.Printf("%d %s %.3f\n", y, time.Month(m), d)
	// Output:
	// 1978 November 27.409
}
示例#4
0
func TestJS(t *testing.T) {
	// p. 270
	j := pa.Aphelion(pa.Jupiter, 1981.5)
	y, m, d := julian.JDToCalendar(j)
	if y != 1981 || m != 7 || int(d) != 19 {
		t.Fatal(y, m, d)
	}
	s := pa.Perihelion(pa.Saturn, 1944.5)
	y, m, d = julian.JDToCalendar(s)
	if y != 1944 || m != 7 || int(d) != 30 {
		t.Fatal(y, m, d)
	}
}