ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 09 Jan 2020 21:25:05 +0100Lattices via sagehttps://ask.sagemath.org/question/49380/lattices-via-sage/ I have three questions on lattices:
-Is there a way to obtain the minimal number of generators of a lattices with sage?
-Is there a way to obtain the lattice of all subspaces of a vector space over a finite field with q elements in sage?
-Is there a quick way to obtain all distributive lattices on n points in sage (that is, without filtering them from the set of all posets on n points).
Sun, 05 Jan 2020 20:01:53 +0100https://ask.sagemath.org/question/49380/lattices-via-sage/Comment by klaaa for <p>I have three questions on lattices:</p>
<p>-Is there a way to obtain the minimal number of generators of a lattices with sage?</p>
<p>-Is there a way to obtain the lattice of all subspaces of a vector space over a finite field with q elements in sage?</p>
<p>-Is there a quick way to obtain all distributive lattices on n points in sage (that is, without filtering them from the set of all posets on n points).</p>
https://ask.sagemath.org/question/49380/lattices-via-sage/?comment=49479#post-id-49479Thanks, yes it is about lattices in the sense of posets.Thu, 09 Jan 2020 21:25:05 +0100https://ask.sagemath.org/question/49380/lattices-via-sage/?comment=49479#post-id-49479Comment by jipilab for <p>I have three questions on lattices:</p>
<p>-Is there a way to obtain the minimal number of generators of a lattices with sage?</p>
<p>-Is there a way to obtain the lattice of all subspaces of a vector space over a finite field with q elements in sage?</p>
<p>-Is there a quick way to obtain all distributive lattices on n points in sage (that is, without filtering them from the set of all posets on n points).</p>
https://ask.sagemath.org/question/49380/lattices-via-sage/?comment=49438#post-id-49438Could you clarify which lattice you mean? A lattice can be a subgroup of the additive group `R^n` which is isomorphic to `Z^n` or a poset with a join and meet operations.Wed, 08 Jan 2020 13:53:33 +0100https://ask.sagemath.org/question/49380/lattices-via-sage/?comment=49438#post-id-49438Answer by jipilab for <p>I have three questions on lattices:</p>
<p>-Is there a way to obtain the minimal number of generators of a lattices with sage?</p>
<p>-Is there a way to obtain the lattice of all subspaces of a vector space over a finite field with q elements in sage?</p>
<p>-Is there a quick way to obtain all distributive lattices on n points in sage (that is, without filtering them from the set of all posets on n points).</p>
https://ask.sagemath.org/question/49380/lattices-via-sage/?answer=49445#post-id-49445Here is a first attempt to answer your questions.
1) The comment should be addressed in order to give an instructive answer.
2) Assuming you want to consider only _linear_ subspace, the following code does the thing:
sage: dim = 2
sage: FF = FiniteField(3)
sage: VS = VectorSpace(FF,2)
sage: SS = {}
sage: SS[0] = set([VS.subspace([])])
sage: for dim in range(1,dim+1):
....: new_subspaces = set()
....: for v in VS:
....: for ss in SS[dim-1]:
....: new_ss = ss + VS.subspace([v])
....: if new_ss.dimension() == dim:
....: new_subspaces.add(new_ss)
....: SS[dim] = new_subspaces
....:
sage: ground_set = reduce(lambda x,y:x.union(y),SS.values())
sage: the_lattice = LatticePoset((ground_set,lambda x,y: x.is_subspace(y)))
3) See https://ask.sagemath.org/question/38938/finding-certain-posets-in-sage/ and https://ask.sagemath.org/question/38936/obtaining-lattices-quickly-in-sage/Wed, 08 Jan 2020 17:41:03 +0100https://ask.sagemath.org/question/49380/lattices-via-sage/?answer=49445#post-id-49445