Пример #1
0
        /// <summary>
        /// Creates a function and its first 2 derivatives
        /// </summary>
        /// <param name="function"></param>
        public ArithmaticFunction(string function)
        {
            Function = function;

            derivative      = DerivativeSolver.GetDerivative(function);
            cleanDerivative = Cleaner.Clean(derivative);

            secondDerivative      = DerivativeSolver.GetDerivative(derivative);
            cleanSecondDerivative = Cleaner.Clean(secondDerivative);

            derivativeMode = ArithmaticFunctionDerivativeMode.Two;
        }
Пример #2
0
        /// <summary>
        /// Creates a function and a given amount of derivatives
        /// </summary>
        /// <param name="function"></param>
        /// <param name="mode"></param>
        public ArithmaticFunction(string function, ArithmaticFunctionDerivativeMode mode)
        {
            Function = function;

            if (mode == ArithmaticFunctionDerivativeMode.One || mode == ArithmaticFunctionDerivativeMode.Two)
            {
                derivative      = DerivativeSolver.GetDerivative(function);
                cleanDerivative = Cleaner.Clean(derivative);
            }

            if (mode == ArithmaticFunctionDerivativeMode.Two)
            {
                secondDerivative      = DerivativeSolver.GetDerivative(derivative);
                cleanSecondDerivative = Cleaner.Clean(secondDerivative);
            }

            derivativeMode = mode;
        }
Пример #3
0
 /// <summary>
 /// Returns the clean 2nd derivative of a function
 /// </summary>
 /// <param name="func"></param>
 /// <returns></returns>
 public static string Get2ndDerivative(string func)
 {
     return(Cleaner.Clean(Get2ndDerivativeRaw(func)));
 }