-
-
Notifications
You must be signed in to change notification settings - Fork 660
Closed
Description
The following code triggers a coercion failure in the symmetric function code
sage: H = MacdonaldPolynomialsH(QQ)
sage: P = MacdonaldPolynomialsP(QQ)
sage: m = SFAMonomial(P.base_ring())
sage: Ht = MacdonaldPolynomialsHt(QQ)
sage: m(P.one())
m[]
sage: Ht(P.one())
The coercion path does exist, however!
This can also be checked with the new syntax using the patches in #5457 as follows:
sage: R = QQ['q,t'].fraction_field()
sage: Sym = sage.combinat.sf.sf.SymmetricFunctions(R)
sage: H = Sym.macdonald().H();
sage: P = Sym.macdonald().P();
sage: m = Sym.monomial();
sage: Ht = Sym.macdonald().Ht();
sage: m(P.one())
sage: Ht(P.one())
The bug is in the coercion system. Sage does
not find a path from P to Ht, whereas there definitely is one:
def coercion_graph(self, G = None):
if G is None:
G = DiGraph()
if self not in G.vertices():
G.add_vertex(self)
for h in self._introspect_coerce()['_coerce_from_list']:
coercion_graph(h.domain(), G)
G.add_edge(h.domain(), self)
return G
R = QQ['q,t'].fraction_field()
R.rename("R")
Sym = sage.combinat.sf.sf.SymmetricFunctions(R); Sym.rename("Sym")
p = Sym.p(); p.rename("p")
s = Sym.schur(); s.rename("s")
e = Sym.elementary(); e.rename("e")
m = Sym.monomial(); m.rename("m")
h = Sym.complete(); h.rename("h")
H = Sym.macdonald().H(); H.rename("H")
P = Sym.macdonald().P(); P.rename("P")
J = Sym.macdonald().J(); J.rename("J")
S = Sym.macdonald().S(); S.rename("S")
Ht = Sym.macdonald().Ht(); Ht.rename("Ht")
m.coerce_map_from(P);
print Ht.coerce_map_from(P)
G = coercion_graph(Ht)
G.show()
Apply
- attachment: trac12969_fix_coercion_cache.patch and attachment: trac_12969-avoid_coercion_from_none.patch, if Refactor symmetric functions and k-bounded subspace #5457 is not applied
- All three patches, if Refactor symmetric functions and k-bounded subspace #5457 is applied
CC: @sagetrac-sage-combinat @saliola @zabrocki
Component: coercion
Keywords: symmetric functions
Author: Simon King
Reviewer: Anne Schilling
Merged: sage-5.3.beta0
Issue created by migration from https://trac.sagemath.org/ticket/12969