/// <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; }
/// <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; }
/// <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))); }