newRPL: symbolic numbers
12-23-2014, 05:22 PM
Post: #6
 Claudio L. Senior Member Posts: 1,840 Joined: Dec 2013
RE: newRPL: symbolic numbers
(12-23-2014 12:06 PM)Nigel (UK) Wrote:  Unless they are deliberately quoted they should stay approximate, even if they appear inside a quoted expression.

Inside symbolics, numbers would have to be flagged as either exact or approximated, effectively moving from a global flag to a flag on each number.

Following the idea that an approximated number "turns" an exact number into approximated this would be:

'1' '1/2' + --> '3/2'
'1' 0.5 + --> '1.5' (here 1.5 would be an approx. symbolic number)
'3/2*X' 3 * --> '4.5*X' (here 4.5 is approx)
'3/2*X' '3' * --> '9/2*X'

The other approach would be the opposite: exact numbers turn approximated numbers into exact:
1 '1/2' + --> '3/2'
'1' 0.5 + --> '3/2'
'3/2*X' 3 * --> '9/2*X'
'3*X' 1.5 * --> '9/2*X'

I can't see any problem with either approach, perhaps a flag "prefer exact" or "prefer approx." could select between these two approaches, but we are back to a system-wide flag, not too different from "exact mode" in the 50g, except if you use only quoted numbers, or only unquoted numbers, the flag won't affect your results (only the mix would present problems).

The main difference of doing this vs. the 50g would be that exact and approximated terms can coexist within the same expression:

'3.5*X+7/2*Y' (where we'd have to indicate somehow when we type the expression that the 3.5 is approximated, otherwise it's exact even though is not an integer)

Adding 'X' to the above expression, would be:
'3.5*X+7/2*Y' 'X' + --> '4.5*X+7/2*Y' (using prefer approx.)
'3.5*X+7/2*Y' 'X' + --> '9/2*X+7/2*Y' (using prefer exact)

Notice the second term remains unaltered. The above example on the 50g triggers the "Approximate mode on?" question (after pressing EVAL). If accepted, it kills all fractions in the expression, if not accepted it errors and returns the original expression '3.5*X+7/2*Y+X'.

One more problem with this:
Typing a whole expression from the keyboard, we need to indicate somehow when a number is exact or not. Outside a symbolic we add quotes, but what to do when we are typing inside a symbolic?

'3.5*X' typed would make 3.5 an exact number, so:
'3.5*X' DUP * would return a fraction (49/4), as we would be multiplying two exact numbers.

We'd also need a way to visually distinguish exact vs approx. numbers on screen (bold font?).
 « 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)