newRPL: symbolic numbers
12-30-2014, 04:50 PM (This post was last modified: 12-30-2014 05:59 PM by Han.)
Post: #21
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: newRPL: symbolic numbers
Full disclosure: I have not read the entire thread in full detail. The suggestion regarding ~ is explained below, mostly divorced of the pre-existing discussion.

The ~ notation isn't just a replacement for the secondary decimal point, which in my honest opinion is not a good idea. I don't think Y. should evaluate whatever is stored in the variable Y; in the HP48/49/50 series, Y. is a valid symbol (for a global variable). It should remain that way as never before have we allowed an operator to be attached to a symbol -- without spaces. This also means we don't have to worry about the meaning of Y.X -- is that a variable or is that Y. X (like how the HP48 allows 2+ to mean 2 +)?

The ~ symbol is a hybrid operator/delimiter/constant declarator with a prefix notation. It behaves exactly like the "$$-$$" symbol in that it can both be an operator or used to designate an approximate value. For me, the notions of exact and approx should be limited to only symbolic objects. This allows us to "collect" approx and exact terms and keep them separate. Outside of that, everything should just be a number and whether the fraction mark is displayed for numbers with "essentially" no trailing fractional part is relegated to a system flag. This also implies that '1' is a valid symbolic object. On the HP48 I believe it auto-simplified to just 1 (DOREAL as opposed to a composite DOSYMB containing a DOREAL).

Examples:

'~2.5+6.6-5' EVAL returns '~2.5+1.6'
'~2.5+6.6-5' ->NUM returns 4.1
'~2.5 * 2' EVAL returns '~2.5 * 2'
'~2.5 * 2' ->NUM returns 5. (or just 5 depending on the show-fraction-mark system flag)
2 ~ returns 2 or 2. (system flag)
'2' ~ returns '~2'
'2.5+5' ~ returns '~(2.5+5)'
'2.5*2+~3*(.5+~6)' EVAL returns '5+ ~3*.5 + ~18'
'2.5*2+~3*(.5+~6)' ->NUM returns 24.5

In the long run I think it will also make it easier to implement solvers (numerical or symbolic).

Edit: I suppose if you also want to implement using the fraction mark as an indicator for non-integers (outside of the the symbolic environment) that would be fine too.

Graph 3D | QPI | SolveSys
 « Next Oldest | Next Newest »

 Messages In This Thread newRPL: symbolic numbers - Claudio L. - 12-22-2014, 11:01 PM RE: newRPL: symbolic numbers - John Galt - 12-23-2014, 01:13 AM RE: newRPL: symbolic numbers - Claudio L. - 12-23-2014, 03:34 PM RE: newRPL: symbolic numbers - Nigel (UK) - 12-23-2014, 12:06 PM RE: newRPL: symbolic numbers - Claudio L. - 12-23-2014, 03:10 PM RE: newRPL: symbolic numbers - Claudio L. - 12-23-2014, 05:22 PM RE: newRPL: symbolic numbers - Nigel (UK) - 12-23-2014, 05:57 PM RE: newRPL: symbolic numbers - Claudio L. - 12-23-2014, 09:01 PM RE: newRPL: symbolic numbers - Nigel (UK) - 12-23-2014, 09:49 PM RE: newRPL: symbolic numbers - Claudio L. - 12-24-2014, 03:15 AM RE: newRPL: symbolic numbers - brouhaha - 12-23-2014, 09:27 PM RE: newRPL: symbolic numbers - Gilles - 12-24-2014, 11:12 AM RE: newRPL: symbolic numbers - Claudio L. - 12-24-2014, 07:51 PM RE: newRPL: symbolic numbers - Claudio L. - 12-29-2014, 03:19 PM RE: newRPL: symbolic numbers - Gilles - 12-29-2014, 07:38 PM RE: newRPL: symbolic numbers - Claudio L. - 12-29-2014, 10:21 PM RE: newRPL: symbolic numbers - Han - 12-29-2014, 09:33 PM RE: newRPL: symbolic numbers - Gilles - 12-30-2014, 10:00 AM RE: newRPL: symbolic numbers - Claudio L. - 12-30-2014, 02:19 PM RE: newRPL: symbolic numbers - rprosperi - 12-30-2014, 02:26 PM RE: newRPL: symbolic numbers - Han - 12-30-2014 04:50 PM RE: newRPL: symbolic numbers - Claudio L. - 12-30-2014, 07:18 PM RE: newRPL: symbolic numbers - Gilles - 12-30-2014, 10:18 PM RE: newRPL: symbolic numbers - Claudio L. - 12-30-2014, 10:39 PM

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