Question: Generating a series

Hello maple prime users

I have used the sequence command and series command in Maple before, but seem to have hit a little hurdle with a particular problem.

I want to run the expression:

h(a,b,c):=b!*(a+c)!*sum(F,n=0..c)

   Where F:=(-1)^n*binomial(c,n)*N(a+n):

   Where N(a):=(-1)^n*[evalf(ln(2)) - 1 + 0.5 -1/3 + 1/4 +... + (-1)^a/a]:

I ran a test case using the following code:

restart:
a:=1:
b:=2:
c:=3:
tot:=0:
F:=((-1)^(a+n)/(a+n)):

for n from 0 to c do
      Seq_F2:=(-1)^(a+n):
   
      Seq:=[seq(F,n=0..n)];
      Seq2:=convert(Seq, `+`);

      final:=Seq_F2*(evalf(ln(2))+Seq2);

      SS:=(-1)^n*binomial(c,n)*final;

      S:=(b!*(a+c)!)*SS;
      tot:=tot+S;
od:
tot;

This works for the case where a =1, but will not work for a>1 as in the N(a+n) sequence it misses out the terms in the series for a-1, a-2 etc.... So when a = 2 it misses out the -1 of the sequence and when a = 3 it misses out the -1 and 1/2. Are there any tips on how to overcome this?

 

Best regards

 

- Yeti

Please Wait...