(%i43) nusum(x^k,k,1,inf);
(%o43) x^(inf+1)/(x-1)-x/(x-1)
A user has to clean this up with limit:
(%i44) limit(%);
Is abs(x) - 1 positive, negative, or zero? neg;
Is x positive, negative, or zero? pos;
Is x - 1 positive or negative? neg;
(%o44) -x/(x-1)
Barton
Logged In: YES
user_id=501686
nusum is superseded by the more recent and extensive
Zeilberger package (share/contrib/Zeilberger) which includes
Gosper's algorithm as a special case.
Be that as it may, it turns out GosperSum in the Zeilberger
package has exactly the same defect ...
load ("Zeilberger/LOADZeilberger.mac");
GosperSum (x^k, k, 1, inf);
=> x^(inf+1)/(x-1)-x/(x-1)
I am guessing that the algorithm is phrased in terms of "n"
and there is no check to ensure that n is finite. If I'm not
mistaken the Zeilberger/Gosper stuff is advertised generally
as "indefinite summation" so that's understandable, but if
so then the Maxima fcns should make an effort to rule out
inapplicable cases.
I don't think it's worthwhile to fix nusum -- I think any
effort on this problem should be directed to the Zeilberger
package.
best,
Robert Dodier
Logged In: YES
user_id=588346
It is easy enough for the top level of GosperSum to convert
GS(...,v,a,inf)
to
limit(GS(...,v,a,GENSYM),GENSYM,inf)
In some cases (probably not for the output of GS), this will
return a noun form, but there's nothing wrong with that.
Logged In: YES
user_id=588346
PS I do NOT recommend leaving in the INF and using the
1-argument form of Limit for cleaning up, partly because
expressions involving multiple INFs are problematic (though
Limit supposedly treats them as though they're all the same
variable) and partly because Limit is buggy:
assume(a>1)$
limit(a*inf-inf) => minf
Logged In: YES
user_id=1179910
Originator: NO
sum(x^k, k, 0, inf) can be done by
(%i1) sum(x^k, k, 0, inf), simpsum;
Is abs(x) - 1 positive, negative, or zero? neg;
(%o1) 1/(1-x)
A more interesting example is
(%i2) sum(k*x^k, k, 1, inf), simpsum;
(%o2) sum(k*x^k,k,1,inf)
(%i3) nusum(k*x^k, k, 1, inf);
(%o3) (x^(inf+1)*(inf*x-inf-1))/(x-1)^2+x/(x-1)^2 <-- applying limit would not help!
(%i4) load(closed_form)$
(%i5) closed_form(%o2);
Is abs(x) - 1 positive, negative, or zero? neg;
Is x positive, negative, or zero? pos;
Is x - 1 positive or negative? neg;
(%o5) x/(x^2-2*x+1)
closed_form uses nusum with substituted bounds and then computes the limit (as was suggested by Stavros). I propose we do not change nusum or GosperSum and advise users to always use closed_form for simplifying sums. In this case we can close this bug as 'wont fix'.
Andrej