WeBWorK Main Forum

comparing MathObjects Formulas (problem generating test points)

Re: comparing MathObjects Formulas (problem generating test points)

by William Boshuck -
Number of replies: 0
I was never able to do this directly,
although I have needed something like
it. In the example along the lines of
the one Alex mentioned, what I did
would amount to something like this:

$xs = [
( map { [random(-3, -2, .01)] } ( 0 .. 4) ),
( map { [random(-1, 0, .01)] } ( 0 .. 4) ),
( map { [random(1.5, 2, .01)] } ( 0 .. 4) ),
( map { [random(3, 4, .01)] } ( 0 .. 4) )
];
$g = Formula("|2x + 3| + |x - 1| + |3x - 7|")->with(
test_points => $xs
);


cheers,
-wb