Esempio n. 1
0
        private void ComputeBtn_Click(object sender, EventArgs e)
        {
            poly = new Poly();
            try
            {
                poly.ParsePoly(PolyInput.Text);

                poly.FindInterval();
                IntervalOutput.ResetText();
                IntervalOutput.Text = " [ " + poly.interval.Item1 + ", " + poly.interval.Item2 + " ]";

                for (int i = 0; i < 500; i++)
                {
                    poly.ComputeHalley();
                }

                RootsOutput.ResetText();
                foreach (var r in poly.roots)
                {
                    RootsOutput.Text += r.Value.ToString() + '\n';
                }
            }
            catch
            {
                MessageBox.Show("Input is not valid!");
            }
        }
Esempio n. 2
0
        public static void TestParsePoly(string p)
        {
            Poly poly = new Poly();

            poly.ParsePoly(p);
            Console.WriteLine("Test ParsePoly");
            foreach (var c in poly.Coefficients)
            {
                Console.WriteLine(c.Value + " :: x^" + c.Key);
            }

            poly.FindInterval();
            for (int i = 0; i < 500; i++)
            {
                poly.ComputeHalley();
            }

            foreach (var x in poly.roots)
            {
                System.Console.WriteLine(x.Value);
            }

            //Test write in file
            //poly.WriteSolutionInFile("test1");
        }