10
$\begingroup$

I am trying to use Mathematica to simplify a symbolic expression involving Sum. The expression is defined as follows:

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

I am trying to use FullySimplify on the derivative of the expression with respect to x 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 new to Mathematica and would like to apologise if this is a trivial question.

$\endgroup$
  • $\begingroup$ 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}] $\endgroup$ – Hubble07 Aug 26 '13 at 13:45
11
$\begingroup$

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 (//.) .

$\endgroup$
3
$\begingroup$

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

$\endgroup$
  • $\begingroup$ The first and second pictures (yielded results), they look the same. $\endgroup$ – H. R. Mar 27 '17 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy