private void button9_Click(object sender, EventArgs e) { Polynom temp = radioButton1.Checked ? p : radioButton2.Checked ? f : result; string answer = "f" + label7.Text + " " + temp.GetRepresentation() + "\n"; try { List <string> letters = prepareLetters(); List <double> nums = textBox7.Text.Split(' ').Select(StringToDouble).ToList(); if (letters.Count() > nums.Count()) { return; } answer += "f(" + string.Join(", ", nums) + ") = " + letters.Aggregate(temp.GetRepresentation(), (x, y) => x.Replace(y, "(" + nums[letters.IndexOf(y)].ToString() + ")")) + " = "; answer += temp.GetNodes().Select(x => x.GetK() * x.GetCopiedDict().Select(kv => kv.Key == "" ? 1 : Math.Pow(nums[letters.IndexOf(kv.Key)], kv.Value)).Sum()).Sum().ToString(); MessageBox.Show(answer, "Значение функции в точке"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ввод аргументов функции"); } }
private void button7_Click(object sender, EventArgs e) { if (radioButton1.Checked) { f = new Polynom(p.GetNodes()); } if (radioButton2.Checked) { p = new Polynom(f.GetNodes()); } if (radioButton3.Checked) { var temp = new Polynom(f.GetNodes()); f = new Polynom(p.GetNodes()); p = new Polynom(temp.GetNodes()); } prepareLetters(); textBox3.Text = p.GetRepresentation(); textBox4.Text = f.GetRepresentation(); }