newRPL: symbolic numbers
12-22-2014, 11:01 PM
Post: #1
 Claudio L. Senior Member Posts: 1,840 Joined: Dec 2013
newRPL: symbolic numbers
Here's an idea to eliminate the "approximate" vs "exact" mode.
What if symbolic numbers are allowed to remain symbolic?

On the 50g, typing '2' (by being quoted, the user intended this as a symbolic expression with the number 2 inside) is automatically converted to the number 2 (ZINT or real depending on flags).
But what if the number was kept symbolic?
This would (in theory) eliminate the need for two separate modes of operation.
When the user wants a quantity to be symbolic, just adding quotes will keep it symbolic.
Within programs, instead of changing flags all the time, or issuing an error, you'd simply quote the quantities and all results would come up symbolic, or leave the numbers unquoted to get a real (approximate) result.
To convert from symbolic to number, the usual ->NUM would work, and we'd need the opposite to turn an existing number into a symbolic (perhaps ->SYMB?).

The idea would be something like this:
{ 1 2 3 4 5 } '2' / would return { '1/2' '2/2' '3/2' '4/2' '5/2' }
{ 45 '45' } SIN would return { 0.707... 'SIN(45)' }
2 INV --> 0.5
'2' INV --> '1/2'

In other words, quoted numbers would work more like symbolic constants do now.

BTW, reals within symbolics are already treated as first class citizens, so quoted reals will work just fine:
'1.5/4' DUP * EVAL returns 0.14.... even in exact mode on the 50g because of the real number in the expression. This same code returns the symbolic '9/64' in newRPL.

Am I missing something? Could this achieve the goal of eliminating the mode switching nightmare? Any problems that could arise from doing this?
 « 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)