Talk:Bernoulli numbers: Difference between revisions
Content added Content deleted
(→Algorithm?: corrected a typo, added a couple of comments.) |
(→use of memoization: added a new section, corrected "reply" indentation from :: to :::.) |
||
Line 124: | Line 124: | ||
:: I just copied the Wikipedia algo. (with <strike>atribution</strike> attribution). People don't have to use it, but they don't have to search for at least one algo. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 01:20, 12 March 2014 (UTC) |
:: I just copied the Wikipedia algo. (with <strike>atribution</strike> attribution). People don't have to use it, but they don't have to search for at least one algo. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 01:20, 12 March 2014 (UTC) |
||
:: Yes, it sure ''looks'' simple. The programming solutions that used it also looks simple and clean. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:56, 12 March 2014 (UTC) |
::: Yes, it sure ''looks'' simple. The programming solutions that used it also looks simple and clean. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:56, 12 March 2014 (UTC) |
||
----- |
|||
The double sum formula used by the REXX example is #33 from the entry [http://mathworld.wolfram.com/BernoulliNumber.html Bernoulli number] on The Eric Weisstein's World of Mathematics (TM). |
|||
<br><br> |
|||
::::::: <math> B_n = \sum_{k=0}^n \frac{1}{k+1} \sum_{r=0}^k (-1)^r \binom kr r^n </math> |
|||
<br> |
|||
:::::::::::::: where <math> \binom kr</math> is a binomial coefficient.<br> |
|||
<br> -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:00, 18 March 2014 (UTC) |
|||
==use of memoization== |
|||
In the REXX programming solution, I added memoization for the COMB and PERM functions (combinations and permutations). |
|||
<pre> |
|||
For computing the Bernoulli numbers up to (and including): |
|||
50 values, memoization was 17% faster. |
|||
100 " " " 38% " |
|||
200 " " " 42% " |
|||
</pre> |