Thanks, Davide. I seem to be struggling to write even the simplest question lately. It is probably because I am trying to use the Matrix context and am not quite familiar with it. I tried the following for the problem above and it wouldn't work. At that time I didn't think of putting the " " around just the individual variable expressions.
$A = Matrix("[
[ a, $a],
[ y, $b],
]");
I had one today where the expressions were more complex than above. My final (working)
version looked something like this. So, I think I've learned my lesson. Finger's crossed.
$A = Matrix("[
[ Formula("$a a^2 - 2"), $a],
[ Formula("$b a b + b^2"), $b],
]");