I'm trying to figure out a nice way to add a mix of symbolic and explicit vectors/matrices without mathematica treating the symbolic vectors as scalars and promoting them to constant arrays.
For example:
In: Assuming[x \[Element] Matrices[{2, 2}], x + IdentityMatrix[2]]
Out: {{1 + x, x}, {x, 1 + x}}
Of course I could do:
In: HoldForm[x + IdentityMatrix[2]]
and not release the hold until I replace everything with its explicit value, but I am hoping that there is a cleaner solution.
x + {{1,0},{0,1}}
would be nice. Doing so in a way the was idiomatic/self-documenting would be perfect. Ideally, I don't want people reading my code to have to guess why I used a HoldForm (even without a comment :)) $\endgroup$Inactivate[Plus][x, IdentityMatrix[2]
do what you want? You can alwaysActivate
the "frozen" operators down the road when you have values for your variables. $\endgroup$