Skip to content

Instantly share code, notes, and snippets.

@cpellet
Last active May 10, 2021 08:59
Show Gist options
  • Save cpellet/4219e8b13afb566cc7ae7eaaacae2ec7 to your computer and use it in GitHub Desktop.
Save cpellet/4219e8b13afb566cc7ae7eaaacae2ec7 to your computer and use it in GitHub Desktop.
Convergence: ek vs k (linear)
N = np.arange(0,15,1)
err1 = (1./2) ** N
err2 = (1./7) ** N
err3 = (1./2) ** (2**N) 5
fig = plt.figure(figsize=(12, 8))
plt.plot(N, err1, marker="o", label='error for $x_k$')
plt.plot(N, err2, marker="o", label=r'error for $\bar{x}_k$')
plt.plot(N, err3, marker="o", label=r'error for $\hat{x}_k$')
plt.legend(loc='upper right', fontsize=18)
plt.xlabel('k', fontsize=18)
plt.ylabel('$e_{k}$', fontsize=18)
plt.title('Convergence', fontsize=18)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment