HP 50g - summation
06-03-2016, 12:47 PM
Post: #1
 Simone Cerica Member Posts: 60 Joined: Mar 2014
HP 50g - summation
Hello everyone, is there a way to make a summation in such a way that

'\GS(N=1,5,XN)' = 'X1+X2+X3+X4+X5' ?

Simone
06-03-2016, 03:36 PM
Post: #2
 wojtek Member Posts: 131 Joined: Dec 2015
RE: HP 50g - summation
(06-03-2016 12:47 PM)Simone Cerica Wrote:  Hello everyone, is there a way to make a summation in such a way that

'\GS(N=1,5,XN)' = 'X1+X2+X3+X4+X5' ?

Simone

Your post is not clear enough, but if you want 50g build an expression 'X1+X2+X3+X4+X5' instead of counting the sum, I'm afraid there is no such a function buit in, but it should be easy to write a program using the concatenation of strings, that is "+".
06-03-2016, 04:21 PM
Post: #3
 Tugdual Senior Member Posts: 756 Joined: Dec 2013
RE: HP 50g - summation
Or is that the sum,of a list?
06-03-2016, 05:20 PM (This post was last modified: 06-03-2016 05:25 PM by Claudio L..)
Post: #4
 Claudio L. Senior Member Posts: 1,840 Joined: Dec 2013
RE: HP 50g - summation
(06-03-2016 12:47 PM)Simone Cerica Wrote:  Hello everyone, is there a way to make a summation in such a way that

'\GS(N=1,5,XN)' = 'X1+X2+X3+X4+X5' ?

Simone

Code:
 << -> N V  << 1 N FOR K  'V' RCL  ->STR TAIL HEAD K + STR-> NEXT WHILE N 1 > REPEAT + 'N' DECR DROP END >> >>

Store it in let's say XSUM, then:
'XSUM(5,X)' EVAL will produce what you want. It's limited to single-letter identifiers (by using TAIL HEAD, this can be improved).
Another improvement could be a start value for N, but you get the idea.

Quick footnote: For those trying this in newRPL, the TAIL HEAD combination needs to be removed, as the identifiers in symbolics are unquoted, then the code is good for arbitrary length identifiers.
06-04-2016, 09:26 AM
Post: #5
 Simone Cerica Member Posts: 60 Joined: Mar 2014
RE: HP 50g - summation
(06-03-2016 05:20 PM)Claudio L. Wrote:  'XSUM(5,X)' EVAL will produce what you want. It's limited to single-letter identifiers (by using TAIL HEAD, this can be improved).
Another improvement could be a start value for N, but you get the idea.

It was just what I wanted,

grazie Claudio.
 « Next Oldest | Next Newest »

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