Example #1
0
        static void Test_2(int m)
        {
            int  i, n = 20;
            CLTF cos = new CLTF(-3.0, 3.0, n, F314, " Test_2");

            SW.Write(" Интерполяцияю Полином лагранжа {0}-го порядка:", m);
            string txt = "\r\n"; double xz, fz, Ln, err;

            for (i = 1; i <= n; i++)
            {
                xz   = 0.5 * (cos.Points[i - 1].X + cos.Points[i].X);
                Ln   = CLIn.Polynomial_Lagrange(m, xz, cos.Points);
                fz   = F314(xz);
                err  = Math.Abs(Ln - fz);
                txt += $"{i,4}{xz,8:F3}{fz,18:F12}{Ln,18:F12}{err,18:F12}\r\n";
            }
            SW.Write(txt);
            SW.Close();
        }
Example #2
0
        static void Test_1()
        {
            CLTF table = new CLTF(-1.5, 1.5, 5, F311, " Test_1");

            table.Roots_correction(1.0E-10);
            SW.WriteLine(table.Table_of_Function());

            SW.WriteLine("\r\n Інтерполяція за Лагранжем: ");
            double xz, fz, Ln, err; string txt = "";

            for (int i = 1; i < table.Length; i++)
            {
                xz   = 0.5 * (table.Points[i - 1].X + table.Points[i].X);
                fz   = F311(xz);
                Ln   = CLIn.Polynomial_Lagrange(xz, table.Points);
                err  = Math.Abs(Ln - fz);
                txt += $"{i,4}{xz,8:F3}{fz,18:F12}{Ln,18:F12}{err,18:F12}\r\n";
            }
            SW.Write(txt);
            SW.Close();
        }
Example #3
0
 public static double L316(double x)
 {
     return(CLIn.Polynomial_Lagrange(m, x, Table_G.Points));
 }