ev, subst, funmake, quote, apply ... argh!



On 12/25/07, dlakelan <dlakelan at street-artists.org> wrote:

> minimize_sa('err(a,b,c,d),....)

ev(expr, nouns) verbifies all nouns in expr. ev(expr, foo) verbifies
only foo.

> In other words, what's the "right" way?

Well, there are two general approaches, to treat the figure of merit as
an expression or as a function. You could give a function name or
lambda expression as the f.o.m. argument, and then call apply to
evaluate it for some specific arguments. Or you could construct an
expression (maybe a noun expression as shown above) and then
evaluate it in an environment with some variables bound to specific
values.

Maxima is rather more comfortable with expressions than
functions, e.g. diff and integrate don't know what to do with lambda.
Stuff that I've written (lbfgs, lsquares) prefers expressions also.
I'd recommend you do the same. When Maxima in general is more
comfortable with functions, I'll be happy to revise anything that
only recognizes expressions.

FWIW

Robert