Skip to content
Snippets Groups Projects

harmonic_oscillator_plot

Merged Sathish Kumar RK requested to merge plot_harmonic_oscillator into master
2 unresolved threads
+ 3
3
@@ -108,8 +108,6 @@ V = 0.5*(omega**2)*(x**2)
fig, ax = pyplot.subplots(figsize=(10, 7))
ax.plot(x, V) #plot harmonic potential
for i in range(no_states):
ax.hlines(h0_ener(i), x[0], x[len(x)-1], linestyles='dotted', colors='k')
@@ -139,8 +137,10 @@ for i in range(no_states):
xytext=(x[0]+1/2, h0_ener(i-1)),
arrowprops=dict(arrowstyle="<->"))
ax.fill_between(x, h0_ener(i), ho_evec(x, i, no_states) + h0_ener(i))
ax.fill_between(x, h0_ener(i), ho_evec(x, i, no_states) + h0_ener(i), alpha=0.5)
ax.plot(x, V, 'k', linewidth=1) #plot harmonic potential
# Move left y-axis and bottim x-axis to centre, passing through (0,0)
ax.spines['left'].set_position('center')
ax.spines['bottom'].set_position(('data', 0.0))
Loading