from math import e def Extrapolation(h1,p): g1=(e**(-(1+h1))-2*e**(-1)+e**(-(1-h1)))/(h1**2) h2=h1/2 g2=(e**(-(1+h2))-2*e**(-1)+e**(-(1-h2)))/(h2**2) return (((2**p)*g2)-g1)/(2**p-1) Extrapolation(0.64,2) def G(h): cda = {0.64:0.380610, 0.32:0.371035, 0.16:0.368711, 0.08:0.368281, 0.04:0.36875, 0.02:0.37, 0.01:0.38, 0.005:0.40, 0.0025:0.48, 0.00125:1.28} return cda[h] def RichExtra(h,p): return (((2**p)*G(h/2))-G(h))/(2**p-1) RichExtra(0.64,2) ####Output 0.36784333333333336