Post Reply 
newRPL - build 1255 released! [updated to 1299]
08-01-2018, 05:09 AM (This post was last modified: 08-01-2018 03:45 PM by The Shadow.)
Post: #244
RE: newRPL - build 1089 released! [update:build 1089]
Okay, so FACTORS now makes the first prime factor negative if the original number was negative. I assume this is just a marker, because otherwise it's flat-out wrong. (ie, it says that -180 factors as (-2)^2*3^2*5.)

Of course, this means that -1, 1, and 0 have the same factorization! Since they have no prime factors at all.

Two possible options:

1) Bite the bullet and give two outputs, one the list and the other of the unit. So -180 would give:

{ 2 2 3 2 5 1 }
-1,

and -1 would give:

{ }
-1

2) Or, go all OldRPL and include the unit, but be consistent and do it every time, not just for negatives. So +180 would give:

{ 1 1 2 2 3 2 5 1 }

I dislike this option but if it's always there it's much easier to manage. Likewise, the factorization of 0 would be:

{ 0 1 }

(EDIT: There's also option 3: Once tagged objects are in, tag the list of factors with the unit.)

FACTORS also chokes on some non-integer inputs without throwing an error. For example, 1.5 gives:

{ 1.5 1 -1 0 }

which is more than a little odd. Other times it seems to round off first. OldRPL would actually factor rational numbers, so 1.5 (well, '3/2', but the difference isn't as important in NewRPL) would give:

{ 2 -1 3 1 }

which strikes me as much more desirable.

The polynomial factorization is still a little odd. It throws an error when the polynomial has complex roots, but still manages to calculate them. I think it's more sensible to have a flag to just not break up factors irreducible in the reals. Of course, this gives headaches in the output syntax, as the vector notation breaks down. You'd need something like this for [1 0 0 1]:

{ [ 1 1 ] 1 [1 -1 1] 1 }

EDIT: I think this is desirable anyway, since currently the input and output are both vectors, but vectors interpreted in entirely different ways.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
RE: newRPL - build 1089 released! [update:build 1089] - The Shadow - 08-01-2018 05:09 AM
newRPL - brickviking - 10-05-2018, 06:01 AM
How to participate? - erazor - 12-13-2019, 07:12 AM



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