08/21/2014, 01:15 AM
(08/20/2014, 07:57 PM)jaydfox Wrote: Okay, here's the latest version:
(...)
There are probably still a few bugs in the code, so if you run into any, please let me know.
New version:
Sorry to post two versions in one day, but the performance boost was too huge to ignore. In the table below, the top column shows the number of polynomials I calculated. Below is the time in seconds. As you can see, version 3 cuts the time by 30%-50%, compared to version 2. But version 4 blows them both out of the water, cutting the time by more than an order of magnitude.
Code:
Vers. 60 100 150 200
v2 0.7 9.1 91 --
v3 0.5 5.6 49
v4 0.15 0.5 3.2 15.3How is this possible? Simple: I got rid of the rational coefficients. Essentially, I multiplied the nth polynomial by n!*2^(n-1), then divide through by that same constant when I use the polynomial. This saves at least n/2-1 divisions by a large number, plus all the underlying rational math that is working so hard to keep fractions in lowest terms and find least common multiples, etc.
No other significant changes in this version. A few minor updates (e.g., the show parameter in SeqPowers2m now cascades to the inner call to Seq())
~ Jay Daniel Fox

