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");
        }
 public static double Derivative(RealFunction targetFunction, double x)
 {
     if (targetFunction == null)
     {
         throw new ArgumentNullException("targetFunction");
     }
     return(NumericalDifferentiator.Derivative(targetFunction, x, DifferencesDirection.Central));
 }
        public static double CentralDerivative(RealFunction targetFunction, double x)
        {
            double num1;

            if (targetFunction == null)
            {
                throw new ArgumentNullException("targetFunction");
            }
            return(NumericalDifferentiator.CentralDerivative(targetFunction, x, out num1));
        }
        public static RealFunction CreateForwardDelegate(RealFunction targetFunction)
        {
            if (targetFunction == null)
            {
                throw new ArgumentNullException("targetFunction");
            }
            NumericalDifferentiator differentiator1 = new NumericalDifferentiator(targetFunction);

            return(new RealFunction(differentiator1.FormardDerivative));
        }
 private double CentralDerivative(double x)
 {
     return(NumericalDifferentiator.CentralDerivative(this._function, x));
 }
 private double FormardDerivative(double x)
 {
     return(NumericalDifferentiator.ForwardDerivative(this._function, x));
 }
Exemplo n.º 7
0
 private Function CalculateNumericalDerivative()
 {
     return(new Explicit2DFunction(
                NumericalDifferentiator.CreateDelegate(_function)));
 }