Derivative of Dot[]
- To: mathgroup at smc.vnet.net
- Subject: [mg91055] Derivative of Dot[]
- From: "Eitan Grinspun" <eitan at grinspun.com>
- Date: Tue, 5 Aug 2008 03:59:59 -0400 (EDT)
I would like to compute the gradient F' of a scalar-valued function F of a vector-valued argument, without knowing a-priori the dimensions of the vector. I am having some trouble with a very simple case. Consider the following function: F[x_] := Dot[x,x] Evaluating this function works as expected: F[{1,2}] evaluates to 5. I differentiate this function w.r.t. its sole argument, F' evaluates to 1.#1+#1.1& This is reasonable, and as expected. I would think that, since the argument of Dot must be a list, the derivative of Dot would have been designed to return something that is useful. While I presume that this is the case, I have been unable to move ahead. I evaluate the derivative at {1,2}: F'[{1, 2}] returns 1.{1,2}+{1,2}.1 The Dot is not defined for scalar arguments, and therefore Simplify does not reduce this further. I could of course program a rule so that Dot[1,x_]->x, but my intent here is to understand why the derivative of Dot was designed the way it was---presumably there is a reason, and there is a proper way to make use of the derivative. Once I have the derivative, I should be able to contract it with a (tangent) vector to obtain the (linearized) change the (scalar) function value: F'[{1, 2}].{3,4} Alas, this returns (1.{1,2}+{1,2}.1).{3,4} which does not simplify (even after Distribute) because Dot does not operate on scalar arguments. I'd like some help in understanding how to use Derivative with Dot (it was evidently designed to be used, or there would not be a rule built in). Sincerely, Eitan
- Follow-Ups:
- Re: Re: Derivative of Dot[]
- From: "Eitan Grinspun" <eitan@grinspun.com>
- Re: Derivative of Dot[]
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Re: Derivative of Dot[]