You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sage: version()
'SageMath version 10.5.beta5, Release Date: 2024-09-22'
sage: Pyab.<a,b> = FreeAlgebra(QQ,2)
sage: f = 2*a - 2*b + a*b - b*a
sage: f
2*a - 2*b + a*b - b*a
sage: for mon,coeff in f:
....: print(coeff, coeff.parent(), mon, coeff*mon)
2 Rational Field a None
-2 Rational Field b None
1 Rational Field a*b a*b
-1 Rational Field b*a None
sage: for mon,coeff in f:
....: print(coeff,coeff.parent(),mon, Pyab(coeff) * mon)
....:
2 Rational Field a 2*a
-2 Rational Field b -2*b
1 Rational Field a*b a*b
-1 Rational Field b*a -b*a
Expected Behavior
Multiplying coefficients with monomials correctly
Actual Behavior
Does it correctly, in the example, only for the coefficient 1, not for \pm 2, -1.
Additional Information
No response
Environment
OS: Ubuntu 24.04
Sage Version: 10.5.beta5
Checklist
I have searched the existing issues for a bug report that matches the one I want to file, without success.
I have read the documentation and troubleshoot guide
The text was updated successfully, but these errors were encountered:
This is only very surprising behaviour, not a bug:
sage: for mon, coeff in f:
....: print(mon.parent(), coeff.parent())
....:
Free monoid on 2 generators (a, b) Rational Field
Free monoid on 2 generators (a, b) Rational Field
Free monoid on 2 generators (a, b) Rational Field
Free monoid on 2 generators (a, b) Rational Field
What you want is
sage: [c * Pyab(m) for m, c in f]
[2*a, -2*b, a*b, -b*a]
Steps To Reproduce
Expected Behavior
Multiplying coefficients with monomials correctly
Actual Behavior
Does it correctly, in the example, only for the coefficient 1, not for \pm 2, -1.
Additional Information
No response
Environment
Checklist
The text was updated successfully, but these errors were encountered: