Documentation
¶
Overview ¶
Kepler: Chapter 30, Equation of Kepler.
Index ¶
- func Kepler1(e float64, M unit.Angle, places int) (E unit.Angle, err error)
- func Kepler2(e float64, M unit.Angle, places int) (E unit.Angle, err error)
- func Kepler2a(e float64, M unit.Angle, places int) (E unit.Angle, err error)
- func Kepler2b(e float64, M unit.Angle, places int) (E unit.Angle, err error)
- func Kepler3(e float64, M unit.Angle) (E unit.Angle)
- func Kepler4(e float64, M unit.Angle) (E unit.Angle)
- func Radius(E unit.Angle, e, a float64) float64
- func True(E unit.Angle, e float64) unit.Angle
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Kepler1 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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
Types ¶
This section is empty.