Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber committed Jun 16, 2024
1 parent c6a3d76 commit a85f9f9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
warnings.simplefilter("ignore")
from myst_nb import glue

np.set_printoptions(legacy="1.25")
glue("orbital-elements-radius", r, display=False)
glue("orbital-elements-velocity", v, display=False)
glue("orbital-elements-v_r", v_r, display=False)
Expand Down
1 change: 1 addition & 0 deletions interplanetary-maneuvers/planetary-arrival-flyby.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ h_1 = np.sqrt(mu_sun * R_Neptune * (1 - e_1))
from functools import partial
from myst_nb import glue as myst_glue
glue = partial(myst_glue, display=False)
np.set_printoptions(legacy="1.25")
glue("interplanetary-flyby-e_1", e_1)
glue("interplanetary-flyby-h_1", h_1)
```
Expand Down
1 change: 1 addition & 0 deletions orbital-maneuvers/comparison-of-bielliptic-and-hohmann.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ v_3 = np.sqrt(mu / r_3) # km/s

```{code-cell} ipython3
:tags: [remove-cell]
np.set_printoptions(legacy="1.25")
glue("moon_circle_velocity", v_1)
glue("leo_circle_velocity", v_3)
```
Expand Down
1 change: 1 addition & 0 deletions orbital-maneuvers/plane-change-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Delta_v_1 = Delta_v_1_LEO + Delta_v_1_GEO

```{code-cell} ipython3
:tags: [remove-cell]
np.set_printoptions(legacy="1.25")
from functools import partial
from myst_nb import glue as myst_glue
glue = partial(myst_glue, display=False)
Expand Down
2 changes: 2 additions & 0 deletions orbital-maneuvers/single-impulse-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ from matplotlib.patches import Circle, Arc
import numpy as np
from myst_nb import glue
np.set_printoptions(legacy="1.25")
R_E = 6378 # km
orbit_radius = 1000 # km
mu = 398_600 # km**2/s**3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ e = \frac{r_a - r_p}{r_a + r_p}
:::

```{code-cell} ipython3
# %matplotlib notebook
import numpy as np
from scipy.optimize import newton
Expand All @@ -51,6 +50,7 @@ e = (r_a - r_p)/(r_a + r_p)
:tags: [remove-cell]
from functools import partial
from myst_nb import glue as myst_glue
np.set_printoptions(legacy="1.25")
glue = partial(myst_glue, display=False)
glue("ellipse-time-since-periapsis-e", e)
```
Expand Down Expand Up @@ -149,7 +149,7 @@ def kepler(E, M_e, e):
def d_kepler_d_E(E, M_e, e):
"""The derivative of Kepler's equation, to be used in a Newton solver.
Note that the argument M_e is unused, but must be present so the function
arguments are consistent with the kepler function.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ from matplotlib.patches import Ellipse, Circle, Arc, Rectangle
import numpy as np
glue = partial(myst_glue, display=False)
np.set_printoptions(legacy="1.25")
mu = 3.986004418E5 # km**3/s**2
R_E = 6378 # km
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ e = h**2 / (r_p * mu) - 1
:tags: [remove-cell]
from functools import partial
from myst_nb import glue as myst_glue
np.set_printoptions(legacy="1.25")
glue = partial(myst_glue, display=False)
glue("hyperbolic-time-since-perigee-h", h)
Expand Down Expand Up @@ -117,7 +119,7 @@ def kepler(F, M_h, e):
def d_kepler_d_F(F, M_h, e):
"""The derivative of Kepler's equation, to be used in a Newton solver.
Note that the argument M_h is unused, but must be present so the function
arguments are consistent with the kepler function.
"""
Expand All @@ -129,7 +131,7 @@ F_2 = newton(func=kepler, fprime=d_kepler_d_F, x0=np.pi, args=(M_h2, e))
With this value for $F$, we can calculate the value for $\nu$. To avoid quadrant ambiguity problems, we will use Eq. {eq}`eq:eccentric-anomaly-true-anomaly-hyperbola`.

```{code-cell} ipython3
sqrt_e = np.sqrt((e + 1) / (e - 1))
sqrt_e = np.sqrt((e + 1) / (e - 1))
nu_2 = (2 * np.arctan(sqrt_e * np.tanh(F_2 / 2))) % (2 * np.pi)
```

Expand Down Expand Up @@ -181,12 +183,12 @@ function kepler
v_p = 15; % km/s
h = r_p * v_p;
e = h^2 / (mu * r_p) - 1;
nu_1 = deg2rad(100);
F_1 = 2 * atanh(sqrt((e - 1) / (e + 1)) * tan(nu_1 / 2));
M_h1 = e * sinh(F_1) - F_1;
t_1 = h^3 / mu^2 * 1 / (e^2 - 1)^(3 / 2) * M_h1;
t_2 = t_1 + 3 * 3600;
M_h2 = mu^2 / h^3 * (e^2 - 1)^(3 / 2) * t_2;
Expand All @@ -198,7 +200,7 @@ function kepler
t2 = 2 * atan(sqrt((e + 1) / (e - 1)) * tanh(F_2 / 2));
nu_2 = mod(t2, 2 * pi);
disp(rad2deg(nu_2))
r_2 = h^2 / mu * 1 / (1 + e * cos(nu_2));
v_perp = h / r_2;
v_r = mu / h * e * sin(nu_2);
Expand Down

0 comments on commit a85f9f9

Please sign in to comment.