kill(all)$

sum and powerseries , 'relation' , version 1.0
peter.vlasschaert@gmail.com,15/11/2018

programming maxima.

load packages:
-----------------------

load(lrats);
load(simplify_sum);

list : sum parts.

p1:a*x^2+b*x-d+2;
p1a:args(p1);

infinite sum : '[ list of variables ]'

p2:sum(1/k^2, k, 1, inf);

p2a:listofvars(p2);
p2b:p2a[1];

info : list  , 'infinite sum'
-----------------------------------

p3a:args(p2);

p3b:part(p2,0);

p3c:[p3b,p3a];
p3d:flatten(p3c);

rem:

   1e)    sum = sum
   ==============

p4:if p3b = p3d[1] then sum(p3d[2],k,p3d[4],p3d[5]) else printf(false,"not a sum");

 2e)    sum <>  1/k^2
=================

p4a:if p3b = p3d[2] then sum(p3d[2],k,p3d[4],p3d[5]) else printf(false,"not a sum");

we can't replace  'k'  with  'p3d[3]' not allowed here.

construct  function form the above:
==============================

f(k,p3q,p7q):=if p3q=p7q[1] then sum(p7q[2],k,p7q[4],p7q[5]) else printf(false,"not a sum")$

f(k,p3b,p3d);

f(m,p3b,p3d);

f1(p3q,p7q):=if p3q=p7q[1] then sum(p7q[2],k,p7q[4],p7q[5]) else printf(false,"not a sum")$

f1(p3b,p3d);

we can't replace  'k'  with  'm' not allowed here , indepent also.
rem : 'k' can't be changed here.

combination : two sums with same range
===================================

p5a:-3*1/k^3;
p5b:6*k/k^3;

p6a:sum(p5a,k,1,inf);
p6a1:intosum(p6a);
p6b:sum(p5b,k,1,inf);
p6b1:intosum(p6b);

p6c:sumcontract(p6a1+p6b1);
p6b:combine(p6c);
p6c:ratsimp(p6b);

how to use : pickapart, find  division parts
===================

p7:pickapart(p6c,1);

p7a:pickapart(p6c,2);

p7b:[%t29,%t30];

We want change 'k' to 'l' in the above.

p7c:subst([k=l],p6c);

p7d:lratsubst([k=l],p6b);

rem : difference between , 'subst' and 'lratsubst'

sum : ?  use 'nusum'  combination with function.

ff(a1,b1,c1,d1):=sum(a1,b1,c1,d1);

p8:ff(1/(1-l),l,1,m);

rem : not good  'p8'

p8a:sum(1/(1-l),l,1,m);

----------------------------------------------------------------------------------------------

ff1(a1,b1,c1,d1):=nusum(a1,b1,c1,d1);

p9:ff1(1/(1-l),l,a,mm);

rem : good result

subst([l=pp],p9);
p10:lratsubst([l=qq],p9);
p10a:intosum(p10);
p10b:radcan(p10a);

rem :see use 'lratsubst' is not good here.

------------------------------------------------------------------------------------------------

f11(p3q,p7q,h):=if p3q=p7q[h] then nusum(p7q[2],k,p7q[4],p7q[5]) else printf(false,"not a sum");

f11(p3b,p3d,2);

f11(p3b,p3d,1);

rem :  k can't be changed, k = dummie.
--------------------------------------------------------------------------------------------

sum                  => Menu:Calculus:Calculate Sum ( Simplify,nusum)
powerseries   => Menu:Calculus :Get Series (powerseries)
----------------------------------------------------------------------------------------------------

use , 'p8a' ,powerseries.

p11:p8a;

principle: powerseries, around some point :e1=0

p11a :limit(p11,m,inf) = subst([m=inf],p11);

p11b:part(rhs(p11a),0);
p11c:part(rhs(p11a),1);

p11c1:listofvars(p11c);
p11c2:p11c1[1];

p11d:powerseries(part(rhs(p11a),1),p11c2,e1);

p11e:subst([e1=0],p11d);

p11f:niceindices(p11e);

Combination function : powerseries and sum  :
======================================

fff(a1,b1,c1,d1,e1):=if d1=minf or d1=inf then  niceindices(powerseries(a1,b1,e1)) 
                                  else nusum(a1,b1,c1,d1);

fff(1/(1-x),x,1,inf,0);
fff(1/(1-x),x,1,m,0);

=>     math:  sum(1/(1-l),l,1,inf) =sum(l^i,i,0,inf) , -1 < l < 1.  cvg : radius

-----------------------------------------------------------------------------------------------------------------------------

extra: ?  assume ?

assume(abs(l)-1<0);

p12:sum(l^i,i,0,inf),simpsum;

rem:abs(l)-1 < 0  =>   cvg      (convergent)
         abs(l)-1 > 0  =>   dvg      (divergent   )

rem: sum by default  : not linear  properties.
=>  declare(sum,linear)  => remove(sum,linear)

p13:p11;

Menu:Calculus:Integral /Sum => Old => New => equation.
  Old = l , New = y ,equation = 'y=l-1'
===============================================

sum:

p14:changevar(p11, y=l-1, y, l);

p15:changevar(rhs(p11a), y=l-1, y, l);

rem : inf-1 = inf   =>  'p14' and  'p15'

----------------------------------------------------------------------------------------