Exemple #1
0
        public static Func <double, double> Get2(int n)
        {
            double One(double x) => 1;

            if (n == 0)
            {
                return(One);
            }

            double X(double x) => x;

            if (n == 1)
            {
                return(X);
            }

            n = n - 1;
            var pow2 = (int)Math.Pow(2, Math.Floor(Math.Log(n, 2)));

            double Sobolev(double x)
            {
                return(Walsh.Get(n - pow2)(x) * W12(pow2 * x) / pow2);
            }

            return(Sobolev);
        }
Exemple #2
0
        public static Func <double, double> Get(int n)
        {
            double One(double x) => 1;

            if (n == 0)
            {
                return(One);
            }

            var nodesCount = (int)Math.Pow(2, (int)Math.Ceiling(Math.Log(n, 2)) + 6);
            var nodes      = Enumerable.Range(0, nodesCount).Select(j => j * 1.0 / nodesCount);

            double Sobolev(double x)
            {
                return(Integrals.Rectangular(Walsh.Get(n - 1), nodes.Where(node => node <= x).ToArray(),
                                             Integrals.RectType.Center));
            }

            return(Sobolev);
        }