Post Reply 
XCas sum limit confusion
08-26-2020, 07:48 PM
Post: #1
XCas sum limit confusion
Quote:Discrete sum (with 2 or 4 arguments return then sum from a to b if a<=b
or of the opposite of the sum from b+1 to a-1 if a>b+1 or 0 if a=b+1)
or the discrete primitive or sum of the elements of a list or a sequence.

sum(Expr,Var,VarMin(a),VarMax(b),[VarStep(p)])
Above quote is from XCas help screen for sum()

Why the convoluted swapping of limit with aboved logic ?
And, why swapped limit changed to b+1 to a-1, and not b to a ?

Some confusing examples:

XCas> sum(k, k, 1, 5)       // = 1+2+3+4+5 = 15
XCas> sum(k, k, 5, 1)       // = -sum(k, k, 2, 4) = -(2+3+4) = -9. OK, but don't know why

XCas> sum(k, k, 5, 1, 1)   // got 15 ? somehow, step flipped to -1, instead of swapping limits.

XCas> sum(k, k, 5.1, 1)    // got -14.0 ? expected -sum(k, k, 2, 4.1) = -(2+3+4) = -9

Missing step is not equivalent to default step=1

XCas> factor(sum(k, k, a, b))   // (b+a)*(b-a+1)/2
XCas> sum(k, k, a, b, 1)          // "Unable to sort boundaries a,b Error: Bad Argument Value"
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
XCas sum limit confusion - Albert Chan - 08-26-2020 07:48 PM
RE: XCas sum limit confusion - Albert Chan - 08-26-2020, 09:58 PM
RE: XCas sum limit confusion - Albert Chan - 09-02-2023, 12:54 PM



User(s) browsing this thread: 1 Guest(s)