newRPL: Angles revisited
04-03-2016, 11:05 AM
Post: #21
 Nigel (UK) Senior Member Posts: 347 Joined: Dec 2013
RE: newRPL: Angles revisited
(04-01-2016 11:15 PM)Claudio L. Wrote:  This could be a problem. For example an expression:
'ASIN(A)*ASIN(A)/ASIN(A)'. The user has the settings in DEG, and thinks ASIN will return DEG, so you would expect the result to be let's say 45 or ∡45°.
If the operator associates the right side first:
ASIN(A)*(ASIN(A)/ASIN(A)) = ASIN(A)*1 = ∡45°

but if it associates from the left:
(ASIN(A)*ASIN(A))/ASIN(A) = (pi/4)^2/∡45° = pi/4 (correct, but in radians!)

With the "angle is a number" approach:
ASIN(A)*(ASIN(A)/ASIN(A)) = ASIN(A)*1 = ∡45°
(ASIN(A)*ASIN(A))/ASIN(A) = 45^2 / ∡45° = 45 (not an angle, but at least the same number as expected)

On the other hand, the "angle is a number" can also give bad results in expressions with mixed systems:

'∡50g*2/∡90°'
If associated from the left:
(∡50g*2)/∡90° = ∡100g/∡90° = 1
versus:
∡50g*(2/∡90°)= ∡50g*(1/45)= ∡1.11111111111111g

This can seriously drive a user crazy. What could be a solution for this?

Suppose we allow powers - positive and negative - of these angle tags. Then:
45D * 45D / 45D is 45D whichever way we associate, and
50G * 2 / 90D is always going to be 1.

A rule saying that when adding an angle to a number, the number has an implicit tag corresponding to the current angular mode but that there are no implicit tags for multiplication or division would make me happy, but I expect that you would prefer the tag for addition to come from the first argument.

There should be a function that at any point removes a tag, including its powers, leaving a number that depends on the current angular mode. This function will be called if an operation is performed that makes no sense for angles.

Does this work? If so, does it introduce new problems that I haven't yet considered?

Nigel (UK)
 « Next Oldest | Next Newest »

 Messages In This Thread newRPL: Angles revisited - Claudio L. - 03-31-2016, 06:13 PM RE: newRPL: Angles revisited - Han - 03-31-2016, 06:49 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 12:50 AM RE: newRPL: Angles revisited - Helix - 04-01-2016, 05:33 PM RE: newRPL: Angles revisited - Han - 04-01-2016, 05:48 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 06:22 PM RE: newRPL: Angles revisited - Nigel (UK) - 04-01-2016, 06:27 PM RE: newRPL: Angles revisited - emece67 - 04-01-2016, 07:01 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 11:15 PM RE: newRPL: Angles revisited - emece67 - 04-01-2016, 11:46 PM RE: newRPL: Angles revisited - Nigel (UK) - 04-03-2016 11:05 AM RE: newRPL: Angles revisited - Claudio L. - 04-04-2016, 12:04 AM RE: newRPL: Angles revisited - rprosperi - 03-31-2016, 06:54 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 12:55 AM RE: newRPL: Angles revisited - rprosperi - 04-01-2016, 02:10 AM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 03:47 PM RE: newRPL: Angles revisited - Guenter Schink - 04-01-2016, 09:58 PM RE: newRPL: Angles revisited - Nigel (UK) - 03-31-2016, 08:40 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 01:12 AM RE: newRPL: Angles revisited - Nigel (UK) - 04-01-2016, 06:20 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 06:43 PM RE: newRPL: Angles revisited - Claudio L. - 04-01-2016, 07:11 PM RE: newRPL: Angles revisited - SlideRule - 04-03-2016, 04:27 PM RE: newRPL: Angles revisited - Vtile - 04-03-2016, 08:12 PM RE: newRPL: Angles revisited - Claudio L. - 04-03-2016, 11:58 PM RE: newRPL: Angles revisited - Claudio L. - 04-04-2016, 11:52 AM RE: newRPL: Angles revisited - Claudio L. - 04-06-2016, 01:58 PM RE: newRPL: Angles revisited - Nigel (UK) - 04-07-2016, 01:55 PM RE: newRPL: Angles revisited - Claudio L. - 04-07-2016, 05:51 PM RE: newRPL: Angles revisited - Helix - 04-07-2016, 01:04 PM RE: newRPL: Angles revisited - Claudio L. - 04-07-2016, 01:35 PM RE: newRPL: Angles revisited - Francois Lanciault - 05-10-2016, 04:48 AM RE: newRPL: Angles revisited - Claudio L. - 05-10-2016, 02:52 PM

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