/// <summary>Creates a specific <see cref="OneDimEquationSolver.IFunction" /> object. /// </summary> /// <param name="objectiveFunction">The differentiable objective function.</param> /// <returns>A specific <see cref="OneDimEquationSolver.IFunction" /> object with respect to the specified optimization algorithm.</returns> public OneDimEquationSolver.IFunction Create(OneDimEquationSolver.DifferentiableObjectiveFunction objectiveFunction) { if (objectiveFunction == null) { throw new ArgumentNullException(nameof(objectiveFunction)); } return(new OneDimRootFinderDifferentiableFunction(this, objectiveFunction)); }
/// <summary>Initializes a new instance of the <see cref="OneDimRootFinderDifferentiableFunction"/> class. /// </summary> /// <param name="functionFactory">The objective function descriptor, i.e. the <see cref="OneDimRootFinderFunctionFactory"/> object that served as factory for the current object.</param> /// <param name="objectiveFunction">The objective function.</param> internal OneDimRootFinderDifferentiableFunction(OneDimRootFinderFunctionFactory functionFactory, OneDimEquationSolver.DifferentiableObjectiveFunction objectiveFunction) : base(functionFactory, x => { double dummy; return(objectiveFunction(x, out dummy)); }) { m_DifferentiableObjectiveFunction = objectiveFunction ?? throw new ArgumentNullException(nameof(objectiveFunction)); }