ev-bug



(1) If there is a global hashed array L defined, L[i] extracts the value of
the
global hashed array, not the member of local list variable L. The fix is to
replace L[i] with inpart(L,i).

(2) Your code is inefficient, I think. Try rewriting rcs as loop:

(%i16) bob(l) := block([s : 0, k : 1],
  for lk in l do (
     s : s + binomial(lk-1,k),
     k : k + 1),
  s + 1)$

(%i28) bob([a,b]);
(%o28) ((b-2)*(b-1))/2+a

(3) The usage of a Maxima set as an input to rcs seems spurious.

(4) As for the calls to ev in your code, I don't want to think about it.
Ev makes my head hurt.

Barton

-----maxima-bounces at math.utexas.edu wrote: -----


>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