Esempio n. 1
0
        static void Main(string[] args)
        {
            double target       = 9.0 / 25;
            approx approximator = new approx(0, 20, 1e-12, target, 50, "");

            if (approximator.getApprox())
            {
                Console.WriteLine("Found value: {0:E12}", approximator.result);
            }
            else
            {
                Console.WriteLine("Approximate value not found after 50 tries.");
            }
        }
Esempio n. 2
0
        public static double Solve(double m)
        {
            double step = 0.2;
            double e    = 1e-12;
            double diff = 0.0;
            int    n    = 50;
            double sum;

            approx approximator = new approx(0, 1, e, m, n);

            if (approximator.getApprox())
            {
                return(approximator.result);
            }
            else
            {
                return(-1);
            }
        }