\(q\)-Bernoulli Numbers and Polynomials¶
- sage.combinat.q_bernoulli.q_bernoulli(p=None)[source]¶
Compute Carlitz’s \(q\)-analogue of the Bernoulli numbers.
For every nonnegative integer \(m\), the \(q\)-Bernoulli number \(\beta_m\) is a rational function of the indeterminate \(q\) whose value at \(q=1\) is the usual Bernoulli number \(B_m\).
INPUT:
m
– nonnegative integerp
– (default:None
) an optional value for \(q\)
OUTPUT:
A rational function of the indeterminate \(q\) (if \(p\) is
None
)Otherwise, the rational function is evaluated at \(p\).
EXAMPLES:
sage: from sage.combinat.q_bernoulli import q_bernoulli sage: q_bernoulli(0) 1 sage: q_bernoulli(1) -1/(q + 1) sage: q_bernoulli(2) q/(q^3 + 2*q^2 + 2*q + 1) sage: all(q_bernoulli(i)(q=1) == bernoulli(i) for i in range(12)) # needs sage.libs.flint True
>>> from sage.all import * >>> from sage.combinat.q_bernoulli import q_bernoulli >>> q_bernoulli(Integer(0)) 1 >>> q_bernoulli(Integer(1)) -1/(q + 1) >>> q_bernoulli(Integer(2)) q/(q^3 + 2*q^2 + 2*q + 1) >>> all(q_bernoulli(i)(q=Integer(1)) == bernoulli(i) for i in range(Integer(12))) # needs sage.libs.flint True
One can evaluate the rational function by giving a second argument:
sage: x = PolynomialRing(GF(2),'x').gen() sage: q_bernoulli(5,x) x/(x^6 + x^5 + x + 1)
>>> from sage.all import * >>> x = PolynomialRing(GF(Integer(2)),'x').gen() >>> q_bernoulli(Integer(5),x) x/(x^6 + x^5 + x + 1)
The function does not accept negative arguments:
sage: q_bernoulli(-1) Traceback (most recent call last): ... ValueError: the argument must be a nonnegative integer
>>> from sage.all import * >>> q_bernoulli(-Integer(1)) Traceback (most recent call last): ... ValueError: the argument must be a nonnegative integer
REFERENCES:
[Ca1948]Leonard Carlitz, “q-Bernoulli numbers and polynomials”. Duke Math J. 15, 987-1000 (1948), doi:10.1215/S0012-7094-48-01588-9
[Ca1954]Leonard Carlitz, “q-Bernoulli and Eulerian numbers”. Trans Am Soc. 76, 332-350 (1954), doi:10.1090/S0002-9947-1954-0060538-2
- sage.combinat.q_bernoulli.q_bernoulli_polynomial()[source]¶
Compute Carlitz’s \(q\)-analogue of the Bernoulli polynomials.
For every nonnegative integer \(m\), the \(q\)-Bernoulli polynomial is a polynomial in one variable \(x\) with coefficients in \(\QQ(q)\) whose value at \(q=1\) is the usual Bernoulli polynomial \(B_m(x)\).
The original \(q\)-Bernoulli polynomials introduced by Carlitz were polynomials in \(q^y\) with coefficients in \(\QQ(q)\). This function returns these polynomials but expressed in the variable \(x=(q^y-1)/(q-1)\). This allows to let \(q=1\) to recover the classical Bernoulli polynomials.
INPUT:
m
– nonnegative integer
OUTPUT: a polynomial in one variable \(x\)
EXAMPLES:
sage: from sage.combinat.q_bernoulli import q_bernoulli_polynomial, q_bernoulli sage: q_bernoulli_polynomial(0) 1 sage: q_bernoulli_polynomial(1) (2/(q + 1))*x - 1/(q + 1) sage: x = q_bernoulli_polynomial(1).parent().gen() sage: all(q_bernoulli_polynomial(i)(q=1) == bernoulli_polynomial(x,i) # needs sage.libs.flint ....: for i in range(12)) True sage: all(q_bernoulli_polynomial(i)(x=0) == q_bernoulli(i) ....: for i in range(12)) True
>>> from sage.all import * >>> from sage.combinat.q_bernoulli import q_bernoulli_polynomial, q_bernoulli >>> q_bernoulli_polynomial(Integer(0)) 1 >>> q_bernoulli_polynomial(Integer(1)) (2/(q + 1))*x - 1/(q + 1) >>> x = q_bernoulli_polynomial(Integer(1)).parent().gen() >>> all(q_bernoulli_polynomial(i)(q=Integer(1)) == bernoulli_polynomial(x,i) # needs sage.libs.flint ... for i in range(Integer(12))) True >>> all(q_bernoulli_polynomial(i)(x=Integer(0)) == q_bernoulli(i) ... for i in range(Integer(12))) True
The function does not accept negative arguments:
sage: q_bernoulli_polynomial(-1) Traceback (most recent call last): ... ValueError: the argument must be a nonnegative integer
>>> from sage.all import * >>> q_bernoulli_polynomial(-Integer(1)) Traceback (most recent call last): ... ValueError: the argument must be a nonnegative integer