[Date Index]
[Thread Index]
[Author Index]
Re: Re: Derivative of Dot[]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg91126] Re: [mg91085] Re: Derivative of Dot[]
*From*: "Eitan Grinspun" <eitan at grinspun.com>
*Date*: Thu, 7 Aug 2008 04:37:34 -0400 (EDT)
*References*: <g791cq$9hc$1@smc.vnet.net> <200808060902.FAA22060@smc.vnet.net>
>> 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
>
> The above expression make sense only for one dimensional vectors, say on
> the real line; in other words, a vector space where the unit vector is
> {1} and any vector {x} has only one component x.
Why? Even of a vector {x}, the resulting derivative cannot be
evaluated successfully: (1.#1+#1.1&)[{x}] does not simplify (the 1.
remains).
> You may want to write you own differentiating function such as the
> following:
I have done so before; but the question is what is the intended use of
the built in derivative of Dot? I can't find one.
Eitan
>
> In[1]:=
> SetAttributes[myDiff, HoldFirst]
> myDiff[fun_[x_?VectorQ]] :=
> Module[{v = Array[a, Length[x]]},
> D[fun[v], {v}] /. Thread[v -> x]]
>
> f[x_?VectorQ] := Dot[x, x]
> myDiff[f[{1, 2}]]
> myDiff[f[{1, 2}]].{3, 4}
>
> g[y_] := 2 f[y]
> myDiff[g[{1, 2}]]
> myDiff[g[{1, 2}]].{3, 4}
>
> Out[4]= {2, 4}
>
> Out[5]= 22
>
> Out[7]= {4, 8}
>
> Out[8]= 44
>
> Regards,
> -- Jean-Marc
>
>
Prev by Date:
**Re: Re: Derivative of Dot[]**
Next by Date:
**Re: No preferences for OSX**
Previous by thread:
**Re: Derivative of Dot[]**
Next by thread:
**Re: Re: Derivative of Dot[]**
| |