예제 #1
0
 private void DrawFunction(LambdaFunc func, Color color)
 {
     for (double i = 20; i < canvasBox.Width - 20; i += 1)
     {
         graphics.DrawLine(new Pen(color, 2), (float)i, canvasBox.Height - func(i), (float)(i + 1), canvasBox.Height - func(i + 1));
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            int x1 = 1, x2 = 9, delta = 1;


            ClassFunc func = new ClassFunc();
            string    str  = "";

            func.Calc(x1, x2, delta);
            for (int i = 0; i < func.X.Length; i++)
            {
                str += func.X[i] + " ";
            }

            LambdaFunc lambda = (x) => x * x;

            LambdaFuncs lambdas = (lx1, lx2, ldelta) =>
            {
                List <int> lst  = new List <int>();
                string     lstr = "";
                for (int i = x1; i <= x2; i += delta)
                {
                    lstr += lambda(i) + " ";
                }
                return(lstr);
            };

            Console.WriteLine(str);
            Console.WriteLine(lambdas(x1, x2, delta));
            Console.Read();
        }
예제 #3
0
파일: Form1.cs 프로젝트: KartonDCP/CStasks
 private void DrawFunction(LambdaFunc func)
 {
     for (double i = 20; i < pictureBox1.Width - 20; i += 3)
     {
         _graphics.DrawLine(Pens.BlueViolet, (float)i, pictureBox1.Height - func(i), (float)(i + 1), pictureBox1.Height - func(i + 1));
         Task.Delay(1);
     }
 }
예제 #4
0
        public void print()
        {
            LambdaFunc func = delegate() {
                Console.WriteLine("run lambda func");
            };

            func();
        }
예제 #5
0
파일: Form1.cs 프로젝트: KartonDCP/CStasks
 private void DrawFunction(LambdaFunc func, Color color)
 {
     new Task(() =>
     {
         for (double i = 20; i < pictureBox1.Width - 20; i += 1)
         {
             _graphics.DrawLine(new Pen(color, 2), (float)i, pictureBox1.Height - func(i), (float)(i + 1), pictureBox1.Height - func(i + 1));
             Task.Delay(1);
         }
     }).Start();
 }
예제 #6
0
        public void DrawInterpolation(LambdaFunc func, float step)
        {
            DrawFunction((x) => (float)(50 * func(x / 100) + 100),
                         Color.Black);

            double[] pointsX = new double[] { 0, Math.PI / 2, Math.PI, Math.PI * 3 / 2, Math.PI * 2 };
            double[] pointsY = new double[] { func(pointsX[0]), func(pointsX[1]), func(pointsX[2]), func(pointsX[3]), func(pointsX[4]) };


            DrawFunction((x) => (float)(50 * NewtonMethod.Newton(x / 100, pointsX, pointsY, (float)step) + 100), Color.Red);

            DrawFunction((x) => (float)(50 * LagrangeMethod.Langrange(x / 100, pointsX, pointsY, (float)step - 0.6f) + 100), Color.Green);
        }
예제 #7
0
 public LambdaComparer(LambdaFunc comparer)
 {
     this.comparer = comparer;
 }
예제 #8
0
 // This constructor should only be used for input layer
 public Lambda(Shape[] inputShapes, Shape outputShape, LambdaFunc processInputsFunc, LambdaBackpropFunc backPropOutputGradientFunc, ActivationFunc activation = null)
     : base(inputShapes, outputShape, activation)
 {
     ProcessInputsFunc          = processInputsFunc;
     BackPropOutputGradientFunc = backPropOutputGradientFunc;
 }