ev-bug



This is a bug in 'binomial', nothing to do with ev.

    binomial(5,1) => 5
    binomial(5,2) => 10

    binomial(5,1), nouns => 5
    binomial(5,2), nouns => 10.0

    (verbify(binomial))(5,1) => 5
    (verbify(binomial))(5,2) => 10.0

This is left over from the old notion that the verb provides
floating-point evaluation.

See mlisp.lisp: $binomial.

               -s

On Wed, May 13, 2009 at 2:18 PM, Oliver Kullmann
<O.Kullmann at swansea.ac.uk> wrote:
> Hello,
>
> Maxima 5.18.1 http://maxima.sourceforge.net
> Using Lisp ECL 9.4.1
> declare(rv,noun)$
> rcs(S) := block([L : listify(S)],
> ?apply("+",create_list(binomial(L[i]-1,i), i,1,length(L))) + 1)$
> (%i4) ev(rv(1,4),rv([L]):=rcs(setify(L)),nouns);
> (%o4) 4
> (%i5) ev(rv(1,5),rv([L]):=rcs(setify(L)),nouns);
> (%o5) 7.0
> (%i6) rcs({1,5});
> (%o6) 7
>
> I hope you see the disaster: o6 is correct, and should be the same
> as o5, but somehow suddenly the result is turned into a floating-point
> number (which depends on the values --- doesn't happen with o4).
>
> I guess I should submit this as a bug, but wanted to hear some comments first.
>
> (Workarounds? Currently the above behaviour blocks a whole development; but
> using floor doesn't seem safe ...)
>
> Oliver
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>