Message Boards Message Boards

0
|
6021 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Regrouping infinite sums

Posted 10 years ago

Hi everyone. I'm doing a few tests with infinite sums in mathematica, but I have troubles. I want to manipulate formal power series with non fixed coefficient.

For exemple, defining $f(t)=\sum_{n=0}^\infty u_n t^n$ and $g(t)=\sum_{n=0}^\infty v_n t^n$. I would like Mathematica to regroup the sums when computing $f(t)+g(t)$, i.e. I would like Mathematica to give me the output :

$$\sum_{n=0}^\infty ( u_n + v_n ) t^n$$

I tried the following code :

f[t_]:=Sum[Subscript[u,n]*t^n,{n,1,Infinity}];
g[t_]:=Sum[Subscript[v,n]*t^n,{n,1,Infinity}];
f[t]+g[t]

But he give me the result as the sum of two separated infinite sums, without regrouping them. I also tried Simplify or FullSimplify, but it didn't give what I wanted. What surprizes me is that for example D[f[t],t] give the formal output I would expect : $$\sum_{n=0}^\infty n u_n t^{n-1}$$

In the end, I would also like Mathematica to be able to change the index and then regrouping the sums. Typically, I'm looking for things like : $$f(t)+f'(t)=\sum_{n=0}^\infty (u_n+(n+1)u_{n+1})t^n$$

Would this be possible ? Thank you.

POSTED BY: Sylvain Lacroix
6 Replies

Many thanks Gianluca for reminding us of one more of the nice features in Mathematica 10 - Inactive, Activate and IgnoringInactive! These should be great for teaching and presenting detailed derivations.

For convenience, here's the same calculation I did above using Inactive and Activate.

sinC = SeriesCoefficient[Sin[t], {t, 0, n}, Assumptions -> n >= 0];
cosC = SeriesCoefficient[Cos[t], {t, 0, n}, Assumptions -> n >= 0];

collectSums = Inactive[Sum][a_, b_] + Inactive[Sum][c_, b_] :> Inactive[Sum][a + c, b];

step1 = Inactive[Sum][u[n] t^n, {n, 0, \[Infinity]}] + 
  Inactive[Sum][v[n] t^n, {n, 0, \[Infinity]}]
Print["Combine with the collectSums"]
step2 = step1 /. collectSums2 // Simplify
Print["Substituting expressions for the Sin and Cos coefficients and \
Simplifying"]
step3 = step2 /. u -> Function[n, sinC] /. v -> Function[n, cosC]
step4 = FullSimplify[step3, n \[Element] Integers && n >= 0]
Print["Evaluate, convert to trig and simplify"]
step5 = Activate[step4]
step5 // ExpToTrig // Simplify
Posted 10 years ago

Thank you for the answer Gianluca Gorni. I'll take a look at that too.

POSTED BY: Sylvain Lacroix

Instead of MakeBoxes you can try with Inactive (new with Mathematica 10):

Inactive[Sum][u[n] t^n, {n, 0, Infinity}]

which formats fine. The rule for sums can be

collectSums = 
 Inactive[Sum][a_, b_] + Inactive[Sum][c_, b_] :> 
  Inactive[Sum][a + c, b];
Inactive[Sum][u[n] t^n, {n, 0, Infinity}] + 
  Inactive[Sum][v[n] t^n, {n, 0, Infinity}] /. collectSums

It becomes more complicated if you want to mix sums with different extrema.

POSTED BY: Gianluca Gorni
Posted 10 years ago

Wow it is much more complicated that I thought it would be. But thanks a lot for the answer David J M Park Jr. I'll take a look at all that, but indeed I'm not used to this TemplateBoxes and MakeBoxes, so for the moment I don't realyy understand what who you did. I'll try to figure it out. Thanks.

@ Simon Cadrin : I'm not really sure of what you meant by your answer ? Aren't you imposing the relation I was looking for ?

POSTED BY: Sylvain Lacroix

enter image description here

POSTED BY: Simon Cadrin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract

Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use