Roger, you first example below should have been (bernoulli i.9) rather than (bernoulli i.9x). You modified the line before typing Enter, I guess.
>________________________________ > Fra: Roger Hui <rogerhui.can...@gmail.com> >Til: Programming forum <programming@jsoftware.com> >Sendt: 5:16 tirsdag den 22. maj 2012 >Emne: Re: [Jprogramming] Challenge 12(?) > >Or use extended precision arguments. e.g. > > bernoulli=: ! * (% ^ - 1:) t. > > bernoulli i.9x >1 _0.5 0.166667 _4.16334e_17 _0.0333333 _1.30104e_17 0.0238095 _1.76074e_16 >_0.0333333 > > bernoulli i.9x >1 _1r2 1r6 0 _1r30 0 1r42 0 _1r30 > > > >On Mon, May 21, 2012 at 4:12 PM, Bo Jacoby <bojac...@yahoo.dk> wrote: > >> (|**) gets rid of the rounding errors around 0. >> >> (|**) bernoulli i.9 >> 1 _0.5 0.166667 0 _0.0333333 0 0.0238095 0 _0.0333333 >> >> >> >> >> >> >> >________________________________ >> > Fra: Raul Miller <rauldmil...@gmail.com> >> >Til: Programming forum <programming@jsoftware.com> >> >Sendt: 21:39 mandag den 21. maj 2012 >> >Emne: Re: [Jprogramming] Challenge 12(?) >> > >> >Based on the mathworld page, this looks like an implementation of >> >Bernoulli numbers in J: >> > >> > bernoulli=: ! * (% ^ - 1:) t. >> > >> >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 >> > >> > >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> >---------------------------------------------------------------------- >For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm