[Newbie] problem with conditional expression



Stavros, this looks to me like another example which shows users
would benefit from having boolsimp merged into maxima/src.

On 3/9/07, Hugo Coolens <coolens at kahosl.be> wrote:

> I'm trying to define a function as follows:
> f(t):= if (0<=t and t<t1) then -(A/t1)*t+A else 0;
>
> when trying out "f(0);" I get the error message below, probably
> because the syntax I use is wrong, can someone tell me how to do it
> properly?
>
>   MACSYMA was unable to evaluate the predicate:
> 0 < t1

Maxima, by default, does not know how to handle unevaluated or
partially evaluated conditionals. There is an add-on package named
boolsimp for that.

load (boolsimp);
f(t):= if (0<=t and t<t1) then -(A/t1)*t+A else 0;
f(- 1);
  => 0
f(0);
  => if 0 < t1 then A else 0
f(t1 + 1);
  => 0
f(t);
  => if 0 <= t and t < t1 then A-t*A/t1 else 0
assume (t > 0);
f(t);
  => if t < t1 then A-t*A/t1 else 0

boolsimp is packaged with Maxima in version 5.11 but it appears
you have an old version of Maxima. If so you can get the package from CVS:
http://maxima.cvs.sourceforge.net/maxima/maxima/share/contrib/boolsimp/boolsimp.lisp
I don't know for sure whether boolsimp works with older versions of Maxima.

HTH
Robert