Bernoulli numbers and polynomials
This functionality does not run in MATLAB.
bernoulli(n) bernoulli(n, x)
bernoulli(n) returns the n-th Bernoulli number.
bernoulli(n, x) returns the n-th Bernoulli polynomial in x.
The Bernoulli polynomials are defined by the generating function
The Bernoulli numbers are defined by bernoulli(n) = bernoulli(n,0).
An error occurs if n is a numerical value not representing a nonnegative integer.
If n is an integer larger than the value returned by Pref::autoExpansionLimit(), then the call bernoulli(n) is returned symbolically. Use expand(bernoulli(n)) to get an explicit numerical result for large integers n.
If n contains non-numerical symbolic identifiers, then the call bernoulli(n) is returned symbolically. In most cases, the same holds true for calls bernoulli(n, x). Some simplifications are implemented for special numerical values such as x = 0, x = 1/2, x = 1 etc. for symbolic n . Cf. Example 3.
Note: Note that floating-point evaluation for high degree polynomials may be numerically unstable. Cf. Example 4.
The floating-point evaluation on the standard interval x ∈ [0, 1] is numerically stable for arbitrary n.
When called with a floating-point value x, the function is sensitive to the environment variable DIGITS which determines the numerical working precision.
The first Bernoulli numbers are:
bernoulli(n) $ n = 0..11
The first Bernoulli polynomials:
bernoulli(n, x) $ n = 0..4
If n is symbolic, then a symbolic call is returned:
bernoulli(n, x), bernoulli(n + 3/2, x), bernoulli(n + 5*I, x)
If x is not an indeterminate, then the evaluation of the Bernoulli polynomial at the point x is returned:
bernoulli(50, 1 + I)
bernoulli(3, 1 - y), expand(bernoulli(3, 1 - y))
Certain simplifications occur for some special numerical values of x, even if n is symbolic:
bernoulli(n, 0), bernoulli(n, 1/2), bernoulli(n, 1)
Calls with numerical arguments between and 1 are automatically rewritten in terms of calls with arguments between 0 and :
bernoulli(n, 2/3), bernoulli(n, 0.7)
Calls with negative numerical arguments are automatially rewritten in terms of calls with positive arguments:
Float evaluation of high degree polynomials may be numerically unstable:
exact := bernoulli(50, 1 + I): float(exact);
bernoulli(50, float(1 + I))
DIGITS := 40: bernoulli(50, float(1 + I))
delete exact, DIGITS:
diff(bernoulli(n, f(x)), x)
expand(bernoulli(n, x + 2))
An arithmetical expression representing a nonnegative integer
M. Abramowitz and I. Stegun, "Handbook of Mathematical Functions", Dover Publications Inc., New York (1965).