On Wed, Jan 17, 2007 at 04:56:52PM -0500, sen1 at math.msu.edu wrote:
> I would like to understand the difference between the functions g(x)
> and h(x) defined below. In particular, lines
> (%i2) h(x):= ''(diff(f(x),x));
> 2
> (%o2) h(x) := 3 x
What maxima does is read in h(x) then := then ''(diff(f(x),x)).
because of the '' the last thing is immediately evaluated at READ TIME
to 3*x^2. then h(x) is defined to be the function which takex x and
computes 3*x^2
> (%i5) g(x):= diff(f(x),x);
> (%o5) g(x) := diff(f(x), x)
> (%i6) g(x);
> 2
> (%o6) 3 x
> (%i7) g(2);
>
> Non-variable 2nd argument to diff:
> 2
g(x) is now defined to be the function which takes x, substitutes it
into the expressions diff(f(x),x) and then computes that derivative.
g(foo) -> diff(f(foo),foo) -> diff(foo^3,foo) -> 3*foo^2
g(2) -> diff(f(2),2) -> diff(2^3,2) -> error
where -> could be read as "becomes"
Hope this helps.
--
Daniel Lakeland
dlakelan at street-artists.org
http://www.street-artists.org/~dlakelan