[Maxima] unevaluated boolean and conditional expressions (take 1)
macrakis at alum.mit.edu
Sun Jan 29 14:10:26 CST 2006
> I've put together some code to equip Maxima to handle unevaluated
> boolean and conditional expressions.
That's great! Something we've been wanting to do for a long time!
But doesn't this present some problems in programming with imperative
Previously, in programming constructs, an unevaluable conditional
would cause an error, which was often the right thing. Now it does
nothing, silently. So for example:
if x>0 then print(1) else print(2)
previously would print either 1 or 2, or cause an error. Now it can
silently do nothing.
I presume you haven't modified "for" and "while", though....
Another problem is with variable scope:
f(x,y) := if y=0 then 0 else 1/x;
What is the value of f(0,n)? It had better not be
if y=0 then 0 else 1/x
You could return a block, e.g.
block([x:0,y:n],if y=0 then 0 else 1/x)
If you try to substitute the variables, you get a different problem --
Maxima has no way of deferring an error....
if n=0 then 0 else 1/0
which will cause a simplification error (division by zero).
I have not looked at your module, so perhaps you have already resolved
all these issues....
More information about the Maxima