[Date Index]
[Thread Index]
[Author Index]
Re: Bernoulli Numbers
*To*: mathgroup at smc.vnet.net
*Subject*: [mg122637] Re: Bernoulli Numbers
*From*: "Alexander Elkins" <alexander_elkins at hotmail.com>
*Date*: Fri, 4 Nov 2011 06:00:14 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <j8r9gv$3jd$1@smc.vnet.net>
Mathematica provides for the computation of Bernoulli numbers:
In[1]:= expect=Table[BernoulliB[k], {k, 0, 20}]
Out[1]= {1, -(1/2), 1/6, 0, -(1/30), 0, 1/42, 0, -(1/30), 0, 5/66,
0, -(691/2730), 0, 7/6, 0, -(3617/510), 0, 43867/798, 0, -(174611/330)}
For one way to display them in a table use:
Grid[Table[{Subscript[B, k], BernoulliB[k]}, {k, 0, 20}],
Alignment -> {{Left, Center}}]
We can check the recursive definition you gave:
In[2]:= Sum[Binomial[n, k]*BernoulliB[k], {k, 0, n - 1}] == 0
Out[2]= True
Mathematica's result is incorrect, since this is true if and only if n > 1,
as is shown here when n = 1:
In[3]:= With[{n = 1}, Sum[Binomial[n, k]*BernoulliB[k], {k, 0, n - 1}] == 0]
Out[3]= False
The simplest way to do what you ask is to use Nest to build the list of
Bernoulli numbers using Solve on the recursive definition every time:
In[4]:= expect == Nest[With[{B = #, n = Length[#] + 1}, Join[B, b /.
Solve[Sum[Binomial[n, k]*Part[Append[B, b], k + 1], {k, 0, n - 1}] == 0,
b]]] &, {1}, 20]
Out[4]= True
However, with a little effort it is possible solve for BernoulliB[n - 1]
this way:
In[5]:= Solve[Sum[Binomial[n, k]*BernoulliB[k], {k, 0, n - 1}] ==
Sum[Binomial[n, k]*BernoulliB[k], {k, 0, n - 2}] +
Sum[Binomial[n, k]*BernoulliB[k], {k, n - 1, n - 1}], BernoulliB[n - 1]]
Out[5]= {{BernoulliB[-1 + n] -> -(Sum[BernoulliB[k] Binomial[n, k],
{k, 0, -2 + n}]/n)}}
Now, still using Nest to build the list of Bernoulli numbers, we have:
In[6]:= expect == Nest[With[{B = #, n = Length[#] + 1}, Append[B,
Sum[Binomial[n, k]*B[[k + 1]], {k, 0, n - 2}]/-n]] &, {1}, 20]
Out[6]= True
It is also possible to use Dot instead of Sum giving in an even simpler
expression:
In[7]:= expect == Nest[With[{B = #, n = Length[#] + 1}, Append[B,
Binomial[n, Range[0, n - 2]].B/-n]] &, {1}, 20]
Out[7]= True
Note that since Binomial[n, k] == n!/k!/(n-k)! then Binomial[n, k]/-n can
also be written as -(n-1)!/k!/(n-k)!
Enjoy!
"David Turner" <DTurner at faulkner.edu> wrote in message
news:j8r9gv$3jd$1 at smc.vnet.net...
> Hello,
>
> I wish to compute several Bernoulli numbers, say B0 through B20. The
Bernoulli numbers are defined recursively by
>
> B0 = 1, and Solve[Sum[Binomial[n,k]*Bk,{k,0,n-1}]==0,Bn-1] for n > 1
>
> I am trying to compute these numbers in some type of loop, and display
them in a table. Any help is greatly appreciated.
>
> Thanks,
>
> David
>
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_
>
> This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not dissem
inate, distribute or copy this e-mail. Please notify the sender immediately
by e-mail if you have received this e-mail by mistake and delete this e-mail
from your system. If you are not the intended recipient you are notified
that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.
Prev by Date:
**Re: Simple DSolve equation**
Next by Date:
**Re: Simple DSolve equation**
Previous by thread:
**Re: Bernoulli Numbers**
Next by thread:
**Re: Print bug with -script? (quotes display)**
| |