ev-bug



aha; thanks!

Then I guess I avoid this usage-path better altogether.

Just to mention where this application comes from:
I'm creating Ramsey-graphs, where the vertices are
subsets, say {1,3,5}. Now it is very convenient to
let these subsets just be the vertices (as in ordinary
mathematics). However,
at a certain point, I need to standardise these
vertices to names 1,2,3,... . Now a possibility
to do this could be to use rv(1,3,5) instead of
{1,3,5} as vertex-name, and then performing the
standardisation of vertex-names by just evaluating
the whole graph (a pair of vertex- and edge-list)
as done below (where rcs ranks subsets), defining
rv inside the evaluation (while otherwise it's not
evaluated).

But perhaps it's safer, if such problems are possible,
to have two functions for creating the respective graphs,
one using {1,3,5} as vertex-name, the other directly its rank.

Oliver


On Wed, May 13, 2009 at 02:37:31PM -0400, Stavros Macrakis wrote:
> 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
> >

-- 
Dr. Oliver Kullmann
Computer Science Department
Swansea University
Faraday Building, Singleton Park
Swansea SA2 8PP, UK
http://cs.swan.ac.uk/~csoliver/