kepler

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: 3 Imported by: 0

Documentation

Overview

Kepler: Chapter 30, Equation of Kepler.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kepler1

func Kepler1(e float64, M unit.Angle, places int) (E unit.Angle, err error)

Kepler1 solves Kepler's equation by iteration. 迭代求解开普勒方程

The iterated formula is

E1 = M + e * sin(E0)

Argument e is eccentricity, M is mean anomaly, places is the desired number of decimal places in the result.

Result E is eccentric anomaly.

For some vaues of e and M it will fail to converge and the function will return an error.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/kepler"
	"github.com/soniakeys/unit"
)

func main() {
	// Example 30.a, p. 196
	E, err := kepler.Kepler1(.1, unit.AngleFromDeg(5), 8)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("%.6f\n", E.Deg())
}
Output:

5.554589

func Kepler2

func Kepler2(e float64, M unit.Angle, places int) (E unit.Angle, err error)

Kepler2 solves Kepler's equation by iteration.

The iterated formula is

E1 = E0 + (M + e * sin(E0) - E0) / (1 - e * cos(E0))

Argument e is eccentricity, M is mean anomaly, places is the desired number of decimal places in the result.

Result E is eccentric anomaly.

The function converges over a wider range of inputs than does Kepler1 but it also fails to converge for some values of e and M.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/kepler"
	"github.com/soniakeys/unit"
)

func main() {
	// Example 30.b, p. 199
	E, err := kepler.Kepler2(.1, unit.AngleFromDeg(5), 11)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("%.9f\n", E.Deg())
}
Output:

5.554589254

func Kepler2a

func Kepler2a(e float64, M unit.Angle, places int) (E unit.Angle, err error)

Kepler2a solves Kepler's equation by iteration.

The iterated formula is the same as in Kepler2 but a limiting function avoids divergence.

Argument e is eccentricity, M is mean anomaly, places is the desired number of decimal places in the result.

Result E is eccentric anomaly.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/kepler"
	"github.com/soniakeys/unit"
)

func main() {
	// Example data from p. 205
	E, err := kepler.Kepler2a(.99, unit.Angle(.2), 14)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("%.12f\n", E.Rad())
	fmt.Printf("%.8f\n", E.Deg())
}
Output:

1.066997365282
61.13444578

func Kepler2b

func Kepler2b(e float64, M unit.Angle, places int) (E unit.Angle, err error)

Kepler2b solves Kepler's equation by iteration.

The iterated formula is the same as in Kepler2 but a (different) limiting function avoids divergence.

Argument e is eccentricity, M is mean anomaly, places is the desired number of decimal places in the result.

Result E is eccentric anomaly.

Example
package main

import (
	"fmt"

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

func main() {
	// Example data from p. 205
	E, err := kepler.Kepler2b(.99, .2, 14)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("%.12f\n", E)
}
Output:

1.066997365282

func Kepler3

func Kepler3(e float64, M unit.Angle) (E unit.Angle)

Kepler3 solves Kepler's equation by binary search.

Argument e is eccentricity, M is mean anomaly.

Result E is eccentric anomaly.

Example
package main

import (
	"fmt"

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

func main() {
	// Example data from p. 205
	fmt.Printf("%.12f\n", kepler.Kepler3(.99, .2))
}
Output:

1.066997365282

func Kepler4

func Kepler4(e float64, M unit.Angle) (E unit.Angle)

Kepler4 returns an approximate solution to Kepler's equation. 当 e 很小时近似求解 E

It is valid only for small values of e.

Argument e is eccentricity, M is mean anomaly.

Result E is eccentric anomaly.

Example
package main

import (
	"fmt"

	"github.com/mooncaker816/learnmeeus/v3/kepler"
	"github.com/soniakeys/unit"
)

func main() {
	// Input data from example 30.a, p. 196,
	// result from p. 207
	E := kepler.Kepler4(.1, unit.AngleFromDeg(5))
	fmt.Printf("%.6f\n", E.Deg())
}
Output:

5.554599

func Radius

func Radius(E unit.Angle, e, a float64) float64

Radius returns radius distance r for given eccentric anomaly E. 已知偏近点角,离心率,半长轴,求 R

Argument e is eccentricity, a is semimajor axis.

Result unit is the unit of semimajor axis a (typically AU.)

func True

func True(E unit.Angle, e float64) unit.Angle

True returns true anomaly ν for given eccentric anomaly E. 已知偏近点角E 和离心率 e,求真近点角

Argument e is eccentricity. E must be in radians.

Types

This section is empty.

Jump to

Keyboard shortcuts

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