//TODO try another method private List <Complex> FourthPower(Equation eq) { List <Complex> solution = new List <Complex>(); double x1 = -100, x2 = 100, e = 0.001, c = 0; int i = 0; //for (int j = 0; j < 4; j++) { while (Math.Abs(c - x2) > e || i < 100) { c = (x1 + x2) / 2; if (eq.FunctionValue(x1) * eq.FunctionValue(c) < 0) { x2 = c; } else if (eq.FunctionValue(c) * eq.FunctionValue(x2) < 0) { x1 = c; } else { solution.Add((x1 + x2) / 2); break; } i++; } } // solution=solution.Distinct() as List<Complex>; return(solution); }
public Complex DegreeEquation(Complex x) { Complex valueY = 0; valueY = Variables.FunctionValue(x); return(valueY); }
public void Print(List <Complex> a, Equation eq) { dataGridView1.Rows.Clear(); for (int i = 0; i < a.Count; i++) { dataGridView1.Rows.Add(); dataGridView1[0, i].Value = $"x({i+1})={a[i]}"; dataGridView1[1, i].Value = $"f({a[i]})={eq.FunctionValue(a[i])}"; } }