Saturday, June 09, 2007

The matrix source viewer

From a mathematical expression the expression parser generates matrices and functions in a Matrex project. This is a powerful functionality in Matrex.

Once the expression parser has generated matrices and functions, the original expression gets lost. This is usally not a problem, since in the project there are all the matrices and functions (final and intermediate) that calculate the expression.

But sometimes you want to see again the original expression, to:

  • see in one shot how a matrix has been calculated
  • know exactly which matrices and functions have been generated by the expression, for example because you want to replace the original expression with a new one and therefore you need to remove them

Fortunately the info window shows, among the rest:

  • for a matrix, the function that has it as result
  • for a function, the input matrices
So it is possible, from the expression's result matrix, to find out the original expression navigating to the source function, to the input matrices and so on.

But it is a lot of work to follow all the links among functions and matrices, expecially if the original expression is long.

To have a more valuable information, version 1.2 will contain a new functionality, called matrix source viewer.

The idea is to have a window that shows this information as a textual expression, with the same format used to enter an expression in the expression parser.

Suppose you entered the expression:

log(x + exp(y + z))

in the expression parser, and gave the name logres to the result matrix.

If you open the matrix source viewer on the logres matrix, you'll see a window containing a text like:

log ( logres.log )

Clicking on logres.log this part of the expression will be expanded and you'll have:

log (x + logres.exp )

Clicking on logres.exp this part of the expression will be expanded and you'll have:

log ( x + exp( y + z))

In this way with a limited number of clicks you'll have the original expression.

Also, a context menu on each item in the expression (excluded the parentheses) will open viewer or editor for that item.

Now the question is: why to see the original expression I need to click on links? Could it not appear as it was immediately?

The problem is that x, y and z could also be the result of other expressions and Matrex does not know which matrices are part of an expression and which are part of another.

No comments: