private void GetSolveA_OnClick(object sender, RoutedEventArgs e) { try { Computing.Coefficients = new[] { Convert.ToDouble(CoeffA0.Text), Convert.ToDouble(CoeffA1.Text), Convert.ToDouble(CoeffA2.Text), Convert.ToDouble(CoeffA3.Text), Convert.ToDouble(CoeffA4.Text), Convert.ToDouble(CoeffA5.Text) }; switch (Convert.ToByte(PowerComboBox.Text)) { case 2: Computing.GetSolveSecondPowEq(); Pop_AnAnswers(); break; case 3: Computing.GetSolveThirdPowEq(); Pop_AnAnswers(); break; case 4: case 5: MessageBox.Show("Тут только численные решения :("); break; } } catch (FormatException exception) { MessageBox.Show("Проверьте правильно ли введены степень и коэффициенты?"); } }
private void Check_OnClick(object sender, RoutedEventArgs e) { string check = ""; foreach (var root in Computing.Roots) { if (root[root.Length - 1] != 'i') { check += $"y({root}) = {string.Format("{0:N10}",Computing.F(Convert.ToDouble(root)))}\n"; } } CheckBlock.Text = check; }
private void GetGraph_OnClick(object sender, RoutedEventArgs e) { var power = Convert.ToByte(PowerComboBox.Text); TextBox[] textBoxs = { CoeffA0, CoeffA1, CoeffA2, CoeffA3, CoeffA4, CoeffA5 }; List <double> A = new List <double>(); for (int k = 0; k <= power; k++) { A.Add(Convert.ToDouble(textBoxs[k].Text)); } Computing T = new Computing(A, power); var newModel = new PlotModel(); double xMin, xMax, yMin, yMax; xMax = Convert.ToDouble(XMAX.Text); xMin = Convert.ToDouble(XMIN.Text); yMax = Convert.ToDouble(YMAX.Text); yMin = Convert.ToDouble(YMIN.Text); newModel.Axes.Clear(); newModel.Axes.Add(new LinearAxis() { Position = AxisPosition.Bottom, PositionAtZeroCrossing = true, AxislineStyle = LineStyle.Solid, FilterMaxValue = xMax, FilterMinValue = xMin }); newModel.Axes.Add(new LinearAxis() { Position = AxisPosition.Left, PositionAtZeroCrossing = true, AxislineStyle = LineStyle.Solid, FilterMaxValue = yMax, FilterMinValue = yMin }); newModel.Axes[0].Reset(); newModel.Axes[1].Reset(); newModel.Axes[0].Maximum = xMax; newModel.Axes[0].Minimum = xMin; newModel.Axes[1].Maximum = yMax; newModel.Axes[1].Minimum = yMin; PlotView.InvalidatePlot(); newModel.Series.Add(new FunctionSeries(T.FxP, xMin - 100, xMax + 100, 0.1)); PlotView.Model = newModel; }
private void GetSolveD_OnClick(object sender, RoutedEventArgs e) { try { Computing.Coefficients = new[] { Convert.ToDouble(CoeffA0.Text), Convert.ToDouble(CoeffA1.Text), Convert.ToDouble(CoeffA2.Text), Convert.ToDouble(CoeffA3.Text), Convert.ToDouble(CoeffA4.Text), Convert.ToDouble(CoeffA5.Text) }; Computing.GetIntervals(Convert.ToDouble(IntervalA.Text), Convert.ToDouble(IntervalB.Text)); Computing.HalfDivision(double.Parse(Accurate.Text, CultureInfo.InvariantCulture)); Pop_DiAnswers(); } catch (FormatException exception) { MessageBox.Show("Ошибка ввода."); } }