newRPL - build 1255 released! [updated to 1299]
|
08-01-2018, 05:11 PM
(This post was last modified: 08-01-2018 05:13 PM by Claudio L..)
Post: #245
|
|||
|
|||
RE: newRPL - build 1089 released! [update:build 1089]
Quote:The Shadow wrote: Ouch, and I thought I had accomplished a lot in the 5 minutes I had available. Of course the negative sign doesn't work with even multiplicity. So I guess having -1 1 at the beginning is the only real solution. Quote:The Shadow 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 Arguments returned in this order allow the original number to be reconstructed simply by: Code:
For example factoring 180_m would output: 1_m {2 3 5} {2 2 1} The "unity" contains the sign, and any other strange "features" in the original number. Quote:The Shadow wrote: 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 zero would factor as: 1 { 0 } { 1 } Quote:The Shadow wrote: I thought there was a trap for integers only, but I like the factorization of the fraction! For example 0.15 should be factored as 15 (*10^-2), then it's almost trivial to find all '2's and '5's in the list (or add them) then subtract 2 from their exponent. Quote:The Shadow wrote:It's on purpose, (same as a square root) it throws an error if the result is complex and you are not in complex mode, other than that the results should be good, and if you set the complex mode flag the error will quietly vanish Quote:The Shadow wrote:I think the output should be the same as I proposed above for reals. Forget the vectors and use lists, after all the result is a list of factors, not another polynomial. 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) ) Then the factored polynomial equation can be easily obtained by: Code: 'X' ROT + SWAP ^ ΠLIST * |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 26 Guest(s)