if and context



On 7/25/08, amli at comcast.net <amli at comcast.net> wrote:

> I am having problem with if and assume statements.
> Some times they work and other times I get error.

>   pgm12(n,k,x,tLis):=block([j,ith, r,btmp,res,t:float(tLis),dl,dr,bp],

When I run your program, I see that the failed test is something
like is(4.0 <= x and x < 6.0) => unknown with facts = [4 <= x, x < 6].
When I replace t : float(tLis) with t : copy(tLis), the test correctly
returns true and there is no error reported.

There are various things going on here. Returning unknown
for is(4.0 <= x and x < 6.0) is a bug. If you have time please file a
bug report.

Maxima is generally more comfortable with exact numbers
(integers and rationals) than floats. So my advice is to try to work
with exact numbers if you can avoid floats.

The code you showed seems somewhat obscure. What is your
goal here? Perhaps there is a simpler way to achieve it.

best

Robert Dodier