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