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]) | |
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
-7.000000 8.000000 26.000000 | |
-5.583929 7.759362 24.827488 | |
-4.326611 7.501421 23.801976 | |
-3.213183 7.253440 22.902061 | |
-2.228067 7.033525 22.108406 | |
-1.355780 6.853185 21.404540 | |
-0.581457 6.719310 20.777010 | |
0.108848 6.635641 20.215196 | |
0.728002 6.603831 19.710990 | |
1.287734 6.624192 19.258431 |
NewerOlder