Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to use Mathematica to simplify a symbolic expression involving Sum. Particularly, I define a sum via

y = (x - x0)^α Sum[a[n] (x - x0)^n, {n, 0, Infinity}]

Then I take the derivative of y with respect to x and simplify via

FullSimplify[D[y, x]]

This yields $$(x-\text{x0})^{\alpha -1} \left(\alpha \sum _{n=0}^{\infty } a(n) (x-\text{x0})^n+(x-\text{x0}) \sum _{n=0}^{\infty } n a(n) (x-\text{x0})^{n-1}\right)$$ However, the expression above can be easily simplified further to $$(x-\text{x0})^{\alpha -1} \sum _{n=0}^{\infty } ( a(n) (x-\text{x0})^n(\alpha+n) ) $$

Is there a way to "make" Mathematica recognise this simplification? I presume the problem has something to do with the fact that I use the unknown function a[n] in the expression, but I am not sure what can I do about it to get similar functionality.

I am quite new to Mathematica. Apologies if this is a trivial question.

share|improve this question
    
Why don't you take the x dependence sitting outside into the sum y = Sum[(x - x0)^[Alpha] *a[n] (x - x0)^n, {n, 0, Infinity}] –  Hubble07 Aug 26 '13 at 13:45
    
@Hubble07 Thank you for your comment. I am not sure why I have not tried it. It does yield the answer I was seeking for this particular question. However, I will need to "teach" Mathematica to recognise multiplication from outside of the sum for the next thing I am doing with the expressions, so the answers are very relevant anyway. –  user1391279 Aug 26 '13 at 14:18

2 Answers 2

up vote 5 down vote accepted

In our case a simple and direct approach would be defining a list of rules. Here is an example:

enter image description here

rules =
  { c_ Sum[n a[n] c_^(n-1), {n, 0, Infinity}] :> Sum[n c^n a[n], {n, 0, Infinity}],
    α_ Sum[a[n] c_^n, {n, 0, Infinity}] + Sum[n a[n] c_^n, {n, 0, Infinity}] :>
    Sum[(α + n) a[n] c^n, {n, 0, Infinity}]};

Let's define an appropriate function for TransformationFunctions applying rules to an expression:

 tf[expr_] := expr /. rules  

and now FullSimplify with tf does the expected transformation:

FullSimplify[ D[y, x], TransformationFunctions -> {Automatic, tf}]//TraditionalForm

enter image description here

alternatively one can do this:

FullSimplify[ D[y, x]] //. rules

Note: Applying rules in TransformationFunctions it was quite sufficient to play with ReplaceAll (/.) while in the latter case we had to use rules repeatedly i.e. with ReplaceRepeated (//.) .

share|improve this answer

One way to do it is application of series of rules to the expression, just to "teach" Mathematica of how to transform the expression. I will break the chain of transformations into steps to make it better visible. These are your functions:

 expr1 = (x - x0)^α  Sum[a[n] (x - x0)^n, {n, 0, Infinity}]
expr2 = D[expr1, x]

and here are the results:

enter image description here

Let us do the first transformation:

expr3 = expr2 /. u_*\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]v_\) -> \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\((u* v)\)\)

this is the result:

enter image description here

The second transformation:

 expr4 = expr3 /. (x - x0)^m_ \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(s_*\ 
\*SuperscriptBox[\((x - x0)\), \(q_\)]\)\) -> \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(s*\ 
\*SuperscriptBox[\((x - x0)\), \(q + m\)]\)\)

yielding

enter image description here

and the last one:

 expr5 = expr4 /. \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(u1_*
      v_\)\) + \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(u2_*
      v_\)\) -> \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(n = 
      0\), \(\[Infinity]\)]\(\((u1 + u2)\)*v\)\)

gives the result:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.