"$a1", because you are showing mixed numbers, you get
"1 1/2"as the string passed to
Compute(). But the space is implicit multiplication, so you compute effectively
"1*1/2", which is 1. If you want to process mixed numbers (not just show them), you need to include the
allowMixedNumbers=>1flag as well.
It is not clear to me why you are doing the
Compute()at all, since
$a1is already a MathObject. There is no need to recompute it that I can think of.
OOPS! I see Alex already answered. Sorry for the noise.