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)); } }
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(); }
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); } }
public void print() { LambdaFunc func = delegate() { Console.WriteLine("run lambda func"); }; func(); }
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(); }
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); }
public LambdaComparer(LambdaFunc comparer) { this.comparer = comparer; }
// 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; }