ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 25 Jun 2018 14:12:25 -0500codomain could not be determinedhttp://ask.sagemath.org/question/42732/codomain-could-not-be-determined/ I created an InfiniteDimensionalFreeAlgebra using CombinatorialFreeModule. It looks something like this:
class InfiniteDimensionalFreeAlgebra(CombinatorialFreeModule):
r""" The algebra generated by ``a[0], a[1], a[2], ...`` over the integers. """
def __init__(self,
base_ring=IntegerRing(),
prefix='a',
index_set=NonNegativeIntegerSemiring()):
self._base_ring = base_ring
self._basis_monoid = FreeMonoid(index_set=index_set, commutative=True, prefix=prefix)
# category
category = Algebras(self._base_ring.category()).WithBasis().Commutative()
category = category.or_subcategory(category)
# init
CombinatorialFreeModule.__init__(
self,
self._base_ring,
self._basis_monoid,
category=category,
prefix='',
bracket=False)
Now I want to view it as a *ring* and take symmetric polynomials over the ring. For example, in 2 variables, the following is one such symmetric polynomial:
2a[7] * x[1] + 2a[7] * x[2] + x[1]x[2] + 5
In my code, I attempt to initialize some Schur symmetric functions over this ring with something like:
a = InfiniteDimensionalFreeAlgebra()
sym = SymmetricFunctions(a)
s = sym.s()
one = s.one()
one_poly = one.expand(2)
at which point I run into the error `codomain could not be determined` when it attempts to apply some sort of morphism to the Schur function `one`. The full stacktrace is
Traceback (most recent call last):
File "./test_all.py", line 1162, in <module>
h = double_homogeneous(1, 1)
File "/Users/Matthew/programming/sage/morse-code/k_combinat_for_sage/all.py", line 664, in double_homogeneous
one_poly = one.expand(n)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/combinat/sf/schur.py", line 537, in expand
return self._expand(condition, n, alphabet)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/combinat/sf/sfa.py", line 4986, in _expand
return parent._apply_module_morphism(self, f)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/categories/modules_with_basis.py", line 1096, in _apply_module_morphism
raise ValueError('codomain could not be determined')
ValueError: codomain could not be determined
and the full code can be found at [k_combinat_for_sage](https://github.com/MareoRaft/k_combinat_for_sage/blob/master/k_combinat_for_sage/all.py).
Thank you, your help is greatly appreciated.ml9nnMon, 25 Jun 2018 14:12:25 -0500http://ask.sagemath.org/question/42732/Map between projective curves defined in an extension fieldhttp://ask.sagemath.org/question/38263/map-between-projective-curves-defined-in-an-extension-field/For example, suppose I have the following 2 projective curves:
k = GF(13)
x,y,z = ProjectiveSpace(k, 2, 'x,y,z').gens()
E = Curve(2*x^2 + 8*y*z + 8*z^2)
W = Curve(x^2 + y*z + z^2)
I like to define a map from E to W that involves $\sqrt 2$ and $\sqrt 8$, which do not exist in k = GF(13), but do in an extension of k:
x = PolynomialRing(k,'x').gen()
K = GF(13**2, 'w', modulus=x^2-2)
w = K.gen()
So $w = \sqrt 2$ and $2w = \sqrt 8$. The map I like to define sends $(x:y:z)$ to $(wx:2wy:2wz)$.
In this particular example, it's obvious that $(wx:2wy:2wz) = (x:2y:2z)$; but it's just a simple example do demonstrate the problem.
Something like this doesn't work:
x,y,z = ProjectiveSpace(k, 2, 'x,y,z').gens() #or ProjectiveSpace(K, 2, 'x,y,z').gens()
E.Hom(W)([w*x, 2*w*y, 2*w*z])
Thank you.RoadFri, 14 Jul 2017 11:08:01 -0500http://ask.sagemath.org/question/38263/Compose Affine/Projective Curve morphism with Elliptic Curve isogenyhttp://ask.sagemath.org/question/38045/compose-affineprojective-curve-morphism-with-elliptic-curve-isogeny/When I tried to do this, I got TypeError: ... must be a map to multiply it by Isogeny ...
And when I tried to dehomogenize projective curve morphism in x,y,z by z-coordinate, the remaining variables become x0 and x1. Can I keep them as x and y instead?
EDIT: Example code:
k = GF(23)
x,y,z = k['x,y,z'].gens()
d = k(2)
C = Curve([x^3+y^3+z^3-3*d*x*y*z]) #domain curve
a = d+2
b = 4*(d^2+d+1)/3
E = EllipticCurve(y^2-x^3-(a*x+b)^2) #codomain curve
m = b
n = 4*(d^3 -1)/3
X = m*(x+y+z)
Y = n*(z-y)
Z = -z-y-d*x
f = C.Hom(E)([X,Y,Z]) #map from C to E
Q = E(2,9,1) #a point on E
g = E.isogeny(Q) #isogeny
g*f #TypeError hereRoadWed, 21 Jun 2017 10:43:25 -0500http://ask.sagemath.org/question/38045/Unable to coerce dictionary to morphism between finite posetshttp://ask.sagemath.org/question/34059/unable-to-coerce-dictionary-to-morphism-between-finite-posets/Using the code below, I am unsure why I cannot form the identity map (or others such as constant maps) via dictionary. I have done the same process for finite simplicial complexes, so maybe this isn't implemented for finite posets? Thanks for any help!
The input:
X=Poset({1:[],2:[1]}) <br>
Hom(X,X)({1:1,2:2})
The output error message:
TypeError: Unable to coerce x (={1: 1, 2: 2}) to a morphism in Set of Morphisms from Finite poset containing 2 elements to Finite poset containing 2 elements in Join of Category of finite posets and Category of finite enumerated sets and Category of facade sets jobrien715Sat, 09 Jul 2016 03:53:21 -0500http://ask.sagemath.org/question/34059/Sparse morphism versus sparse matrixhttp://ask.sagemath.org/question/10543/sparse-morphism-versus-sparse-matrix/I would like to use VectorSpaceMorphism when the underlying domain, codomain and matrix are sparse. However, the morphism seems to convert everything to dense. The following is from Sage 5.9.
sage: V = VectorSpace(QQ, 2, sparse=True)
sage: V
Sparse vector space of dimension 2 over Rational Field
sage: A = matrix(QQ, 2, 2, [[5, 6], [7, 8]], sparse=True)
sage: type(A)
sage.matrix.matrix_rational_sparse.Matrix_rational_sparse
sage: f = V.hom(A, V)
sage: f.matrix()
[5 6]
[7 8]
sage: type(f.matrix())
sage.matrix.matrix_rational_dense.Matrix_rational_dense
V.hom doesn't take the keyword 'sparse'.
sage: g = V.hom(A, V, sparse=True)
...
TypeError: hom() got an unexpected keyword argument 'sparse'
Let v be a vector in V, which is sparse. Tests with pdb show that when we call f(v), it converts v to dense behind the scenes, multiplies by the dense matrix, and
converts the dense vector result back to sparse. Of course this is slow. The more fundamental issue is that, in some of my applications, A will be too large to store densely.mmcconnellMon, 16 Sep 2013 18:08:35 -0500http://ask.sagemath.org/question/10543/Create Morphism's between Finite Fields and VectorSpaceshttp://ask.sagemath.org/question/10379/create-morphisms-between-finite-fields-and-vectorspaces/Hallo,
I am interested in creating morphims between $GF(2^{n+1}) \stackrel{h_1}{\longrightarrow} H_u \stackrel{h_2}\longrightarrow GF(2^n)$ where $H_u=\{x^{2^i} + x : x \in GF(2^{n+1})\}$ where $gcd(i,n+1) =1$. I am interested in constructing $h_1$ and $h_2$,
My attempt to create $h_1$ is:
<pre>
<code>
n = 4
i = 1
f = lambda x : x^(2^i) + x
Kn_1 = GF(2^(n+1),'x')
H_u = map(f, Kn_1)
hs = Hom(Kn_1,H_u)
pi = SetMorphism(Hom(Kn_1,Kn), lambda y : y^(2^i) + y)
pi(Kn_1.random_element()) in Kn
</code>
</pre>
now $hs$ is a set of morphism and $h_1 \in hs$. Can I get a (the) specific $h_1$ from $hs$? My attempt is $pi$ but 'pi(Kn_1.random_element()) in Kn' fails.
To construct $h_2$ I have more success.
<pre>
<code>
n = 4
i = 2
f = lambda x: x^(2^i) + x
Kn_1 = GF(2^(n+1),'x1')
Vn_1 = Kn_1.vector_space()
Sn_1 = Vn_1.subspace([Vn_1(f(u)) for u in Kn_1])
Kn = GF(2^n,'x')
Vn = Kn.vector_space()
h_a = Sn_1.basis_matrix().transpose()
</code>
</pre>
Now $h_a : Vn\rightarrow Sn_1$ where $Vn$ and $Sn_1$ is vector space representation of $GF(2^n)$ and $H_u$. To get from $GF(2^n)$ to $Vn$ and back I am good with But to create $h_2$ I have no luck. My attempts to use
<pre>
<code>
MatrixMorphism(Hom(Vn,Sn_1), Sn_1.basis_matrix().transpose())
</code>
</pre>
but get errors with regards to the dimensions of the matrix.
RegardsJohanTue, 23 Jul 2013 10:59:05 -0500http://ask.sagemath.org/question/10379/Constructing a morphism of free modules using the indexing sethttp://ask.sagemath.org/question/7748/constructing-a-morphism-of-free-modules-using-the-indexing-set/I have a set S indexed by triplets of numbers [i,j,k], and I want to construct an endomorphism T of the free module over S (call it F(S)) of the form:
T: e[i,j,k] ---> Sum over (u,v,w) : f(i,j,k, u,v,w) e[u,v,w]
where f(ijkuvw) is a certain function.
Is there a simple way to do this?
Thanks!Michael McBreenTue, 28 Dec 2010 02:46:12 -0600http://ask.sagemath.org/question/7748/