Esempio n. 1
0
    /// * @Precondición Los números de la nube de puntos deben estar ordenados en el eje X y como mínimo la nube de puntos debe tener 2 puntos.
    public static System.Func <float, float> BuildLagrange(Vector2[] cloudOfPoints)
    {
        float[] xVals = (from point in cloudOfPoints select point.x).ToArray();
        float[] yVals = (from point in cloudOfPoints select point.y).ToArray();
        LagrangeInterpolation lagrange = new LagrangeInterpolation(xVals, yVals);

        return((float x) => lagrange.valueOf(x));
    }
Esempio n. 2
0
        static void lab1()
        {
            var lagrange = new LagrangeInterpolation(Functions.f1, Constants.Xi);
            var newton   = new NewtonInterpolation(Functions.f1, Constants.Xi);

            Console.WriteLine($"Ln({Constants.X}) = {lagrange.GetResult(Constants.X)}");
            Console.WriteLine();
            Console.WriteLine($"Pn({Constants.X}) = {newton.GetResult(Constants.X)}");
            Console.WriteLine();
            Console.WriteLine($"ln({Constants.X}) = {Math.Log(Constants.X)}");
            Console.ReadLine();
            //var spline = new SplineInterpolation();
        }
Esempio n. 3
0
        private void BeginLagrangeInterpolationTest(LagrangeInterpolationTestUnit liTestUnit, ListBox logsBox)
        {
            LagrangeInterpolation lagrangeInterpolation = new LagrangeInterpolation();

            for (int i = 0; i < liTestUnit.FileToTest.Count; i++)
            {
                try
                {
                    if (!lagrangeInterpolation.LoadFile(liTestUnit.FileToTest[i].Path, liTestUnit.FileToTest[i].FileType))
                    {
                        logsBox.Items.Add("Error, File Load Fail");
                    }
                    else
                    {
                        logsBox.Items.Add("File Was Loaded");
                    }

                    if (!lagrangeInterpolation.GenerateFunctionExpression())
                    {
                        logsBox.Items.Add("Error, Function Fail");
                    }
                    else
                    {
                        logsBox.Items.Add("Function Pass:"******"Error");
                    }
                }
            }
        }