On Wed, 2007-05-30 at 14:54 +0300, ugur guney wrote:
> 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?
The assignment operator ":" just sets a value for a variable. It does
not define any dependence among variables. The value set is the one
given when the assignment is done. The value assigned to a variable in
Maxima does not have to be a number but can be an expression too.
Therefore, if you are using x and y simply as sub-parts of a more
complicated expression, you should first save the sub-parts and then the
complete expression:
(%i1) x: m^2;
2
(%o1) m
(%i2) y: m*n;
(%o2) m n
(%i3) u: x+y;
2
(%o3) m n + m
(%i4) ev(u,m=1);
(%o4) n + 1
If, on the other hand, you really meant to express mathematical
relations among variables, you must make those relations explicit either
with the "depend" operator or using functions, like this:
(%i5) u(n,m):= x(m) + y(n,m);
(%o5) u(n, m) := x(m) + y(n, m)
(%i6) x(m) := m^2;
2
(%o6) x(m) := m
(%i7) y(n, m) := m*n;
(%o7) y(n, m) := m n
(%i8) u(n,m);
2
(%o8) m n + m
(%i9) u(n,1);
(%o9) n + 1
In mathematics books it is customary to simplify the notation and write
things such as:
x = m^2
y = m*n
when they really mean
x(m) = m^2
y(n,m) = m*n
it is expected from the reader to understand that the first two
statements really mean the second two. But when you use a CAS system you
have to be more precise.
Regards,
Jaime Villate