MathTree

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#:

  1. IExpression expression = new Div(new ScalarAttrInt("x"), new ScalarConstInt(95) + new ScalarAttrInt("y"));

Present as:

Thus, supported by correspondence between code in C # and mathematical expression introduced by the user directly into editor.

Computing

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.

For example:

String view

A string representation of the expression can be obtained by calling GetText()

  1. string text = expression.GetText();
  2. // text = "x/(95+y)"
  3.  

Parsing Expressions

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:

  1. IExpression expression1 = new Div(new ScalarAttrInt("x"), new ScalarConstInt(95) + new ScalarAttrInt("y"));
  2. // are is equivalent
  3. IExpression expression2 = BaseExpression.Parse("x/(95+y)");