newRPL - build 1255 released! [updated to 1299]
Post: #248
 The Shadow Member Posts: 232 Joined: Jan 2014
RE: newRPL - build 1089 released! [update:build 1089]
Claudio L. Wrote:I'm liking this idea. While it will break compatibility, I think it goes a long way to make the result more usable.
Actually, once you break compatibility we can completely break it and output:
* A unity factor (or sign actually), which would allow the quantity being factored to even have a physical unit attached to it.
* A list of factors
* A list of multiplicity

I vastly prefer this solution, but didn't realize it was on the table. By all means, do this!

EDIT: The reason why I strongly prefer it is that to actually USE the factorization for anything, you have to separate the multiplicities from the primes anyway. It's an extra loop (or extra caution on a single loop) in every single program that uses prime factors, and it shouldn't be necessary.

I hadn't thought of your idea of being able to give the unit well, units. That's very cool.

Quote:I think it would be cleaner to do the above.
Then 1 would be:
1
{ }
{ }
(the only catch is that ΠLIST errors on empty lists, so this case needs to be trapped separately)

or we could actually do:
1
{ 1 }
{ 1 }

to make it more manageable by programs

I can live with the latter, as long as 1 never shows up as a factor in anything but 1, -1, or 0.

(I actually wouldn't have a problem error-trapping on empty lists, but I see your point.)

Quote:zero would factor as:
1
{ 0 }
{ 1 }

Bad idea. You're basically defining zero as positive. Better to do:

0
{ 1 }
{ 1 }

Yes, technically zero is not a unit... but it just makes more sense this way.

Quote:So, we would leave the leading factor, then a list of factors (or perhaps we should change the signs and output the roots?) and then a list of multiplicities.
For example for 4*x^2-8*x+4 the output would be:
4
{ -1}
{2}

(we could also use +1 in the middle list and define the factors as (x-an) rather than (x+an) )

Looks good. (x-an) is more traditional in the math community, because x-an=0 yields an rather than -an.

If you decide to let FACTORS handle rational numbers (please do!) don't forget to let it also handle rational functions. Just allow for negative exponents on polynomial factors.
 « Next Oldest | Next Newest »