functions with diff and intergrate



------------------------ Urspr?ngliche Nachricht -------------------------
Betreff: Re: [Maxima] functions with diff and intergrate
Von:     "Wilhelm Haager" <wilhelm.haager at htlstp.ac.at>
Datum:   Di, 15.09.2009, 21:29
An:      "Hans W. Hofmann" <hawe at chefmail.de>
--------------------------------------------------------------------------

> f(x):=(1-%e^(2*x))/(1+%e^(2*x));
> df(x):=diff(f(x),x)$
> df(1);
> (%o11) Non-variable 2nd argument to diff:1
> #0: df(x=1) -- an error.  To debug this try debugmode(true);
>
> I'm not able to calculate diff'd and intergrate'd functions
> how to do?
>
> Gru?? HW
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
The right hand side of a function DEFINITION is not evaluated,
the evaluation is performed at the function CALL
(and that is too late in your case, because x evaluates to 1 BEFORE
the differentiation is going to be performed).

I see 2 possibilities to solve your problem:

1) To enforce evaluation at the function definition, you can write:
   df(x):=''(diff(f(x),x))$

2) Replacing x by 1 using the command "subst" after the evaluation
   of the function body:
   subst(x=1,df(x));

Admittedly, I don't know why the following does NOT work:
   ev(df(x),eval,x=1);  (??)
Can anyone explain that?


Regards,
Wilhelm Haager