Beginner 'apply' question



On 12/29/06, Phil <pbpublist at comcast.net> wrote:
> e1: a^2+b^2=c^2;
> apply(rhs(first(solve (e1, b))), [3, 5]);

Thanks for your interest in Maxima!

There are a couple of things to note here.

First of all, "apply" applies functions to arguments, either named
functions (like sin or f where f(x):=x^2) or lambda-expressions.
Solve does not return a function, it returns a list of solutions,
where each solution is a list of equations.

The best and simplest way to substitute values for variables is the
subst function:

       subst([a=3,c=5], solve(e1,b))

I would not recommend using "ev" and " ' '  " (two single-quotes),
because their use can be tricky and surprising.  As a general rule, if
it can be done with "subst", I would recommend doing it with subst,
not ev or other mechanisms.

            -s