## Revision of mxalgebra-help from Sun, 10/11/2009 - 18:08

The revisions let you track differences between multiple versions of a post.

Please add material here as you learn... If you have questions not answers, then add those here: That's how a wiki works. mxAlgebra(expression, name = NA, dimnames = NA) mxAlgebra() allows you create algebraic expressions based on one or more MxMatrix objects. Legal functions are described here Common misunderstandings are to call mxAlgebra expecting it to be run To evaluate an MxAlgebra, it must be placed in an MxModel (along with all referenced MxMatrix objects) and run.

```A &lt;- mxMatrix("Full", nrow = 3, ncol = 3, values=1:9, name = "A")
B &lt;- mxAlgebra(A, name = "B")
C &lt;- mxAlgebra(A + B, name = "C")
D &lt;- mxAlgebra(sin(C), name = "D")
model &lt;- mxModel("AlgebraExample", A, B, C, D )
fit   &lt;- mxRun(model)
mxEval(AlgebraExample.D, fit)
#           [,1]       [,2]       [,3]
#[1,]  0.9092974  0.9893582  0.9906074
#[2,] -0.7568025 -0.5440211 -0.2879033
#[3,] -0.2794155 -0.5365729 -0.7509872```

#### Gotchas

A common misunderstanding is to call mxAlgebra() expecting it to be evaluated without subsequently being placed in a model and run as above.