Bug ID:873301 - Gradef doesn't understand diff (workaround)



We have the open Bug report ID:873301 - Gradef doesn't understand diff
(workaround).

First, again the example of the bug report:

(%i6) gradef(f(x), f(x)*diff(g(x),x));

We get a wrong result with the above definition:

(%i7) diff(f(2*sin(x)),x);
(%o7) 2*cos(x)*f(2*sin(x))*'diff(g(2*sin(x)),2*sin(x),1)

But Maxima can do it correctly. We have to define the problem the
following way:

(%i8) gradef(f(x), f(x)*at(diff(g(u),u),u=x))$

(%i9) diff(f(2*sin(x)),x);
(%o9) 2*('at('diff(g(u),u,1),u = 2*sin(x)))*cos(x)*f(2*sin(x))

The example of the bug report now gives a correct result too:

(%i10) diff(f(x^2),x);
(%o10) 2*('at('diff(g(u),u,1),u = x^2))*x*f(x^2)

>From this we might conclude, that we have not a bug, but we have to
formulate the problem more precisely.

By the way: 

The derivatives of the nine inverse Jacobi functions wrt the parameter m
are defined as a noun form. Furthermore, the derivatives of the Bessel Y
and K functions wrt the order have a noun form of a derivative on the
property list. All this derivatives do not work too. We get the same
error as reported in this bug report, e.g.

(%i11) diff(inverse_jacobi_ns(x,2*m),m);
(%o11) 2*'diff(inverse_jacobi_ns(x,2*m),2*m,1)

The error for the inverse Jacobi functions is easy to correct. We simply
put NIL for the derivative wrt the parameter m on the property list. We
had some time ago an extension to sdiff to return a noun form for this
case. There is another known bug present when we put a noun form on the
property list, e.g. diff(inverse_jacobi_ns(x,x),x) is wrong. This is
correct with a value NIL on the property list too.

With NIL on the property list we get a correct noun form:

(%i13) diff(inverse_jacobi_ns(x,2*m),m);
(%o13) 'diff(inverse_jacobi_ns(x,2*m),m,1)

This is an example of a wrong derivative of a Bessel K function:

(%i15) diff(bessel_k(sin(n),x),n);
(%o15) cos(n)*(%pi*csc(%pi*sin(n))
                  *('diff(bessel_i(-sin(n),x),sin(n),1)
                   -'diff(bessel_i(sin(n),x),sin(n),1))
              /2
              -%pi*bessel_k(sin(n),x)*cot(%pi*sin(n)))

To get this derivative in general correct we can put an expression with
AT on the property list.

So, what should we do?

1.
Closing this bug report as "Won't fix" because the problem can be
formulated in a way which gives a correct answer.

2. 
We might try to modify the function $gradef to wrap an AT expression
around a noun form of a derivative. I have not thought out this. Perhaps
we will get problems and inconsistencies.

3.
At least we should correct the derivatives of the inverse Jacobi
functions and the Bessel K and Y functions.

Dieter Kaiser