Ticket #10222 (closed defect: fixed)
Bernoulli polynomial problem
| Reported by: | davidloeffler | Owned by: | malb |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-4.6.2 |
| Component: | commutative algebra | Keywords: | bernoulli |
| Cc: | craigcitro | Work issues: | |
| Report Upstream: | N/A | Reviewers: | David Loeffler |
| Authors: | Francis Clarke | Merged in: | sage-4.6.2.alpha3 |
| Dependencies: | Stopgaps: |
Description
The "bernoulli_polynomial" command should return the nth Bernoulli polynomial evaluated at the first argument, but something odd happens when you feed it a polynomial that's not a single variable:
sage: R.<x> = QQ[] sage: bernoulli_polynomial(x, 2) x^2 - x + 1/6 sage: bernoulli_polynomial(x - 1, 2) x^2 - x + 1/6 sage: bernoulli_polynomial(R(0), 2) x^2 - x + 1/6
Attachments
Change History
comment:1 Changed 3 years ago by fwclarke
- Cc craigcitro added
- Status changed from new to needs_review
- Authors set to Francis Clarke
Note: See
TracTickets for help on using
tickets.


In the attached patch I have rewritten most of the `bernoulli_polynomial` code. This solves this problem.
In the case where the result is a polynomial, direct calculation from the list of coefficients is retained (for speed), but corrected for the case where x is not the variable. This only works when the base ring is a QQ-algebra; previously an error was raised it if wasn't.
A small increase in speed results from the odd Bernoulli numbers being zero, apart from the first. This is more significant in the non-polynomial case.
A couple of new doctests have been added.