import numpy as np
C = 1/2
e0 = 0.1*np.random.rand()
order = 1
e = e0
for i in range(20):
print(e)
e = C*e**order
rate=1,2,3
?Now let's see if we can figure out the convergence order from the data.
Here's a function that spits out some fake errors of a process that converges to $q$th order:
def make_rate_q_errors(q, e0, n=10, C=0.7):
errors = []
e = e0
for i in range(n):
errors.append(e)
e = C*e**q
return errors
errors = make_rate_q_errors(1, e0)
for e in errors:
print(e)
for i in range(len(errors)-1):
print(errors[i+1]/errors[i])