def mesh_nist3_direct(r_min, r_max, N): """ Calculates the NIST III mesh directly. """ exp = numpy.exp log = math.log # Uniform mesh in rho: rho = mesh_exp(log(r_min), log(r_max), a=1, N=N) r = exp(rho) return r
def mesh_exp2(r_min, r_max, a, N): """ Calculates the exponential mesh using a formula: r_n = (a**(n/N) - 1) / (a - 1) with a > 1. By substitution a -> a**((N-1.)/N), we can just call mesh_exp(). """ a = float(a) assert a > 1 assert N >= 1 return mesh_exp(r_min, r_max, a**((N-1.)/N), N)