So when I try it out and check solutions, it gives me just a formula with no units, and gives the error message Variable 's' is not defined in this context.
It keeps the units fine without the List, though. Is this a bug? I figure FormulaWithUnits probably isn't used too often so it's more likely for a bug here than in more commonly used parts of MathObjects.
Another thing is that I'm not sure why, but this is what I get as the answer:
[6+sqrt(-36-4*g*9)]/(2*g), [6-sqrt(-36-4*g*9)]/(2*g) |
With Gratitude,
Ian Delbridge
Snippet:
Context("Numeric");
Context()->variables->add( t => 'Real',
g => 'Real');
$a = Formula("g");
$b = Compute(list_random(-2,-4,-6));
$c = Compute(list_random(3,6,9));
$v = ($b);
$x = ($c);
$quad1 = FormulaWithUnits("(-$b+sqrt($b^2-4*$a*$c))/(2*$a)","s");
$quad2 = FormulaWithUnits("(-$b-sqrt($b^2-4*$a*$c))/(2*$a)","s");
$factors = List($quad1,$quad2);
...
ANS($factors->cmp());