public ResultObject StartAbsWithLog(Complex x) { ResultObject res = new ResultObject(); int count = 0; res.LoopLog.Add(x); while (f(x).Magnitude > eps) { count++; if (count >= max) { return ResultObject.NotConverge; } x -= f(x) / df(x); res.LoopLog.Add(x); } res.ConvergenceValue = x; res.LoopCount = count; return res; }
public ResultObject StartRelWithLog(Complex x) { ResultObject res = new ResultObject(); int count = 0; res.LoopLog.Add(x); count++; Complex x1 = x; Complex x2 = x1 - f(x1) / df(x1); res.LoopLog.Add(x2); while (((x2 - x1).Magnitude / x2.Magnitude) > eps) { count++; if (count >= max) { return ResultObject.NotConverge; } x1 = x2; x2 = x1 - f(x1) / df(x1); res.LoopLog.Add(x2); } res.ConvergenceValue = x2; res.LoopCount = count; return res; }