Closed cgd8d closed 8 years ago
which indicates that “21” should be changed to “32”
I don't think so, as Wolfram doesn't give the coefficient for the quadratic term. I am also not sure that it is sufficient to consider the expansion for n=\infty only. On the other hand, I am almost certain that the formula used in the code is triple-checked to be accurate (enough) in particular also for any given finite dimension.
Your expression has a leading sqrt(N), so both you and Wolfram provide n^0.5, n^-0.5, and n^-1.5 terms. But you are right: for N <= 4, your expression is more accurate: http://www.wolframalpha.com/input/?i=plot+abs%28sqrt%28n%29*%281-1%2F%284*n%29%2B1%2F%2821*n%5E2%29%29+-+sqrt%282%29*gamma%28%28n%2B1%29%2F2%29%2Fgamma%28n%2F2%29%29%2C+abs%28sqrt%28n%29*%281-1%2F%284*n%29%2B1%2F%2832*n%5E2%29%29-sqrt%282%29*gamma%28%28n%2B1%29%2F2%29%2Fgamma%28n%2F2%29%29%2C+n%3D0+to+10.
So, fair point. I assumed it was a straightforward expansion, but clearly some extra thought went into it which I missed.
cmaes.c uses the formula (https://github.com/CMA-ES/c-cmaes/blob/0be438f8276cad559a4c220b7f683e23874605db/src/cmaes.c#L313):
The number “21” is also used in your tutorial at https://www.lri.fr/~hansen/cmatutorial.pdf. However, I believe that it is not the correct asymptotic expansion of chiN. See http://www.wolframalpha.com/input/?i=series+expansion+for+sqrt%282%29*gamma%28%28n%2B1%29%2F2%29%2Fgamma%28n%2F2%29+at+n%3Dinfinity, which indicates that “21” should be changed to “32”.
Alternatively, C99 standardizes the tgamma function, so if you assume C99 compilers then it could be replaced entirely with
or, for to avoid overflow with roughly N > 340, the slightly less accurate