On 3/19/06, Juan Pablo Romero Bernal <jromerobernal at gmail.com> wrote:
> (%i2) simpson(x^2,0,5,7);
> f evaluates to x^2
> Improper name or value in functional position.
Simpson expects a function, not an expression, so the following should work:
sqr(x) := x^2$
simpson(sqr,0,5,7);
I realize this is inconsistent with the conventions in other cases
(e.g. plot2d). At some point, we really ought to try to decide on a
convention and apply it globally. For now, I'm afraid you have to
deal with the inconsistencies.
Even worse, simpson does not handle
simpson( lambda([x],x^2), 0, 5, 7)
correctly.... (reported as bug 1454022)
-s