Skip to content

Instantly share code, notes, and snippets.

@cpellet
Created May 10, 2021 08:58
Show Gist options
  • Save cpellet/17638a2979a2649eef3106d575db0f50 to your computer and use it in GitHub Desktop.
Save cpellet/17638a2979a2649eef3106d575db0f50 to your computer and use it in GitHub Desktop.
Convergence: log(ek) vs k
N = np.arange(0,6,1) 2 x1=(1./2)**N
x2=(1./7)**N
x3 = (1./2) ** (2**N)
fig = plt.figure(figsize=(12, 8))
plt.plot(N, x1, marker="o", label='error for $x_k$')
plt.plot(N, x2, marker="o", label=r'error for $\bar x_k$')
plt.plot(N, x3, marker="o", label=r'error for $\hat x_k$')
plt.legend(loc='lower left', fontsize=18)
plt.xlabel('k', fontsize=18)
plt.ylabel('$e_{k}$', fontsize=18)
plt.yscale('log')
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