This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---- Builder Stage ---- | |
FROM golang:1.23-alpine AS builder | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . . | |
# Build the consumer binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.DataFrame({ | |
'Position (m)': r, | |
'Position (X)': rx, | |
'Position (Y)': ry, | |
'True Anomaly (rad)': theta, | |
'True Anomaly (deg)': rad2deg(theta), | |
'Eccentric Anomaly (rad)': E, | |
'Eccentric Anomaly (deg)': rad2deg(E), | |
'Eccentric Anomaly (X)': eccentric_anomaly_x, | |
'Eccentric Anomaly (Y)': eccentric_anomaly_y, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define 2D vector coordinates | |
vector_coord_1 = np.random.rand(2) | |
vector_coord_2 = np.random.rand(2) | |
# plotting | |
fig, ax = plt.subplots() | |
vector_1 = ax.add_patch(mpatches.FancyArrowPatch((0, 0), vector_coord_1, mutation_scale=15)) | |
vector_2 = ax.add_patch(mpatches.FancyArrowPatch((0, 0), vector_coord_2, mutation_scale=15)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Method of computing fixed points of iterated functions. | |
x = g(x0) => fixed points (input = output) | |
""" | |
def fixed_point_iteration(p0, tol, n): | |
""" | |
fixed point iteration algorithm for root finding | |
param p0: initial guess for root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from get_adjacent_nodes import get_adj_list | |
from progress_state import progress_state | |
from state import State | |
class BFS: | |
def __init__(self, nodes, recursive, start_node, finish_node, root, animate=False): | |
""" initialise bredth first search solver """ | |
self.subscriber = root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bubble_sort(self, unsorted, n): | |
""" bubble sort algorithm """ | |
# iterate over unsorted array up until second last element | |
for i in range(0, n - 1): | |
# swapped conditions monitors for finalised list | |
swapped = False | |
# iterate over remaining unsorted items |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyvista | |
sphere = pyvista.Sphere() | |
sphere.plot(show_edges=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# form the augmented matrix by concatenating A and I | |
M = np.concatenate((M, I), axis=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define array | |
A = np.array([[1, 0], [0, 1]]) | |
# True if orthogonal | |
assert (A.T == np.linalg.inv(A)).all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def animate(i): | |
# update axis view angle | |
ax.view_init(vertical_rotation_angles[i], horizontal_rotation_angles[i]) | |
# update trajectory for current time step with x, y data | |
trajectory.set_data(state_history[:i, 0], state_history[:i, 1])\ | |
# update z-dimension data | |
trajectory.set_3d_properties(state_history[:i, 2]) | |
NewerOlder