On Mon, 12 Sept 2022 at 16:24,
davida...@gmail.com
<
davida...@gmail.com> wrote:
>
> > Why don't we create a B+ and a B-?
>
> This was one of the idea of the ticket
https://trac.sagemath.org/ticket/34521. A new option to the bernoulli function was added ("plus=False"), giving the option to the user to choose their prefered value. However, I think that the ticket was set to invalid and closed prematurely without any possibility for a meaningful discussion. I think that the debate here would be: what is the default value of this new option. There is two choices:
>
> "plus=False": bernoulli(1) = -1/2, nothing changes.
> "plus=True": bernoulli(1) = +1/2 (new value). Deprecation needs to be implemented.
If there is a need to provide both behaviours then I would suggest
using two new functions bernoulli_plus and bernoulli_minus rather than
a boolean flag. The bernoulli function can continue to return
bernoulli_minus but can refer to the other functions in its
documentation. That way the conventions are clearly distinguished and
in future it can be possible to make it so that bernoulli emits a
warning (prompting the caller to use bernoulli_plus or bernoulli_minus
explicitly instead) or perhaps is eventually changed to call
bernoulli_plus after some time of giving a warning.
The reason I didn't want to go that way for SymPy is that
bernoulli_plus admits a natural generalisation to real and complex
numbers but bernoulli_minus does not. It would be awkward to implement
both bernoulli_plus and bernoulli_minus as symbolic functions where
the rules and domains, numerical evaluation etc would all be
different: one would be a complex analytic function while the other an
integer sequence.
> In any case, I think that something should be done about this, because FLINT has been changed to return +1/2 (and FLINT is the default for small Bernoulli numbers)
Has FLINT been changed? I see a PR here but it is still open:
https://github.com/wbhart/flint2/pull/1179
--
Oscar