simple derivative function question



On 1/17/07, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:
> 1. What does maxima actually do with the next definition?
>    (A)   f(x):= diff(f(x),x)

If you try to evaluate this, you will get an infinite recursion, since
f(y) requires first calculating f(y) and then taking its derivative,
which requires first calculating f(y) and then....

Perhaps you meant

        f(x):= diff( g(x), x)

When you call this with an argument, e.g. f(a), Maxima binds the
variable x to the variable a (the symbolic value -- we're assuming
that a hasn't been assigned a value).  It then calculates the value of
the arguments to the "diff" function, which are g(a) (a symbolic
expression) and a (a symbolic expression.  Then it calculates the
diff, which in this case is a "noun form", that is, the symbolic
representation of a derivative: 'diff(g(a),a,1).  If on the other hand
you tried f(3), then it would try to take the derivative of g(3) with
respect to 3, which is not meaningful, hence the error message.

>    I thought that the right hand side remained unevaluated by using

The right hand side of a function definition is evaluated when you
*call* the function.

> 2. What is the meaning of the following words in the manual on "diff"
>
>       The noun form of `diff' is required in some contexts, such as
>       stating a differential equation.
>
>     What is a "noun form" in maxima?

There are certain functions in Maxima, notably diff, integrate, limit,
etc. which have a dual meaning.  They can be operations on symbolic
expressions (domain and range are trees of symbols, essentially) or
they can be themselves part of an expression tree. Thus:

         integrate(x^2,x) => x^3/3

The expression x^2 == "^"(x,2) is transformed into the expression
x^3/3 = "/"("^"(x,3),3).

But

        'integrate(x^2,x)

is itself an expression, namely "integrate-noun"(x^2,x).  You can ask
Maxima to re-convert the integrate-noun into an operation using the
ev(...,integrate) mechanism:

        ex: 'integrate(x^2,x) => 'integrate(x^2,x)
        ev(ex,integrate) => x^3/3

Maxima suppots many operations on noun operators just like other
operators, and also does some simple simplifications on them:

         'integrate(2*x,x) => 2*'integrate(x,x)

          subst(y,x,ex) => 'integrate(y^2,y)

         subst(x^2,x,ex) => 'integrate(x^2,x^2)   *ERROR* meaningless
expression.

Perhaps this helps....

              -s