Coryab/code #10

Merged
coryab merged 37 commits from coryab/code into develop 2023-10-24 10:45:33 +00:00
2 changed files with 10 additions and 10 deletions
Showing only changes of commit 872b84d0d1 - Show all commits

View File

@ -62,9 +62,9 @@ def main():
axs2[1].set(xlabel=r"t $(\mu s)$", ylabel = r"z $(\mu m)$") axs2[1].set(xlabel=r"t $(\mu s)$", ylabel = r"z $(\mu m)$")
axs2[0].set(ylabel = r"z $(\mu m)$") axs2[0].set(ylabel = r"z $(\mu m)$")
axs1[i].legend() axs1[i].legend(loc="upper right")
# axs1[i].set_title(title) # axs1[i].set_title(title)
axs2[i].legend() axs2[i].legend(loc="upper right")
# axs2[i].set_title(title) # axs2[i].set_title(title)
fig1.savefig("../latex/images/phase_space_2_particles_x.pdf", bbox_inches="tight") fig1.savefig("../latex/images/phase_space_2_particles_x.pdf", bbox_inches="tight")

View File

@ -27,10 +27,10 @@ def main():
"32000_steps.txt", "32000_steps.txt",
] ]
labels = [ labels = [
r"4000 steps", r"$n_1$",
r"8000 steps", r"$n_2$",
r"16000 steps", r"$n_3$",
r"32000 steps", r"$n_4$",
] ]
titles = [ titles = [
"Relative error for the RK4 method", "Relative error for the RK4 method",
@ -47,17 +47,17 @@ def main():
max_err.append(max(r)) max_err.append(max(r))
axs1[i].plot(t, r, label=label) axs1[i].plot(t, r, label=label)
axs1[i].set(ylabel = r"relative_error $(\mu m)$") # xlabel=r"t $(\mu s)$", axs1[i].set(ylabel = r"Relative error $(\mu m)$") # xlabel=r"t $(\mu s)$",
axs1[1].set_xlabel(r"t $(\mu s)$") axs1[1].set_xlabel(r"t $(\mu s)$")
axs1[i].legend() axs1[i].legend(loc="upper right")
# axs1[i].set_title(title) # axs1[i].set_title(title)
conv_rate = 1/3 * sum([np.log10(max_err[i+1]/max_err[i])/np.log10(.5) for i in range(3)]) conv_rate = 1/3 * sum([np.log10(max_err[i+1]/max_err[i])/np.log10(.5) for i in range(3)])
print(conv_rate) print(conv_rate)
# fig1.savefig("../latex/images/phase_space_2_particles_x.pdf") fig1.savefig("../latex/images/relative_error.pdf")
plt.show() # plt.show()
if __name__ == "__main__": if __name__ == "__main__":