19.1 Bernoulli Numbers and Bernoulli Polynomials
227
allows to compute negative values and from
B n (x + 1) = B n (x) + nx
n−1
(19.6b)
we get
B n (x + m) = B n (x) + n
m−1
k=0
(x + k)
n−1 , m ∈ N
(19.6c)
to compute Bernoulli polynomials for arbitrary large real arguments.
19.1.2 Programs
Bernoulli Numbers can be evaluated with the SPECFUNPHYS class bernn with
syntax [obj, Bn] = bernn(n, all). The input argument “n” is the n-th
Bernoulli number starting with 0. “all” is optional and with “all” equals ‘a’ all
Bernoulli numbers up to “n” will be returned, otherwise only one. The output
arguments are the class object “obj” with properties “Bn”, the Bernoulli number(s)
and “info” with some information. The first 36 Bernoulli numbers are table based
[1] all others are computed via Eqs. (19.5) for x = 0.
Bernoulli Polynomial Coefficients are returned from the SPECFUNPHYS class
bernpoly with syntax [obj, Bk] = bernpoly(n). The input argument
“n” is the polynomial degree with n ≥ 0. All polynomial coefficients up to “n”
will be evaluated. The output arguments are the class object “obj” with properties
“polycoef”, a table of the polynomial coefficients and “info” with some basic
information. “Bk” is an array of polynomial coefficients; in the first row the
coefficients for degree equal to 0 and in the n-th row for degree n − 1. For degree
smaller than 15 the result is table based [1] and higher orders are computed with the
help of the MATLAB function polyint via Eq. (19.4) and the integration constant
via Eq. (19.5). The class bernpoly comes in addition with methods plot,
for plotting, deri to compute the n-th derivative and polyvalue to evaluate
the Bernoulli polynomials. All methods are located in the class bepolymeth.
The syntax is obj = plot(obj, nw, xi, ah). “obj” is the bernpoly
class object. All other input arguments are optional. “nw” is an integer vector
of polynomial degrees which shall be plotted (default all shall be plotted). “xi”
is either a two component real vector with the plot interval borders, or a vector
of real numbers for plotting; default is 100 equidistant values between 0 and 1.
“ah” is an axes object as target for plotting (default, a new figure window opens).
Pder=deri(obj,nd) computes the n-th derivative of the polynomials located in
the class object “obj”. “nd” is a scalar integer, the nd-th derivative of the polynomial,
stored in the output array “Pder”. The n-th row are polynomial coefficients of the ndth derivative of the polynomial of degree n+1. The method with syntax [res, n]
= polyvalue(obj,x,n) evaluates the polynomials located in the class object
Précédent

- 233/287

Suivant