public void CanSolveTameQuadratic1dFact() { var n2Sol = new Math.Solvers.NewtonRaphsonMultiDimensionalSolver { ObjectiveFunction = QuadraticFunction1d, InitialGuess = new double[] { 0 }, Tollerance = 1e-8 }; var output = n2Sol.Solve(); var functionOutput = QuadraticFunction1d(output); Assert.Equal(0, functionOutput[0], 8); }
private void FitWeights() { Func <double[], double[]> errFunc = (weights => { return(_x.Select((x, ix) => GKernInterpolate(x, _x, weights, _bandwidth) - _y[ix]).ToArray()); }); var n2Sol = new Math.Solvers.NewtonRaphsonMultiDimensionalSolver { InitialGuess = Enumerable.Repeat(1.0 / _x.Length, _x.Length).ToArray(), ObjectiveFunction = errFunc }; _weights = n2Sol.Solve(); }