I have done more digging. If I am not mistaken, what governs the coercion
is the function `pushout` in `categories/pushout.py`. For each
construction functor there is a hardcoded rank, such as 9.5 for the
InfinitePolynomialFunctor, 10 for the MatrixFunctor, or 9 for the
PolynomialFunctor and
OK, possibly I now understand Matthias Köppe's comment on the PR. He said
that the pushout of R and S looks suspicious (this is indeed computed in
ModuleAction.__init__ and seems to govern the process):
sage: R
Univariate Polynomial Ring in z over Rational Field
sage: S
Univariate Polynomial
I find the MatrixSpace example interesting:
sage: R = MatrixSpace(QQ, 1)
sage: P = PolynomialRing(R, names="z")
sage: Q = PolynomialRing(QQ, names="z")
sage: Q.gen() * P.gen()
[z]*z
sage: P.gen() * Q.gen()
[z]*z
sage: coercion_model.analyse(P.gen(), Q.gen(), operator.mul)
(['Action discovered.',
How can I find out what causes this? How can I find out where this action
is defined?
I played around a little, but without any insights. It seems that most of
the time, the coercion tries to do the embedding in the base ring, but not
always. The MatrixSpace seems to be another exception.
This might be at fault:
sage: coercion_model.analyse(q,e)
(['Action discovered.',
Left scalar multiplication by Multivariate Polynomial Ring in z, q over
Rational Field on Multivariate Polynomial Ring in z, q over Infinite
polynomial ring in F over Rational Field],
Multivariate Polynomial
I am not quite sure I understand how this works / what is used:
sage: pushout(e.parent(), z.parent())
Multivariate Polynomial Ring in z, q over Infinite polynomial ring in F
over Multivariate Polynomial Ring in z, q over Rational Field
sage: coercion_model.common_parent(z, e)
Multivariate
Hm, that's somewhat unfortunate - I don't see how to work around it. I
guess I would have to force all elements to be in P (using the notation of
the example), but this is, I think, not possible.
Do you know where this behaviour is determined?
On Friday 12 January 2024 at 22:09:41 UTC+1 Nils
On Friday 12 January 2024 at 14:30:06 UTC-5 Martin R wrote:
I made a tiny bit of progress, and now face the following problem:
sage: I. = InfinitePolynomialRing(QQ)
sage: P. = I[]
sage: e = z*q
sage: Q. = QQ[]
sage: z*e
z*z*q
Is this correct behaviour?
I don't think it's desperately
I made a tiny bit of progress, and now face the following problem:
sage: I. = InfinitePolynomialRing(QQ)
sage: P. = I[]
sage: e = z*q
sage: Q. = QQ[]
sage: z*e
z*z*q
Is this correct behaviour? For comparison:
sage: I. = QQ[]
sage: P. = I[]
sage: e = z*q
sage: Q. = QQ[]
sage: z*e
z^2*q