Skip to content

Instantly share code, notes, and snippets.

View cpellet's full-sized avatar
🎯
Focusing

Cyrus Pellet cpellet

🎯
Focusing
View GitHub Profile
@cpellet
cpellet / c1.py
Last active May 10, 2021 08:59
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)
@cpellet
cpellet / c2.py
Created May 10, 2021 08:58
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)