def chin(self):
"""approximation of the expected length.
The exact value could be computed by::
from scipy.special import gamma
return 2**0.5 * gamma((self.dimension+1) / 2) / gamma(self.dimension / 2)
The approximation obeys ``chin < chin_hat < (1 + 5e-5) * chin``.
"""
values = {1: 0.7978845608028656, 2: 1.2533141373156,
3: 1.59576912160574, 4: 1.87997120597326}
try:
val = values[self.dimension]
except KeyError:
# for dim > 4 we have chin < chin_hat < (1 + 5e-5) * chin
N = self.dimension
val = N**0.5 * (1 - 1. / (4 * N) + 1. / (26 * N**2)) # was: 21
return val
评论列表
文章目录