Solve Equations Expressed as strings, branch equations for custom evaluations. Equations can be mathmatical, boolean/comparison, with logical ANDs and ORs.
See: Documentation: http://www.bluejaysvc.com/OpenSource/ConceptualEquationSolver
See: Nuget: https://www.nuget.org/packages/EquationSolver/
The libray is built with .Net Standard. It uses a forward only parser for expressions so it is very fast and since it is small it is well suited to mobile applications that get the equations from a service the application applying values to variables in the equation.
Calculation in Expressions follow the common order of operations (PEMDAS) (see: https://study.com/academy/lesson/order-of-operations.html)
Example (the Quadratic formula): ((b*-1) - sqrt(b^2 - 4*a*c))/(2*a)
Note: This library supports parentheses and nested parentheses
To use:
UseExpression - a string expression that must evaluate to a true or false. If this UseExpression evaluates to true then the equation and the inner equations are executed.
Expression - a string that produces a value (number, boolean, or text), the value is then assigned to the Variable named in Target.
Target - the variable name to hold the value calculated from the Expression.
MoreEquations - a collection of Equations that will be executed if this equation executes. (provides a tree of equations)
Example:
EquationProject project = new EquationProject()
{
Title = "Mulitply Divide Project",
Equations = new List<Equation>()
{
new Equation()
{
UseExpression = "true",
Expression = "2 * 1",
Target = "T1"
}
}
};
IEquationSolver solver = EquationSolverFactory.Instance.CreateEquationSolver(project);
solver.SolveEquations();
var myCalculatedDecimal = solver.Variables["T1"].DecimalValue