00001 #ifndef EVOLUTION_H 00002 #define EVOLUTION_H 00003 00004 #include <cmath> 00024 double GrishinDistance(double q, double err=0.0000001) { 00025 double x=1-q; 00026 double xx=-1; 00027 while (std::abs(xx-x) > err) { 00028 xx=x; 00029 x -= (1+2*x)*(x*log(1+2*x)-2*x*x*q)/(2*x-(1+2*x)*log(1+2*x)); 00030 } 00031 return x; 00032 } 00033 #endif 00034
1.5.6