In [2]:
%matplotlib notebook
from LinearChain import *
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
In [3]:
a=2
b=1
x20 = [np.exp(0.5*np.log(a/b)*m)*np.sin(m*np.pi/(20+1)) for m in np.arange(0,20+2)]
x20 = x20 / np.linalg.norm(x20)
x50 = [np.exp(0.5*np.log(a/b)*m)*np.sin(m*np.pi/(50+1)) for m in np.arange(0,50+2)]
x50 = x50 / np.linalg.norm(x50)
x100 = [np.exp(0.5*np.log(a/b)*m)*np.sin(m*np.pi/(100+1)) for m in np.arange(0,100+2)]
x100 = x100 / np.linalg.norm(x100)
position = np.arange(len(x20))
In [13]:
exec(open("fig_settings.py").read())
cmax = np.max([np.max(x20),np.max(x50),np.max(x100)])
fig = plt.figure()
ax = fig.add_axes([0.13, 0.13, 0.85, 0.84])
ax.yaxis.tick_left()
ax.xaxis.tick_bottom()
xmin = 20
ax.scatter(position[(-xmin):],x100[(-xmin):],label=r"$N = 100$",marker="s",s=ms_size,color = myblue)
ax.scatter(position[(-xmin):],x50[(-xmin):],label=r"$N = 50$",marker="D",s=ms_size,color = myred)
ax.scatter(position[(-xmin):],x20[(-xmin):],label=r"$N = 20$",s=ms_size,color = mygreen)
ax.xaxis.set_ticks([5,10,15,20])
ax.xaxis.set_ticklabels([r"$N-15$",r"$N-10$",r"$N-5$",r"$N$"])
ax.yaxis.set_ticks(np.arange(0,cmax,0.1))
ax.yaxis.set_ticklabels([r"$%s$"%x for x in np.arange(0,cmax,0.1)])
ax.set_xlabel(r"Position")
ax.yaxis.labelpad = 10
ax.xaxis.labelpad = 2
ax.set_xlim([0,xmin+3])
ax.set_ylim([-0.1,cmax*1.1])
ax.set_ylabel(r"$C_i$",rotation=0)
ax.legend(loc=2,frameon=0,framealpha=0,ncol=1)
fig.show()
fig.savefig("figures/modes.pdf")
In [ ]: