Re: Bug in Sum on symbolic differentiation
- To: mathgroup at smc.vnet.net
- Subject: [mg30732] Re: Bug in Sum on symbolic differentiation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 8 Sep 2001 02:56:30 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <9nam6l$nqb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
for me
q /: D[q[i_], q[j_]] := KroneckerDelta[i, j]
Unprotect[Sum]
HoldPattern[Sum[a_D, b__]] := Sum[Evaluate[a], b]
Protect[Sum]
work fine. But you should keep in mind that
the exchange of the summation and the derivative
may destroy the convergence of an infinite
sum.
Regards
Jens
ChiaMing Yu wrote:
>
> Dear Sir,
>
> Excuse me!
> When I want to differentiate through a Sum, such as (in LaTeX format):
> d (\Sum^n_{i=1} q_i) / d q_i
>
> The answer should be "1", because in the above equation, (d q_i) means
> differentiate
> respect to q_1, or q_2, or q_3, ..., etc, one and only one variable of the
> possible-variable
> set {q_i | i=1, .., n}.
>
> But when I excute following command, Mathematica give me the wrong answer
> "n",
> D[ Sum[q[i], {i,1,n}], q[i] ]
>
> It may because Mathematica first differentiate the inner expression of
> Sum[], that is q[i],
> respect to q[i] and get the result 1, then Mathematica Sum these 1 with n
> times, that is
> Sum[1, {i,1,n}], and return the output to be "n".
>
> When we assign a specific number to n, for example n=10, the operation will
> be fine,
> for example,
> D[Sum[x[i], {i, 1, 10}], x[5]]
>
> But when the variable n is Not assign any number, the situation described
> previously will
> appear. This may imply the limitation of Sum[] on symbolic operation,
> espetially differentiation opration. How can I refine the situation and get
> my right answer "1" from Mathematica?
>
> Thank you for any suggestion!
>
> Chia-Ming Yu, September 5, 2001
> National Taipei University