Re: Newbie question: equations with sums.
- To: mathgroup at smc.vnet.net
- Subject: [mg92863] Re: Newbie question: equations with sums.
- From: "David Park" <djmpark at comcast.net>
- Date: Thu, 16 Oct 2008 05:03:51 -0400 (EDT)
- References: <gd4dlf$bgb$1@smc.vnet.net>
The simple answer here is:
Sum[i f[i], {i, 0, n - 1}] == Sum[k f[k], {k, 0, n - 1}]
% /. k -> i
But this is a place where Mathematica lacks general capability to manipulate
Sum expressions and it is up to the user to provide the routines. This is a
bit of a chore because there may be a number of routines that would be
useful. Also, we would probably want to hold the sums in an unevaluated form
so we could manipulate them before turning them over to Mathematica.
Here is just a start of writing a routine to do linear shifting of an index
in a sum. I haven't written a usage message, or SyntaxInformation, and there
are also problems in having the limit expressions in the same form so
equality can be determined within HoldForms.
ClearAll[SubstituteSumIndex];
SubstituteSumIndex[index_ -> indexexpression_, var_][expr_] :=
expr /. a_. HoldForm[Sum[summand_, {index, start_, end_}]] :>
a Module[{newstart, newend, newsummand, work, f},
newstart = Part[Solve[indexexpression == start, var], 1, 1, 2];
newend = Part[Solve[indexexpression == end, var], 1, 1, 2];
newsummand = summand /. index -> indexexpression;
work =
HoldForm @@ {f[newsummand, {var, newstart, newend}] //
Simplify};
work /. f -> Sum
]
A couple of tests:
5 + 3 HoldForm[Sum[k f[x], {k, 0, n - 1}]] // TraditionalForm
% // SubstituteSumIndex[k -> j + 1, j] // TraditionalForm
HoldForm[Sum[i f[i], {i, 0, -1 + n}]] ==
HoldForm[ Sum[(k + 1) f[k + 1], {k, -1, -2 + n}]]
% // SubstituteSumIndex[k -> i - 1, i]
It would be a fair amount of work to write a comprehensive and convenient
set of routines for manipulating Sum expressions.
--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
"Vend" <vend82 at virgilio.it> wrote in message
news:gd4dlf$bgb$1 at smc.vnet.net...
> Hello.
>
> FullSimplify[\!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(\(-1\) + n\)]i\ f[
> i]\) == \!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(\(-1\) + n\)]k\ f[k]\)]
>
> Evaluates to:
>
> \!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(\(-1\) + n\)]i\ f[
> i]\) == \!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(\(-1\) + n\)]k\ f[k]\)
>
> Why doesn't it evaluate to true? Is there a way to make the system
> solve this kind of equations?
>