I noticed my number with unit call fails when I use it with variables defined within maths mode like

$a = random(50, 90, 10);

$b = Compute("2*9.8*$a");

$v = Compute("sqrt{$b}") -> reduce();

$t = Compute("2*$v/9.8") -> reduce();

$velocity = NumberWithUnits($v, "m/s");

$time = NumberWithUnits($t, "s");

When I use the answer checkers below, it returns just the values of the variables as answers, so that adding the units as part of the answer gives a warning sign that says "Variable [unit] is not defined in this context"

ANS(num_cmp($velocity));

ANS( num_cmp($Answer2) );

Now when I used the same NumberWithUnits function in some other question without math mode answer, the answers are stored with units. Am I doing something wrong, if so, how can I right it?.

Thanks,

Simon.