Post Reply 
prefix notation and () on newRPL project
01-14-2023, 12:29 AM
Post: #12
RE: prefix notation and () on newRPL project
(01-13-2023 04:15 PM)carey Wrote:  
(01-22-2019 07:32 PM)Thomas Klemm Wrote:  What's wrong with SEQ?

Python

>>> [ x**2 + 1 for x in range(1, 11, 2) ]

[2, 10, 26, 50, 82]

Algebraic

'SQ(X)+1'
'X'
1 9 2
SEQ

{ 2 10 26 50 82 }

Or using RPL

« X SQ 1 + »
'X'
1 9 2
SEQ

{ 2 10 26 50 82 }


Kind regards
Thomas

Thomas, thanks for this clear comparison!

Just out of curiosity to see what this SEQ example would look like using the HP50g's not-often used algebraic mode (in contrast to the algebraic example in the quoted post that uses an algebraic expression in rpn mode), the following worked:

Code:

SEQ('SQ(X) + 1', 'X', 1, 9, 2)

{ 2 10 26 50 82 }

Two things surprised me: (i) the algebraic mode parameter list for SEQ was intuitive so it was easy to guess right the first time, and although I'm reluctant to admit it, (ii) the function call looks nicer (to me) in algebraic mode than in RPL or Python.

I agree with you.
But fortunately, you can do the same thing in RPN mode. It's probably a little slower though.

Just surround the entire expression with the character #96.
I mean: << 96 CHR >> on your calculator or SHIFT↱ + CHARS ... then it's just the character before the lowercase "a" (unicode U+2035 on a computer).


<< ‵SEQ('SQ(X) + 1', 'X', 1, 9, 2)‵ >>

Bruno
Sanyo CZ-0124 ⋅ TI-57 ⋅ HP-15C ⋅ Canon X-07 + XP-140 Monitor Card ⋅ HP-41CX ⋅ HP-28S ⋅ HP-50G ⋅ HP-50G
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: prefix notation and () on newRPL project - FLISZT - 01-14-2023 12:29 AM



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