Пример #1
0
        public override double GetDistance(Rational r)
        {
            double[] coefs = new double[] {
                //1.0, 1.1, 1.2
                //1.0, 0.9, 0.8
            };
            double d       = 0.0;

            //int[] pows = r.GetPrimePowers();
            int[] pows = r.GetNarrowPowers();
            for (int i = 0; i < pows.Length; ++i)
            {
                int    e = pows[i];
                double c = i < coefs.Length ? coefs[i] : 1.0;
                d +=
                    e * e
                    * Math.Exp(-e * 0.01) // make a bit non-commutative to fix the order (avoiding blinking on count increase) - seems needed only if use "overage" in GridDrawer.GenerateItems
                    * Math.Exp(i * 0.011)
                    * c;
            }
            return(Math.Sqrt(d));
        }
Пример #2
0
 public Pow[] GetNarrowPowers(Rational r)
 {
     return(r.GetNarrowPowers(_narrows));
 }