MathTree - is an assembly that is included in MEEL, it provided all computing operations. MathTree isn`t attached to the user interface, it is convenient, for example, when we use server-side application or a multi-threaded computing.
All mathematical expressions are provided as symbolic expressions in the calculation simplified the expression first, and only then substituted for specific values, which provides maximum precision calculations.
Code to math expression
MathTree is not only a storage library, computing and data analysis. Code written in C#:
- IExpression expression = new Div(new ScalarAttrInt("x"), new ScalarConstInt(95) + new ScalarAttrInt("y"));
Thus, supported by correspondence between code in C # and mathematical expression introduced by the user directly into editor.
Computing metod - Execute(), Execute(MathAttributeCollection attributes)
To calculate the current formula it is necessary to specify attribute values ????of x and y.
This can be done in various ways.
A string representation of the expression can be obtained by calling GetText()
- string text = expression.GetText();
- // text = "x/(95+y)"
There is an inverse method of GetText (), it is BaseExpression.Parse(string strExpr)
Where strExpr - is a string view of the formula.
The next entries are equivalent:
- IExpression expression1 = new Div(new ScalarAttrInt("x"), new ScalarConstInt(95) + new ScalarAttrInt("y"));
- // are is equivalent
- IExpression expression2 = BaseExpression.Parse("x/(95+y)");