newRPL - build 1255 released! [updated to 1299]
Post: #244
 The Shadow Member Posts: 233 Joined: Jan 2014
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.
 « Next Oldest | Next Newest »