The key to the answer is "define works fine".
The ":=" operator -- like function definition in all ordinary programming
languages -- defers the evaluation of its arguments until the function is
called.
The "define" function evaluates the right-hand side (also the left) *at the
time of definition*.
For example:
(%i1) f(x):=print(x);
(%o1) f(x) := print(x) <<< function
definition includes "print"
<<< no printing
(%i2) f(4);
4 <<< print when *evaluating* f
(%o2) 4
(%i3) define('(g(x)),print(x));
x <<< print when *defining* g
(%o3) g(x) := x <<< function definition
does not include "print"
(%i4) g(4);
(%o4) 4
Doing something like
h(x) := diff(f(x),x)
will then try to evaluate diff(f(4),4), which is of course nonsensical.
-s
On Fri, Jan 13, 2012 at 15:36, Hans W. Hofmann <hawe at chefmail.de> wrote:
> (%i2) f(x):=-k*x^3+3*k^2*x^2;
> 3 2 2
> (%o2) f(x) := (- k) x + 3 k x
>
> (%i3) df(x):=diff(f(x),x)$ df(x);
> 2 2
> (%o3) 6 k x - 3 k x
>
> (%i4) df(k)=3;
> 3
> (%o4) 8 k = 3
>
> whats this? should have
>
> (%i5) 6*k^2*x-3*k*x^2 = 3, x=k;
> (%o5) 3*k^3 = 3
>
> using define all works fine....
>
> Gru? HW
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>