0

I've tried to model the circle shape in presence of gravitational waves, but the points lying on the x-axis don't move.

I computed the dependence of this component by hand, and it should change with time. It seems like something is wrong with the function Len_Linit, since I checked all others independently and everything was fine.

%matplotlib notebook
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np

omega = 1
L0 = 2
l = 1

def h_ij(omega, t):
    h = np.zeros((3,3))
    matrix_1 = np.array([[1,0,0],[0,-1,0],[0,0,0]])
    matrix_2 = np.array([[0,1,0],[1,0,0],[0,0,0]])
    h +=  -np.cos(2*omega*t)*matrix_1  - np.sin(2*omega*t)*matrix_2
    return h

def n_vec(N):
    n = np.zeros((N, 3))
    for i in range(N):
        n[i, 0] += np.cos((2*np.pi*i)/N)
        n[i, 1] += np.sin((2*np.pi*i)/N)
    return n


def Len_Linit(N, omega, t, l, L0):
    Len_arr = np.zeros(N)
    for i in range(N):
        Len_arr[i] += L0
        
    h = h_ij(omega, t)
    n = n_vec(N)
    for i in range(N):
        for k in range(3):
            for l in range(3):
                Len_arr[i] += (l/2)*h[k,l]*n[i,k]*n[i,l]
                
    return Len_arr

def get_coords_of_Li(N, omega, t, l, L0):
    coords = np.zeros((N+1, 3))
    Li_0 = Len_Linit(N, omega, t, l, L0) 
    n = n_vec(N)
    for i in range(N):
        coords[i,0]+= Li_0[i]*n[i, 0]
        coords[i,1]+= Li_0[i]*n[i, 1]
    
    
    coords[N, 0]+= coords[0, 0]
    coords[N, 1]+= coords[0, 1]
    return coords    


fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(5, 5))
line, = plt.plot([], [], '-bo', lw=2) # the ball


axes.set_xlim(-3, 3)
axes.set_ylim(-3, 3)

plt.style.use("ggplot")

N = 14

def make_frame(i):
    t = 0.1*i

    coords = get_coords_of_Li(N, omega, t, l, L0)
    
    thisx = coords[:, 0]
    thisy = coords[:, 1]

    line.set_data(thisx, thisy)
   
    
    return line,

animation.FuncAnimation(fig, make_frame, interval=90)
tdy
  • 36,675
  • 19
  • 86
  • 83

0 Answers0