When you say
ev(diff(sin(x),x),x=1);
You are asking Maxima to calculate diff(sin(x),x) in a context where all
x's are replaced by 1.
That would give diff(sin(1),1), which is not what you want.
What you want is first to calculate diff(sin(x),x), and only *then* substitute
x=1.
You can do that in various ways:
subst(x=1,diff(sin(x),x))
at(diff(sin(x),x),x=1)
ex: diff(sin(x),x)$ ev(ex,x=1)
Maxima's notion of variable conflates *programming* variables and *mathematical
*variables, which aren't really the same thing, but can be treated as the
same in many cases. But in some cases, you have to be careful about the
difference.
-s
On Wed, Feb 15, 2012 at 11:54, <mxue at vroomlab.com> wrote:
> Hi Maxima Jedis,
>
> I have the following encounter with maxima 5.23.2:
>
> (%i3) ev(diff(sin(x),x),x=1);
>
> diff: second argument must be a variable; found 1
> -- an error. To debug this try: debugmode(true);
>
>
> but
>
> (%i5) diff(sin(x),x);
> (%o5) cos(x)
> (%i6) ev(%, x=1);
> (%o6) cos(1)
>
> works ok. so is:
>
> (%i9) ev(diff(sin(x),x), x=%pi);
> (%o9) 0
>
> however,
> (%i8) ev(diff(sin(x),x), x=%pi/2);
>
> %pi
> diff: second argument must be a variable; found ---
> 2
>
>
> Is this a bug of maxima or error/misunderstanding on my part? Could someone
> enlighten me ?
>
> Thanks!
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>