complex function works only after defining it twice



On Fri, May 16, 2008 at 3:40 PM, Christoph Sarnowski <pixelbrei at h3c.de> wrote:
> But one thing about expressions vs. functions: I need to apply those
> functions (e.g., f and error_f) to some numerical values. With both
> being functions, i write apply(f, list_of_arguments), same for the
> error. With expressions, i need the at(f, [x=x1, y=y1, ...]) notation,
> right?

I'd recommend subst.

 Or something like block([x, y],  [x,y]:list_of_arguments,''f).

That won't work.  Remember ''f evaluates at *definition time*.  It is
really only useful in interactive contexts. What you want here is
ev(f), though that has its own issues -- so I would recommend sticking
with subst.

> Or is there a way to use a named expression like a function?

Maybe something like this:

    subst(map("=",'[a,b],[2,3]),a^2+b^2);

or you can build a lambda if you really need a function, but that
isn't as natural in the Maxima world (maybe it should be, but it
isn't...).

          -s