Addtional Question 2 Visualization


In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import YouTubeVideo


:0: FutureWarning: IPython widgets are experimental and may change in the future.

In [2]:
from plotting_function import plotter,static_plot,com_plot,static_plot_com

Reading data back from file:


In [3]:
f = open('additional_2_data.npz','r')
r = np.load('additional_2_data.npz')
sol_add2 = r['arr_0']
ic_add2 = r['arr_1']
f.close()

As with the base question, I can use interact to view the positions of the bodies in my system:


In [4]:
interact(plotter,ic=fixed(ic_add2),sol=fixed(sol_add2),n=(0,len(np.linspace(0,1.2,100))-1,1));


Animation showing behavior:


In [5]:
YouTubeVideo('a0lvtLYS9zk',width=600,height=600)


Out[5]:

Static plots:


In [6]:
specific_t = [0,25,30,35,40,45,50,55,60,70,80,90,100]

plt.figure(figsize=(20,30))
i = 1
for n in specific_t:
    if i > 13:
        break
    else:
        plt.subplot(5,3,i)
        static_plot(ic_add2,sol_add2,n)
    i += 1
plt.tight_layout()


Interactive plot around the center of mass of the two galaxies:


In [7]:
interact(com_plot,ic=fixed(ic_add2),sol=fixed(sol_add2),M=fixed((1e11)/3),S=fixed(1e11),n=(0,len(np.linspace(0,1.2,100))-1,1));


Animation around center of mass:


In [8]:
YouTubeVideo('V5HSG--g7dY',width=600,height=600)


Out[8]:

Static plots around center of mass:


In [10]:
specific_t = [0,25,30,35,40,45,50,55,60,70,80,90,100]

plt.figure(figsize=(20,30))
i = 1
for n in specific_t:
    if i > 13:
        break
    else:
        plt.subplot(5,3,i)
        static_plot_com(ic_add2,sol_add2,(1e11)/3,1e11,n)
    i += 1
plt.tight_layout()


As can be seen, since the mass of $M$ is a third of the mass of $S$, the stars are more dramatically affected by $S$


In [ ]: