Re: Some questions about vector
- To: mathgroup at smc.vnet.net
- Subject: [mg74560] Re: Some questions about vector
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 26 Mar 2007 02:06:24 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <eu54qn$l30$1@smc.vnet.net>
Qi Zhang wrote: > input: > > Clear[f]; > f[v] = Sum[(i*v[i]), {i, 1, N}] It would be better not to use capitalize symbols: the symbol N is already defined as a system built-in function (Numerical approximation of an expression). > D[f[v], v[i]] > > the output is > > \!\(1\/2\ N\ \((1 + N)\)\) Which is correct from Mathematica point of view. The differential operator D has higher precedence than Sum. Therefore, the expression D[f[v], v[i]] is first interpreted as, "take the first derivative of something (something being the unevaluated sum: at this stage we could have a constant, that would change nothing) which depends on the expression v[i] with respect to the expression v[i]." Since Mathematica does not know anything about the symbolic expression v[i] (except that it is not a number), we have D[v[i], v[i]] == 1. So we are left with Sum[i, {i, 1, N]. The evaluation process continues, and, since Mathematica knows something about this sum (built-in mathematical knowledge), it returns the well known formula 1/2*n*(1+n) for the sum of the first n integers. > However what I expect is i > Here, I do not follow you for i is not a constant coefficient. On what basis did you conclude that the correct result must be i? > What should I do in order to get the the answer I expected? > > Thanks a lot. > In addition, the following threads are worth reading: . "Derivative of Sum" at http://forums.wolfram.com/mathgroup/archive/2004/Apr/msg00591.html . "partial derivative of a sum" at http://forums.wolfram.com/mathgroup/archive/2005/Aug/msg00547.html Regards, Jean-Marc