Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10407 > unrolled thread
| Started by | jimbo <james.a.gordon1@googlemail.com> |
|---|---|
| First post | 2012-06-09 07:09 +0000 |
| Last post | 2012-06-14 09:30 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Splitting sums in mathematica jimbo <james.a.gordon1@googlemail.com> - 2012-06-09 07:09 +0000
Re: Splitting sums in mathematica Ray Koopman <koopman@sfu.ca> - 2012-06-10 06:14 +0000
Re: Splitting sums in mathematica Ray Koopman <koopman@sfu.ca> - 2012-06-11 04:04 +0000
Re: Splitting sums in mathematica Ray Koopman <koopman@sfu.ca> - 2012-06-13 08:54 +0000
Re: Splitting sums in mathematica "james.a.gordon1" <james.a.gordon1@googlemail.com> - 2012-06-13 09:00 +0000
Re: Splitting sums in mathematica Ray Koopman <koopman@sfu.ca> - 2012-06-14 09:30 +0000
| From | jimbo <james.a.gordon1@googlemail.com> |
|---|---|
| Date | 2012-06-09 07:09 +0000 |
| Subject | Splitting sums in mathematica |
| Message-ID | <jqusrg$rnm$1@smc.vnet.net> |
Hello, Does anyone know of a way to algebraically split sums (if that is the correct name for it) in mathematica? I need to do the following (and higher-order versions of the same)... Sum_over_p [ Sum_over_q ( a_p * a_q ) ] = Sum_over_p_equal_q (a_p^2) + Sum_over_p_not_equal_q (a_p*a_q) ...in other words, turn a nested sum running over two indices into two sum, one for when the indices are equal, and one for when they are different? I then need to make some substitutions once there are no nested sums and simplify my answer. I have an equation with many hundreds of terms in it, so doing it by hand is not an option. I can send a typeset example if anyone needs clarification I have version 5.2 for students Thanks in advance James
[toc] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-06-10 06:14 +0000 |
| Message-ID | <jr1dvt$73t$1@smc.vnet.net> |
| In reply to | #10407 |
On Jun 9, 12:09 am, jimbo <james.a.gord...@googlemail.com> wrote:
> Hello,
>
> Does anyone know of a way to algebraically split sums (if that is the
> correct name for it) in mathematica? I need to do the following (and
> higher-order versions of the same)...
>
> Sum_over_p [ Sum_over_q ( a_p * a_q ) ] = Sum_over_p_equal_q
> (a_p^2) + Sum_over_p_not_equal_q (a_p*a_q)
>
> ...in other words, turn a nested sum running over two indices into two
> sum, one for when the indices are equal, and one for when they are
> different?
>
> I then need to make some substitutions once there are no nested sums
> and simplify my answer. I have an equation with many hundreds of terms
> in it, so doing it by hand is not an option. I can send a typeset
> example if anyone needs clarification
>
> I have version 5.2 for students
>
> Thanks in advance
>
> James
Let a = {a1,a2,...}. Then a.a gives the sum of the terms with p == q,
and 2*Dot@@Transpose@Subsets[a,{2}] gives the sum of the terms with
p != q.
[toc] | [prev] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-06-11 04:04 +0000 |
| Message-ID | <jr3qni$gr3$1@smc.vnet.net> |
| In reply to | #10421 |
On Jun 9, 11:14 pm, Ray Koopman <koop...@sfu.ca> wrote:
> On Jun 9, 12:09 am, jimbo <james.a.gord...@googlemail.com> wrote:
>> Hello,
>>
>> Does anyone know of a way to algebraically split sums (if that is the
>> correct name for it) in mathematica? I need to do the following (and
>> higher-order versions of the same)...
>>
>> Sum_over_p [ Sum_over_q ( a_p * a_q ) ] = Sum_over_p_equal_q
>> (a_p^2) + Sum_over_p_not_equal_q (a_p*a_q)
>>
>> ...in other words, turn a nested sum running over two indices into two
>> sum, one for when the indices are equal, and one for when they are
>> different?
>>
>> I then need to make some substitutions once there are no nested sums
>> and simplify my answer. I have an equation with many hundreds of terms
>> in it, so doing it by hand is not an option. I can send a typeset
>> example if anyone needs clarification
>>
>> I have version 5.2 for students
>>
>> Thanks in advance
>>
>> James
>
> Let a = {a1,a2,...}. Then a.a gives the sum of the terms with p == q,
> and 2*Dot@@Transpose@Subsets[a,{2}] gives the sum of the terms with
> p != q.
If you have to do that many times then you might want to define
{p,q} = Transpose@Subsets[Range@Length@a,{2}] once, and then
use 2*a[[p]].a[[q]] to sum the terms whose subscripts differ.
[toc] | [prev] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-06-13 08:54 +0000 |
| Message-ID | <jr9kfc$3i3$1@smc.vnet.net> |
| In reply to | #10427 |
On Jun 10, 9:04 pm, Ray Koopman <koop...@sfu.ca> wrote:
> On Jun 9, 11:14 pm, Ray Koopman <koop...@sfu.ca> wrote:
>> On Jun 9, 12:09 am, jimbo <james.a.gord...@googlemail.com> wrote:
>>> Hello,
>>>
>>> Does anyone know of a way to algebraically split sums (if that is the
>>> correct name for it) in mathematica? I need to do the following (and
>>> higher-order versions of the same)...
>>>
>>> Sum_over_p [ Sum_over_q ( a_p * a_q ) ] = Sum_over_p_equal_q
>>> (a_p^2) + Sum_over_p_not_equal_q (a_p*a_q)
>>>
>>> ...in other words, turn a nested sum running over two indices into two
>>> sum, one for when the indices are equal, and one for when they are
>>> different?
>>>
>>> I then need to make some substitutions once there are no nested sums
>>> and simplify my answer. I have an equation with many hundreds of terms
>>> in it, so doing it by hand is not an option. I can send a typeset
>>> example if anyone needs clarification
>>>
>>> I have version 5.2 for students
>>>
>>> Thanks in advance
>>>
>>> James
>>
>> Let a = {a1,a2,...}. Then a.a gives the sum of the terms with p == q,
>> and 2*Dot@@Transpose@Subsets[a,{2}] gives the sum of the terms with
>> p != q.
>
> If you have to do that many times then you might want to define
> {p,q} = Transpose@Subsets[Range@Length@a,{2}] once, and then
> use 2*a[[p]].a[[q]] to sum the terms whose subscripts differ.
The sum of the terms whose subscripts differ is Tr@a^2 - a.a,
and it may be faster to let Mathematica simplify that.
[toc] | [prev] | [next] | [standalone]
| From | "james.a.gordon1" <james.a.gordon1@googlemail.com> |
|---|---|
| Date | 2012-06-13 09:00 +0000 |
| Message-ID | <jr9kqr$3m8$1@smc.vnet.net> |
| In reply to | #10407 |
Hi Koopman, Thanks for the quick reply, I believe your suggestions solve some of my problem. To further clarify my question, I have an equation that looks like this F = (X - Y1 - Y2 - Y3 + Z)^2 X = Sum_p Sum_q Sum_r [a_p*a_q*a_r] Yi = Sum_p Sum_q!=p b_p*b_q, where different X_i have different terms in the sums Z = Sum_p Sum_q!=p Sum_r!=q!=p In other words I end up with a large number of terms, each of which can have as many as 6 nested sums, all of which need to be expanded resulting in hundreds of terms. I want mathematica to algebraically expand these nested sums for me rather than me having to type up the expanded form myself. I believe with your solution I would still need to manually keep track of the indices for each expansion. Once all the nested sums are expanded, I will make some substitutions of the a, a^2, a^3...a^6 terms, then simplify. At no point to I need to calculate this with real values, I just need an algebraic expression. Thanks again James
[toc] | [prev] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-06-14 09:30 +0000 |
| Message-ID | <jrcav2$dpb$1@smc.vnet.net> |
| In reply to | #10449 |
On Jun 13, 2:00 am, "james.a.gordon1" <james.a.gord...@googlemail.com> wrote: > Hi Koopman, > > Thanks for the quick reply, I believe your suggestions solve some > of my problem. To further clarify my question, I have an equation > that looks like this > > F = (X - Y1 - Y2 - Y3 + Z)^2 > > X = Sum_p Sum_q Sum_r [a_p*a_q*a_r] > > Yi = Sum_p Sum_q!=p b_p*b_q, where different X_i have different > terms in the sums > > Z = Sum_p Sum_q!=p Sum_r!=q!=p > > In other words I end up with a large number of terms, each of which > can have as many as 6 nested sums, all of which need to be expanded > resulting in hundreds of terms. I want mathematica to algebraically > expand these nested sums for me rather than me having to type up > the expanded form myself. I believe with your solution I would still > need to manually keep track of the indices for each expansion. > > Once all the nested sums are expanded, I will make some > substitutions of the a, a^2, a^3...a^6 terms, then simplify. > At no point to I need to calculate this with real values, > I just need an algebraic expression. > > Thanks again > > James I don't understand what you're trying to do -- how the Yi differ from one another, or what it means to "make some substitutions of the a, a^2, a^3...a^6 terms", as opposed to substituting for individual terms. Give us a small example, using Mathematica syntax.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web