Context("Numeric"); Context()->variables->add(n => ['Real', limits=>[0,10], resolution=>1]); $ans_causal = Formula("$A*($p1)**n + $B*($p3)**n ")->reduce; Context("Numeric"); Context()->variables->add(n => ['Real', limits=>[-10,0], resolution=>1]); $ans_noncausal = Formula("-$C*($p2)**(-n) ")->reduce;Here, the second
Context("Numeric")
gets you a fresh copy of the Numeric context, without the previous changes. Since MathObjects retain the context in which they were created, both have the proper limits.
Alternatively, you can set limits on the formulas rather than explicit test points. For example:
$f = Compute("x+1")->with(limits => [0,10], resolution => 1); $g = Compute("x-1")->with(limits => [-10,0], resolution => 1);