Content | Function Tree |

- add the functions and the
intermediate and final result matrices
**one by one**to the project. - build
your
**own template**(probably using a script language) that calculates the complex formula and make a function from it. - call an
external application through a special function, called
**adapter**. Adapters are not installed with Matrex, but can be installed separately. - use the
**Expression Parser**.

There is only one constraint: the expression parser can only parse formulas with functions that

Here is it how it works. We say that it is possible to write a function as a text in the following way: template_name(input_matrix1, input_matrix2 .. input_matrixN, “parameter1”, “parameter2”, .. “parameterN”) where:

- template_name is the name
of the
**template**on the base of the function. - input_matrix1 ..
input_matrixN are the
**input matrices**of the function, in the correct order. - parameter1 ..
parameterN are the
**parameters**of the function, in the correct order. To distinguish them from the input matrices, they need to be written in quotes.

The matrices in the expression are assigned to the input matrices of the template following their order: the 1st matrix to the 1st template's matrix, the 2nd to the 2nd and so on.

The expression is valid if there are enough matrices to cover the number of the template's mandatory input matrices.

The parameters in the expression are assigned to the parameters of the template following their order: the 1st parameter to the 1st template's p the 2nd to the 2nd and so on.

If in the template there are a set of parameters that are optional, they are not needed in the expression if they are at the end of the template's parameter set.

For example, if the template has 5 parameters and parameter 2, 4 and 5 are optional, the expression needs values for the parameters 1, 2, 3 (in the same order) but not for parameters 4 and 5, since they are the last 2.

Since the input matrix of a function can be the result of another one, we can combine the functions in an expression, for example: plus(log(matrix1), exp(matrix2))

Parsing this expression, the parser produces the following items:

- one
**function**that is the one producing the final result of the expression (plus in this case) - one
**matrix**that is the final result of the expression (the result of plus in this case) - the
**intermediate functions**for log and exp in a separate sub-package called im_<final function name> (for example “im_plus”) - the
**intermediate matrices**of the expression, for log and exp, in a separate sub-package called im_<result matrix name> (for example “im_plus”)

The fact that the intermediate functions and matrices are stored in separate sub-packages keeps the project structure simple and efficient:

- Of the whole expression you are normally only interested in the final result; so it is good that the intermediate matrices are in a sub-package that you can keep closed.
- Nevertheless it is good to be able to look at the intermediate matrices if you are not sure about the final result or want to have some more information about the process that produced it.

The parser is organized as a

In each step the parser shows you the current status of the parsing and/or tells you to enter or choose some parameter.

Click on the

When you open the wizard, you are on the first step. The wizard has also step 2 (raw tree), step 3 (refined tree), step 4 (files), step 5 (summary).