1 year ago
#75774
DomIsAwesomee
Average Directional Unit Vectors - Determinism Test
Say I take this box as an example:
I want to calculate the average directional vectors in the embedding phase space. The average direction vector V_k is calculated at each pass p of the trajectory through the k-th box. This generates a unit vector e_p whose direction is determined by the phase space point where the trajectory enters the box and the phase space point where the trajectory leaves the box. Here's 2 methods, I'm unsure what is the correct method or if both are wrong:
def unit_vector(v):
return v / np.linalg.norm(v)
# x-line and y-line
x = 0.00066496
y = 0.00069381
# y-vals along x-line
ys = [0.0007515997, 0.0007516736, 0.0007517695, 0.0007517716, 0.0007517978, 0.0007518086, 0.0007518439,
0.0007518738, 0.0007518758, 0.0007518850, 0.0007518883, 0.0007518912, 0.0007518925, 0.0007519232]
# x-vals along y-line
xs = [0.0007860762, 0.0007861990, 0.0007862053, 0.0007862724, 0.0007862800, 0.0007863471, 0.0007864196,
0.0007864439, 0.0007864641, 0.0007864704, 0.0007864773, 0.0007864814, 0.0007864959, 0.0007865132]
# Create the coordinates
A, B = [], []
for i, j in zip(ys, xs):
A.append([x, i])
B.append([j, y])
A = np.matrix(A)
B = np.matrix(B)
# Method 1
avg_direction_unit_vector = []
for i in range(len(A)):
avg_direction_unit_vector.append([unit_vector(A[i, 0] - B[i, 0]), unit_vector(A[i, 1] - B[i, 1])])
V = np.mean(np.array(avg_direction_unit_vector), axis=0)
print(np.abs(V))
# Method 2
avg_direction_unit_vector = []
for i in range(len(A)):
avg_direction_unit_vector.append(unit_vector([A[i, 0] - B[i, 0], (A[i, 1] - B[i, 1])]))
V = np.mean(avg_direction_unit_vector, axis=0)
print(np.abs(V))
python
numpy
vector
linear-algebra
chaos
0 Answers
Your Answer