Esempio n. 1
0
    static int Main(string[] Args)
    {
        // Read data from input file
        string        s;
        List <double> x = new List <double>();
        List <double> y = new List <double>();

        do
        {
            s = ReadLine();
            if (s != null)
            {
                string[] words = s.Split('\t');
                x.Add(double.Parse(words[0]));
                y.Add(double.Parse(words[1]));
            }
        }while(s != null);
        // Make cubic spline
        CubicSpline Spline = new CubicSpline(x, y);
        // Write data
        double eps = 1.0 / 8;

        for (double z = x[0]; z <= x[x.Count - 1]; z += eps)
        {
            WriteLine(
                $"{z} {Spline.spline(z)} {Spline.derivative(z)} {Spline.integral(z)}");
        }
        return(0);
    }