derivatives of matrix functions



> (C11) dEE_dw:-'TRANSPOSE(y-X . w) . X; ...
> (C12) expand(dEE_dw);
> (D12) -'TRANSPOSE(y-X . w) . X
> Hmm, the quote mark seems to prevent expand from expanding.

Not quite.

> I'm curious about how to get exand() to treat 'transpose()
> as if it were transpose().

OK, here goes.  There are two issues here.  First of all, Expand only
works on (commutative and non-commutative) products and powers of sums,
e.g. (x+y)^3 and(x+y).z, using the distributive law.  It knows nothing
about either Transpose or 'Transpose.  The reason that Transpose works
in your example is that it *carries out* the transformation
transpose(x+y) => transpose(x)+transpose(y), thus leaving Expand with a
"+" that it can distribute the "." over.

To have Expand operate on the expression above, you first need to apply
the transformation transpose(x+y) => transpose(x)+transpose(y).  You can
do this in one of two ways: 

(1) Convert the noun form 'Transpose back to the verb form
    Transpose and re-evaluate: ev(d12,transpose).

(2) Declare Transpose to be linear: declare(transpose,linear).
    In this case, Maxima will *always* expand expressions of
    the form transpose(a+b) to transpose(a)+transpose(b).

That should solve your problem.  Now for a bit more explanation.

The second issue is that Transpose is not expanding by default.  Why,
you may ask, does Transpose(a+b) become Transpose(a)+Transpose(b)
(actually, peculiarly, 'Transpose(a)+'Transpose(b)), but 'Transpose(a+b)
does not become 'Transpose(a)+'Transpose(b)?  Transformations like this
are normally performed on noun forms, in the simplifying routine.  In
the case of Transpose, it is being performed in the *verb*.  Similarly,
Transpose(Transpose(x)) becomes x, but 'Transpose('Transpose(x)) does
not.

I consider this a design error.  Like every other mathematical function,
Transpose should have a full set of simplifications for its *noun* form.
The verb form should, perhaps, carry out operations on explicit
matrices, but should not be performing simplifications.  It's not even
clear there's a need for a verb form at all, but that could certainly
co-exist.  There are two arguments I can see for the current design.
First, you sometimes want Transpose(a+b) to remain unexpanded, and you
would lose that control.  But similar issues are handled elsewhere in
Maxima either by providing switches to control the behavior (logexpand)
or specific transformation functions (trigexpand).  Second, you might
want to apply Transpose to explicit matrices within a program.  But
doing that in a simplification routine is imperceptibly less efficient
then doing it in a verb routine.

So I am pretty convinced it is a design error.  Anyone want to defend
the current behavior?

      -s