[Maxima] [Newbie] problem with conditional expression
robert.dodier at gmail.com
Thu Mar 22 10:27:42 CDT 2007
On 3/21/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:
> There is a major difference between program control flow and expression
All well and good. With this in mind let's return to our canonical example.
plot2d (if x > 0 then 1 else 0, [x, -1, 1]);
trigger an error?
> Saying that you treat this the same as P+1 is
> obviously not a solution.
Obviously not. The point is even simplifying arithmetic expressions
can have side effects. Yet that doesn't seem to stop us from allowing
Maxima to simplify arithmetic. It needn't stop us from simplifying
or evaluating conditional expressions.
> > > Alternative syntax (e.g. such as is used in Tilu output) or something else,
> > > like guarded commands, could make sense. Key words like "incase" and
> > > "provided/ when" are used by tilu.
> > > http://www.cs.berkeley.edu/~fateman/tilu.examp2.html
> > Is there a way to define incase and provided/when without using if ?
> No. If they could have been defined in terms of "if" I would have used "if".
Really? The only discussion of provided/when on that page says
"In particular it requires checking if a*b^2<0 or ..."
There's no discussion of incase.
More information about the Maxima