Opened 9 years ago

Closed 9 years ago

# q-Bernoulli numbers of Carlitz

Reported by: Owned by: chapoton sage-combinat minor sage-5.8 combinatorics bernoulli sage-5.8.beta3 Frédéric Chapoton Francis Clarke N/A

Leonard Carlitz has introduced q-analogues of Bernoulli numbers in

• Carlitz, L: q-Bernoulli numbers and polynomials. Duke Math J. 15, 987–1000 (1948)
• Carlitz, L: q-Bernoulli and Eulerian numbers. Trans Am Soc. 76, 332–350 (1954)

These q-Bernoulli numbers are fractions in q, that give the usual Bernoulli numbers when q=1.

A patch to compute them is proposed below. Maybe someone could make it more efficient ?

### comment:1 Changed 9 years ago by chapoton

• Description modified (diff)

### comment:2 Changed 9 years ago by chapoton

• Status changed from new to needs_review

### comment:3 Changed 9 years ago by fwclarke

• Reviewers set to Francis Clarke
• Status changed from needs_review to needs_work

I believe the code implements Carlitz's definition accurately. It's difficult to see how it could easily be speeded up.

Just a few improvements are needed, I think.

• As in the code for classical Bernoulli numbers, the definition ought to start with the lines
```      from sage.rings.all import Integer
m = Integer(m)
```
This allows the argument to be an `int`, which is compatible with `gaussian_binomial`, letting users write things like
```[q_bernoulli(i) for i in range(13)]
```
and gives a less confusing error message for
```q_bernoulli(1/2)
```
• To make `q_bernoulli` even more compatible with `gaussian_binomial` it would be worth having a second argument, defaulting to a the polynomial generator `q`. [Actually `q_binomial(4, 2, 1)` raises a `ZeroDivisionError` at present. I'll raise a ticket for this.]
• It would be worth citing Carlitz's 1948 paper in the docstring.
• I would write "q-analogue of the Bernoulli numbers" (one analogue, many numbers).

### comment:4 Changed 9 years ago by chapoton

I have made some corrections and enhancements.

I would prefer not to add the optional choice of the value of q. Indeed, in the computation, one has to divide by `q^n -1` for many n. One would therefore had to ensure that q is not a root of unity. I prefer to have a procedure that clearly work with an indeterminate q.

Note that my principal aim is speed.

### comment:5 Changed 9 years ago by chapoton

• Status changed from needs_work to needs_review

### comment:6 Changed 9 years ago by chapoton

Here is a new patch:

• I have added the possibility to evaluate at another point, like for q_binomials.
• I have enhanced the references, using #14011.

### comment:7 Changed 9 years ago by fwclarke

• Status changed from needs_review to needs_work

Just a few trivia:

```Bernoulli number `B_n`
```

needs to be

```Bernoulli number `B_m`
```

I think "rational function of" would be better than "fraction in", and then "function is" rather than "fraction is".

For compatibility with `gaussian_binomial` it would be preferable if the optional argument was called `q` rather than `p`.

### comment:8 Changed 9 years ago by chapoton

• Status changed from needs_work to needs_review

Here is a corrected patch.

I have not changed the name of the optional argument from p to q, because the optional parameter of q_binomial is also called p.

### comment:9 Changed 9 years ago by fwclarke

• Status changed from needs_review to positive_review

Yes, it's fine now.

I wasn't aware of `q_binomial` and the other functions hidden away in `combinat/q_analogues.py`. Shouldn't they be more widely available? In particular `gaussian_binomial` ought to use the `q_binomial` code because it's significantly faster. I still prefer `q` to `p` though!

### comment:10 Changed 9 years ago by chapoton

Thanks for the review.

I was not aware of the gaussian_binomial function.

### comment:11 Changed 9 years ago by jdemeyer

• Authors set to Frédéric Chapoton

### comment:12 Changed 9 years ago by jdemeyer

• Merged in set to sage-5.8.beta3
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.