Ejemplo n.º 1
0
        public static double Derivative(RealFunction targetFunction, double x, DifferencesDirection direction)
        {
            if (targetFunction == null)
            {
                throw new ArgumentNullException("targetFunction");
            }
            switch (direction)
            {
            case DifferencesDirection.Backward:
            {
                return(NumericalDifferentiator.BackwardDerivative(targetFunction, x));
            }

            case DifferencesDirection.Central:
            {
                return(NumericalDifferentiator.CentralDerivative(targetFunction, x));
            }

            case DifferencesDirection.Forward:
            {
                return(NumericalDifferentiator.ForwardDerivative(targetFunction, x));
            }
            }
            throw new ArgumentOutOfRangeException("direction");
        }
Ejemplo n.º 2
0
        public static double BackwardDerivative(RealFunction targetFunction, double x)
        {
            double num1;

            if (targetFunction == null)
            {
                throw new ArgumentNullException("targetFunction");
            }
            return(NumericalDifferentiator.BackwardDerivative(targetFunction, x, out num1));
        }
Ejemplo n.º 3
0
 private double BackwardDerivative(double x)
 {
     return(NumericalDifferentiator.BackwardDerivative(this._function, x));
 }