# [Maxima] behaviour of ev()

Richard Fateman fateman at cs.berkeley.edu
Wed Apr 29 17:44:43 CDT 2009

```Here's a start.
Never use ev.

Only if you cannot use subst for what you want to do, should you
consider using ev.
The reason is:  ev is elaborate, and does many things that are not
explained well.

You probably mean to say ev(s,r=a),  since you probably don't want to
set the value of r permanently.

but even so, using subst is cleaner.

Al Berich wrote:
> Hello,
>
> I do not have much experience with maxima and still ﻿find plenty of
> things, which I do not understand:
>
> When including the function in line %i39 in an ev() and defining r:a
> thus log(r/a)=log(a/a)=0, apparently also 4*c4*r is set zero...
>
> A work around (storing %i39 in s) and evaluating ev(s,r:a) yields the
> expected result (%o42).
>
> I am confused...
>
>
> (%i37) kill(r,w,a,c1,c2,c3,c4);
> (%o37)                               done
> (%i38) w: c1+c2*r^2+c3*log(r/a)+c4*r^2*log(r/a)+w1;
>                     4
>                  p r        2     r           r        2
> (%o38)           ---- + c4 r  log(-) + c3 log(-) + c2 r  + c1
>                  64 K             a           a
> (%i39) s: ratexpand(diff(diff(w,r)*r,r));
>                        3
>                     p r               r
> (%o39)              ---- + 4 c4 r log(-) + 4 c4 r + 4 c2 r
>                     4 K               a
> (%i40) ev(ratexpand(diff(diff(w,r)*r,r)),r:a);
>                                   3
>                                  a  p
> (%o40)                           ---- + 4 a c2
>                                  4 K
> (%i41)
>
> (%i42) ev(s,r:a);
>                              3
>                             a  p
> (%o42)                      ---- + 4 a c4 + 4 a c2
>                             4 K
>
> thank you in advance for help
> al
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>

```