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

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

Wiki home pagePlease 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 <- mxMatrix("Full", nrow = 3, ncol = 3, values=1:9, name = "A")
B <- mxAlgebra(A, name = "B")
C <- mxAlgebra(A + B, name = "C")
D <- mxAlgebra(sin(C), name = "D")
model <- mxModel("AlgebraExample", A, B, C, D )
fit   <- 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.