Bug in `factor` for multivariate polynomials over QQbar

82 views
Skip to first unread message

Peter Mueller

unread,
Aug 3, 2024, 1:58:40 AM8/3/24
to sage-devel
The line `R.<a, c> = QQbar[]; factor(a^2 - 2*c^2)` raises a

ValueError: variable name '@c' is not alphanumeric

while the same line with `c` replaced with `b` works fine.

This happens in a local installation of Sage 10.4 (and 10.5.beta0), but also on the SageCell.

-- Peter Mueller

Eric Gourgoulhon

unread,
Aug 3, 2024, 9:00:32 AM8/3/24
to sage-devel
FWIW, this bug is already there in Sage 9.8 (released in Feb 2023). 

Eric.

Dima Pasechnik

unread,
Aug 3, 2024, 10:32:00 AM8/3/24
to sage-...@googlegroups.com, ypf...@googlemail.com
This probably has to do with the limited capacities of Sage preparser, which converts Sage extensions to the plain Python.
It apparently cannot split lines with multiple commands.
PRs to improve this welcome.

HTH
Dima

Dima Pasechnik

unread,
Aug 3, 2024, 10:32:06 AM8/3/24
to sage-...@googlegroups.com, ypf...@googlemail.com
On Sat, Aug 3, 2024 at 11:19 AM Dima Pasechnik <dim...@gmail.com> wrote:
>
> This probably has to do with the limited capacities of Sage preparser, which converts Sage extensions to the plain Python.
> It apparently cannot split lines with multiple commands.
> PRs to improve this welcome.

Oops, no, sorry, my bad.
It's a bug in the implementation of polynomial rings over QQbar
(note that there is no error is QQbar is replaced by QQ)

Dima

Dima Pasechnik

unread,
Aug 3, 2024, 10:32:14 AM8/3/24
to sage-...@googlegroups.com, ypf...@googlemail.com
On Sat, Aug 3, 2024 at 11:46 AM Dima Pasechnik <dim...@gmail.com> wrote:
>
> On Sat, Aug 3, 2024 at 11:19 AM Dima Pasechnik <dim...@gmail.com> wrote:
> >
> > This probably has to do with the limited capacities of Sage preparser, which converts Sage extensions to the plain Python.
> > It apparently cannot split lines with multiple commands.
> > PRs to improve this welcome.
>
> Oops, no, sorry, my bad.
> It's a bug in the implementation of polynomial rings over QQbar
> (note that there is no error is QQbar is replaced by QQ)

specifically, in the function _factor_multivariate_polynomial(...)
located in src/sage/rings/qqbar.py

Dima Pasechnik

unread,
Aug 3, 2024, 10:32:22 AM8/3/24
to sage-...@googlegroups.com, ypf...@googlemail.com
Reply all
Reply to author
Forward
0 new messages