From: Robert D. <rob...@gm...> - 2024-03-15 18:51:55
|
On Thu, Mar 14, 2024 at 2:12 PM Majzoub, Eric <eri...@um...> wrote: > The problem seems to be with the behavior of the unit_step() function. > (%i33) oddfunp(f(x),x); > (%o33) false > > Tracing the call gives: > 1 Enter oddfunp [- 1 + 2 unit_step(x), x] > 1 Enter equalp [- 1 + 2 unit_step(x), 1 - 2 unit_step(- x)] > 1 Exit equalp false Eric, thanks for bringing it up. Looks like fourie can't tell what to do since f(x) fails the oddfunp test. But maybe this additional simplification rule is enough to make progress: matchdeclare (xx, lambda ([e], not atom(e) and op(e) = "-")); tellsimpafter (unit_step (xx), 1 - unit_step(- xx)); Try the example again after that -- I get a plausible result at that point. I can say more about it later today or tomorrow. Of course the simplification is problematic in the sense that just looking for a "-" sign isn't a strong way to detect negative values, but maybe it is enough to get some work done. Robert |