Error messages
No such package 'Value::InequalitySet' at line 675 of [PG]/macros/contextInequalities.pl Died within Inequalities::Inequality::new called at line 458 of [PG]/macros/contextInequalities.pl from within Inequalities::common::apply called at line 464 of [PG]/macros/contextInequalities.pl from within Inequalities::common::sub called at line 738 of [PG]/lib/Value.pm from within Value::binOp called at line 746 of [PG]/lib/Value.pm from within Value::_sub called at line 253 of [PG]/lib/Value/Interval.pm from within Value::Interval::contains called at line 497 of [PG]/macros/contextPiecewiseFunction.pl from within PiecewiseFunction::Function::eval called at line 73 of [TMPL]/Problems/setAlgebra_02_01_IntroFunctions/IntAlg_13_function.pg
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"contextLimitedNumeric.pl",
"contextPiecewiseFunction.pl"
);
TEXT(beginproblem);
######################################
# Setup
Context("PiecewiseFunction");
$m1 = random(2,5,1);
$b1 = non_zero_random(-6,6,1);
$m2 = random(-5,-2,1);
$b2 = random(1,6,1);
$x = random(-4,4,1);
$g = Formula("$m1 x + $b1 if x <= $x else $m2 x - $b2 if x > $x");
@in = (random($x-3,$x-1,1),random($x+1,$x+3,1),$x);
@slice = NchooseK(3,3);
@input = @in[@slice]; #There are more parts in my problem
######################################
# Main text
BEGIN_TEXT
The following function is defined by two equations. The equation in the
first row gives the output for values of $BITALIC x $EITALIC less than
$x. The equation in the second row gives the ouput for values
of $BITALIC x $EITALIC which are greater or equal to $x.
\[ g(x) = \{$g->TeX\} \]
Find the indicated valuea:
$PAR
a) \( g($input[0]) \) = \{ans_rule(15)\}}
END_TEXT
######################################
# Answers
Context("LimitedNumeric");
$ans_a = $g->eval(x=>$input[0])->reduce;
ANS($ans_a->cmp);
Thanks -- rac