Roger Hui-2 wrote: > > Generating functions are valuable for the insights they provide. > Yes, I fully agree.
> On Tcd ../ue, May 22, 2012 at 7:45 AM, Viktor Cerovski > <viktor.cerov...@gmail.com> wrote: >> >> >> Raul Miller-4 wrote: >>> >>> Based on the mathworld page, this looks like an implementation of >>> Bernoulli numbers in J: >>> >>> bernoulli=: ! * (% ^ - 1:) t. >>> >>> >> Sure, you can calculate them via generating function, that's very elegant >> and very slow: >> >> B0t=: [: ([ , +/@:(* i.!>:) -@% 1+])~/ }:@i.@-,1: >> >> ts'b0 =. bernoulli i.100x' >> 23.3222 4.87437e6 >> >> ts'B0 =. B0t 100x' >> 0.181124 119168 >> >> b0-:B0 >> 1 >> >> _2{b0 >> 67908260672905495624051117546403605607342195728504487509073961249992947058239r6 >> >> >> >>> Example use: >>> >>> bernoulli i. 9 >>> 1 _0.5 0.166667 _4.16334e_17 _0.0333333 _1.30104e_17 0.0238095 >>> _1.76074e_16 _0.0333333 >>> >>> The "zero" values are not quite zero, but that's a limitation of >>> floating >>> point. >>> >>> -- >>> Raul >>> >>> On Sun, May 20, 2012 at 6:07 AM, Viktor Cerovski >>> <viktor.cerov...@gmail.com> wrote: >>>> R.E. Boss wrote: >>>>> What is the relation between the integrals ( >>>>> http://www.jsoftware.com/jwiki/Pi/AConvergentSeries ) and the >>>>> Bernoulli >>>>> numbers? Or >>>>> where can I find it? >>>> >>>> The first integral has the form: >>>> >>>> integral cos(2x) * product_n cos(x/n) dx >>>> >>>> When you write the product of cos(x/n) as exp of sum of ln cos(x/n), >>>> series expansion of ln cos(x/n) has Bernoulli numbers >>>> in its coefficients. >>>> >>>> Obtained double-sum series then should be transformed >>>> a bit and appropriately truncated so that it has sufficient precision, >>>> and then numerical integration performed. >>>> >>>> The second expression (expansion of pi/8) is written in terms >>>> of integrals with different cosine terms and the same infinite >>>> product term, so truncation and numerical integration has to be done >>>> with even higher precision for m=1, etc. >>>> >>>> In short, there is quite a bit of work to get this through in J. >>>> >>>> >>>> >>>>> >>>>> R.E. Boss >>>>> >>>>> >>>>>> -----Oorspronkelijk bericht----- >>>>>> Van: programming-boun...@jsoftware.com >>>>>> [mailto:programming-boun...@jsoftware.com] Namens Viktor Cerovski >>>>>> Verzonden: dinsdag 15 mei 2012 18:54 >>>>>> Aan: programming@jsoftware.com >>>>>> Onderwerp: Re: [Jprogramming] Challenge 12(?) >>>>>> >>>>>> >>>>>> >>>>>> R.E. Boss wrote: >>>>>> > >>>>>> > I scanned a part of Exploratory Experimentation and Computation, >>>>>> > https://www.opendrive.com/files?57384074_sCfMP , where two >>>>>> > statements are made about a very rapidly convergent series. >>>>>> > >>>>>> > 1. The first term coincides with (pi % 8) in the first 42 digits >>>>>> > 2. The first 2 terms even give 500 digits >>>>>> > >>>>>> > How can these two statements be confirmed (or rejected) with J? >>>>>> > >>>>>> They can be confirmed by calculating the integrals. >>>>>> >>>>>> Bernoulli numbers are involved among other things, and Roger's essay >>>>>> http://www.jsoftware.com/jwiki/Essays/Bernoulli%20Numbers >>>>>> gives >>>>>> >>>>>> B0=: 3 : 0 >>>>>> b=. ,1x >>>>>> for_m. }.i.x: y do. b=. b,(1+m)%~-+/b*(i.m)!1+m end. >>>>>> ) >>>>>> >>>>>> which can be shortened to: >>>>>> >>>>>> B0t=: [: ([ , +/@:(* i.!>:) -@% 1+])~/ }:@i.@-,1: >>>>>> >>>>>> B0 20 >>>>>> 1 _1r2 1r6 0 _1r30 0 1r42 0 _1r30 0 5r66 0 _691r2730 0 7r6 0 >>>>>> _3617r510 >>>>>> 0 >>>>>> 43867r798 0 >>>>>> >>>>>> B0t 20x >>>>>> 1 _1r2 1r6 0 _1r30 0 1r42 0 _1r30 0 5r66 0 _691r2730 0 7r6 0 >>>>>> _3617r510 >>>>>> 0 >>>>>> 43867r798 0 >>>>>> >>>>>> ts 'y0=.B0 200' >>>>>> 1.85257 362496 >>>>>> >>>>>> ts 'y0t=.B0t 200x' >>>>>> 1.8853 293888 >>>>>> >>>>>> y0-:y0t >>>>>> 1 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> > >>>>>> > (No deadlines apply.) >>>>>> > >>>>>> > >>>>>> > R.E. Boss >>>>>> > >>>>>> > >>>>>> ---------------------------------------------------------------------- >>>>>> > For information about J forums see >>>>>> http://www.jsoftware.com/forums.htm >>>>>> > >>>>>> > >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://old.nabble.com/Challenge-12%28-%29-tp33844136s24193p33849223.html >>>>>> Sent from the J Programming mailing list archive at Nabble.com. >>>>>> >>>>>> ---------------------------------------------------------------------- >>>>>> For information about J forums see >>>>>> http://www.jsoftware.com/forums.htm >>>>> >>>>> ---------------------------------------------------------------------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://old.nabble.com/Challenge-12%28-%29-tp33844136s24193p33877568.html >>>> Sent from the J Programming mailing list archive at Nabble.com. >>>> >>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Challenge-12%28-%29-tp33844136s24193p33889704.html >> Sent from the J Programming mailing list archive at Nabble.com. >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > -- View this message in context: http://old.nabble.com/Challenge-12%28-%29-tp33844136s24193p33890138.html Sent from the J Programming mailing list archive at Nabble.com. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm