jupitermoons

package
v3.0.0-...-8217f41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Jupitermoons: Chapter 44, Positions of the Satellites of Jupiter.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func E5

func E5(jde float64, earth, jupiter *pp.V87Planet, pos *[4]XY)

E5 computes higher accuracy positions of moons of Jupiter.

High accuracy method based on theory "E5." Results returned in argument pos, which must not be nil. Returned coordinates in units of Jupiter radii.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/jupitermoons"

	pp "github.com/mooncaker816/learnmeeus/v3/planetposition"
)

func main() {
	// Example 44.b, p. 314.
	e, err := pp.LoadPlanet(pp.Earth)
	if err != nil {
		fmt.Println(err)
		return
	}
	j, err := pp.LoadPlanet(pp.Jupiter)
	if err != nil {
		fmt.Println(err)
		return
	}
	var pos [4]jupitermoons.XY
	jupitermoons.E5(2448972.50068, e, j, &pos)
	fmt.Printf("X  %+.4f  %+.4f  %+.4f  %+.4f\n",
		pos[0].X, pos[1].X, pos[2].X, pos[3].X)
	fmt.Printf("Y  %+.4f  %+.4f  %+.4f  %+.4f\n",
		pos[0].Y, pos[1].Y, pos[2].Y, pos[3].Y)
}
Output:

X  -3.4503  +7.4418  +1.2010  +7.0720
Y  +0.2137  +0.2752  +0.5900  +1.0290
Example (Conjunction)

The exercise of finding the zero crossing is not coded here, but computed are offsets at the times given by Meeus, showing the X coordinates near zero (indicating conjunction) and Y coordinates near the values given by Meeus.

// Exercise, p. 314.
e, err := pp.LoadPlanet(pp.Earth)
if err != nil {
	fmt.Println(err)
	return
}
j, err := pp.LoadPlanet(pp.Jupiter)
if err != nil {
	fmt.Println(err)
	return
}
var pos [4]jupitermoons.XY
jd := julian.CalendarGregorianToJD(1988, 11, 23)
jd += deltat.Interp10A(jd).Day()
t3 := unit.NewTime(' ', 7, 28, 0)
jupitermoons.E5(jd+t3.Day(), e, j, &pos)
fmt.Printf("III  %m  X = %+.4f  Y = %+.4f\n",
	sexa.FmtTime(t3), pos[2].X, pos[2].Y)
t4 := unit.NewTime(' ', 5, 15, 0)
jupitermoons.E5(jd+t4.Day(), e, j, &pos)
fmt.Printf("IV   %m  X = %+.4f  Y = %+.4f\n",
	sexa.FmtTime(t4), pos[3].X, pos[3].Y)
Output:

III  7ʰ28ᵐ  X = +0.0032  Y = -0.8042
IV   5ʰ15ᵐ  X = +0.0002  Y = +1.3990

Types

type XY

type XY struct {
	X, Y float64 // in units of Jupiter radii
}

XY used for returning coordinates of moons.

func Positions

func Positions(jde float64) (pI, pII, pIII, pIV XY)

Positions computes positions of moons of Jupiter.

Returned coordinates are in units of Jupiter radii.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/jupitermoons"
)

func main() {
	// Example 44.a, p. 303.
	p1, p2, p3, p4 := jupitermoons.Positions(2448972.50068)
	fmt.Printf("X1 = %+.2f  Y1 = %+.2f\n", p1.X, p1.Y)
	fmt.Printf("X2 = %+.2f  Y2 = %+.2f\n", p2.X, p2.Y)
	fmt.Printf("X3 = %+.2f  Y3 = %+.2f\n", p3.X, p3.Y)
	fmt.Printf("X4 = %+.2f  Y4 = %+.2f\n", p4.X, p4.Y)
}
Output:

X1 = -3.44  Y1 = +0.21
X2 = +7.44  Y2 = +0.25
X3 = +1.24  Y3 = +0.65
X4 = +7.08  Y4 = +1.10
Example (Conjunction)

The exercise of finding the zero crossing is not coded here, but computed are offsets at the times given by Meeus, showing the X coordinates near zero (indicating conjunction) and Y coordinates near the values given by Meeus.

// Exercise, p. 314.
jd := julian.CalendarGregorianToJD(1988, 11, 23)
jd += deltat.Interp10A(jd).Day()
t3 := unit.NewTime(' ', 7, 28, 0)
_, _, p3, _ := jupitermoons.Positions(jd + t3.Day())
fmt.Printf("III  %m  X = %+.2f  Y = %+.2f\n", sexa.FmtTime(t3), p3.X, p3.Y)
t4 := unit.NewTime(' ', 5, 15, 0)
_, _, _, p4 := jupitermoons.Positions(jd + t4.Day())
fmt.Printf("IV   %m  X = %+.2f  Y = %+.2f\n", sexa.FmtTime(t4), p4.X, p4.Y)
Output:

III  7ʰ28ᵐ  X = -0.00  Y = -0.84
IV   5ʰ15ᵐ  X = +0.06  Y = +1.48

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL