static void Main(string[] args)
 {
     Console.WriteLine("Calculate by Newton");
     Console.WriteLine(Newton.Calculate(2, 10, 0.000000001));
     Console.WriteLine("Calculate by Math.Pow");
     Console.WriteLine(Math.Pow(2, 1 / 10.0));
     Console.ReadKey();
 }
Ejemplo n.º 2
0
        private void buttonCalc_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                points = new List <Point>();
                xValues.ItemsSource = XPoints;
                yValues.ItemsSource = YPoints;
                string s = "";
                solutions.Clear();
                if (radioButtonGold.IsChecked.Value)
                {
                    log = dih.Log;
                    for (double i = 0; i <= XPoints.Last(); i += 0.1)
                    {
                        points.Add(new Point(i, dih.Calculate(i, XPoints, YPoints)));
                    }
                }
                else
                {
                    combo.Clear();
                    log = combo.Log;
                    for (double i = 0; i < XPoints.Last(); i += 0.1)
                    {
                        points.Add(new Point(i, combo.Calculate(i, XPoints, YPoints)));
                    }
                }

                s += "\nОтвет: \n";
                foreach (Point p in points)
                {
                    s += Math.Round(p.X, 2) + "      " + Math.Round(p.Y, 2) + "\n";
                }
                textBoxSols.Text = s;
                buttonDraw_Click(sender, new RoutedEventArgs());
            }
            catch
            {
            }
        }