newbie question about ev();



On Wed, May 30, 2007 at 02:54:04PM +0300, ugur guney wrote:
> # Hi!
> # This term I took a Linux course and so discovered the Maxima. Many thanks
> to developers!
> # Here's my question: I want to evaluate an expression which consists of
> other expressions. For example:
> 
> u: x+y;
> x: m^2;
> y: m*n;
> 
> ev(u);
> # gives m n + m^2. But, as I understand correctly, because u does depend on
> m and n implicity, ev(u, m=1); does not work. It's output is same as ev(u);
> # What should I do to overcome this problem? Thanks.
> -ugur guney-

my suggestion is the following

ev(sublis(['x=x,'y=y],u),m=1)

sublis first makes the substitutions of m^2 for x and m*n for y, and
then you evaluate the result when m = 1. 

Hopefully the use of the quote symbol ' is understandable here from
your experience with other programming languages. If not, then
consider that saying x will cause maxima to substitute the value m^2,
whereas saying 'x will cause the symbol "x" to appear unevaluated.


-- 
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan