# Thank you very much. I looked at the maxima book and some other tutorials
but couldn't find an answer to my question. Because of course, my
supposition about dependencies in Maxima was wrong. Now your explanation
makes many things clear in my mind.
# Now I found another way of using ":" operator. If I first assign
expressions with x and y to u, then u; simply returns an expression of x and
y. And ev(u, m=1); tries to set 1 to all m's, but there isn't any m in u, so
it only evaluates u, by setting the expressions x and y in their place.
Hence, ev(u) is an expression which consists of m and n's. ev( ev(u), m=1 );
works as expected.
# And in Maxima Book, I found a short-cut for this expression: ev(''u, m=1);
# While using a computer algebra system one should think like a computer :-)
And I think in everyday usage of mathematical symbols, we use them somewhat
like a spoken language: we omit the explicit dependencies, and expect others
to understand them. And this mostly works.
-ugur-
On 5/31/07, Jaime E. Villate <villate at fe.up.pt> wrote:
>
> 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
>
>
>