prederror, conditionals
- Subject: prederror, conditionals
- From: Barton Willis
- Date: Tue, 29 Sep 2009 06:20:37 -0500
For my ideas about a mathematical conditional, see
to_poly_solve_extra.lisp. A few examples:
(%i1) load("to_poly_solver.mac")$
(%i15) f(x) := %if( (x <3) %or (x >= 3), -1, 1)$
(%i16) f(a);
(%o16) -1
Compare this to 'if'
(%i17) g(x) := if (x <3) or (x >= 3) then -1 else 1$
(%i18) g(a);
(%o18) if a<3 or a>=3 then -1 else 1
(%i19) is(%);
(%o19) unknown
Further,
(%i7) sol : to_poly_solve(a * x = b, x, 'parameters = ['a,'b]);
(%o7) %union(%if(a#0,[x=b/a],%union()),%if((a=0) %and
(b=0),[x=%c5],%union()))
(%i8) sublis([a=0,b=1], sol);
(%o8) %union()
(%i9) sublis([a=0,b=0], sol);
(%o9) %union([x=%c5])
(%i10) sublis([a = 42], sol);
(%o10) %union([x=b/42])
Barton