# lamberthub.p_solvers.battin

This module holds all methods devised by R. H. Battin.

## Module Contents

### Functions

 battin1984(mu, r1, r2, tof, M=0, prograde=True, low_path=True, maxiter=35, atol=1e-05, rtol=1e-07, full_output=False) Battin's elegant algortihm for solving the Lambert's problem. This algorithm _battin_first_equation(y, ll, m) Battin's first equation. _battin_second_equation(u, h1, h2) Battin's second equation. _get_lambda(c, s, dtheta) Comptues the transfer angle parameter. _get_ll(_lambda) Computes the l variable. _get_m(mu, tof, s, _lambda) Computes the m auxiliary variable. _get_h_coefficients(x, ll, m) Evaluates the h1 and h2 coefficients. _u_at_h(h1, h2) Evaluates u at h coefficients. Evaluates u auxiliary variable at given B. _B_at_h(h1, h2) Evaluates B auxiliary variable at given h coefficients. _xi_at_x(x, levels=125) Evaluates the xi function at a particular value of x. _K_at_u(u, levels=1000) Evaluates the K function at a particular value of u.
lamberthub.p_solvers.battin.battin1984(mu, r1, r2, tof, M=0, prograde=True, low_path=True, maxiter=35, atol=1e-05, rtol=1e-07, full_output=False)

Battin’s elegant algortihm for solving the Lambert’s problem. This algorithm is known to improve Gauss original one by removing the singularity for 180 transfer angles and increasing its performance.

Parameters
• mu (float) – Gravitational parameter, equivalent to $$GM$$ of attractor body.

• r1 (numpy.array) – Initial position vector.

• r2 (numpy.array) – Final position vector.

• M (int) – Number of revolutions. Must be equal or greater than 0 value.

• low_path (bool) – If two solutions are available, it selects between high or low path.

• maxiter (int) – Maximum number of iterations.

• atol (float) – Absolute tolerance.

• rtol (float) – Relative tolerance.

• full_output (bool) – If True, the number of iterations and time per iteration are also returned.

Returns

• v1 (numpy.array) – Initial velocity vector.

• v2 (numpy.array) – Final velocity vector.

• numiter (int) – Number of iterations.

• tpi (float) – Time per iteration in seconds.

Notes

The algorithm originally devised by Gauss exploits the so-called ratio of sector to triangle area, which is a numerical value related with the orbital parameter. This Algorithm was used to the discovery of the orbit of Ceres by the genius and adopted by many other authors of his time due to its simplicity. However, the Algorithm is found to be singular for transfer angles of 180 degrees and shows a low performance for really small angles.

References

[1] Battin, R. H., & Vaughan, R. M. (1984). An elegant Lambert algorithm. Journal of Guidance, Control, and Dynamics, 7(6), 662-670.

[2] Battin, R. H. (1999). An introduction to the mathematics and methods of astrodynamics. Aiaa.

[3] Vaughan, R. M. (1983). An improvement of Gauss’ method for solving Lambert’s problem (Doctoral dissertation, Massachusetts Institute of Technology).

lamberthub.p_solvers.battin._battin_first_equation(y, ll, m)

Battin’s first equation.

Parameters
• y (float) – The dependent variable.

• ll (float) – First auxiliary variable.

• m (float) – Second auxiliary variable.

Returns

x – The independent variable.

Return type

float

Notes

This is equaiton (49) from original report [1], which is alternative from the book [2] is expression (7.113)

lamberthub.p_solvers.battin._battin_second_equation(u, h1, h2)

Battin’s second equation.

Parameters
• u (float) – The dependent variable.

• h1 (float) – The first of the h coefficients.

• h2 (float) – The second of the h coefficients.

Returns

y – The dependent variable.

Return type

float

Notes

Computes the desired positive root via an explicit equation defined in [1] under number (57).

lamberthub.p_solvers.battin._get_lambda(c, s, dtheta)

Comptues the transfer angle parameter.

Parameters
• c (float) – The norm of the chord vector.

• s (float) – The semiperimeter.

• dtheta (float) – The transfer angle in radians.

Returns

_lambda – The transfer angle parameter.

Return type

float

Notes

This is inline equation in the very first page of report [1].

lamberthub.p_solvers.battin._get_ll(_lambda)

Computes the l variable.

Parameters

_lambda (float) – The transfer angle parameter.

Returns

ll – Auxiliary variable.

Return type

float

Notes

This is equation (30) from original report.

lamberthub.p_solvers.battin._get_m(mu, tof, s, _lambda)

Computes the m auxiliary variable.

Parameters
• mu (float) – The gravitational parameter.

• tof (float) – The time of flight.

• s (float) – The semiperimeter of the orbit.

• _lambda (float) – The transfer angle parameter.

Returns

m – Auxiliary variable.

Return type

float

Notes

This is equation (31) from official report [1].

lamberthub.p_solvers.battin._get_h_coefficients(x, ll, m)

Evaluates the h1 and h2 coefficients.

Parameters
• x (float) – The free-parameter.

• ll (float) – The first auxiliary variable.

• m (float) – The second auxiliary variable.

Returns

• h1 (float) – The first of the h coefficients.

• h2 (float) – The second of the h coefficients.

Notes

These are equations (47) and (48) from report [1].

lamberthub.p_solvers.battin._u_at_h(h1, h2)

Evaluates u at h coefficients.

Parameters
• h1 (float) – The first of the h coefficients.

• h2 (float) – The second of the h coefficients.

Returns

u – Auxiliary variable.

Return type

float

lamberthub.p_solvers.battin._u_at_B(B)

Evaluates u auxiliary variable at given B.

Parameters

B (float) – Auxiliary variable.

Returns

u – Auxiliary variable.

Return type

float

Notes

This is equation (55) from the original report [1].

lamberthub.p_solvers.battin._B_at_h(h1, h2)

Evaluates B auxiliary variable at given h coefficients.

Parameters
• h1 (float) – The first of the h coefficients.

• h2 (float) – The second of the h coefficients.

Returns

B – Auxiliary variable.

Return type

float

Notes

This is equation (56) from the original report.

lamberthub.p_solvers.battin._xi_at_x(x, levels=125)

Evaluates the xi function at a particular value of x.

Parameters

x (float) – The independent variable.

Returns

xi – The value of the xi function.

Return type

float

Notes

This is equation (53) from original report [1]. However, the method presented in [3] which makes use of a series is the one used here as it is much simpler to implement.

lamberthub.p_solvers.battin._K_at_u(u, levels=1000)

Evaluates the K function at a particular value of u.

Parameters

u (float) – Battin’s auxiliary variable.

Returns

K – The value of the K function.

Return type

float

Notes

This is equation (58) from original report [1]. However, the method presented in [3] which makes use of a series is the one used here as it is much simpler to implement.