1 | initial version |
The question is similar to a previous question, as pointed out by @rburing.
Let us however go through a step by step guided exploration of the question.
In passing we will recall ways to explore the documentation.
Choose the size of the finite field, and the dimension of the vector space.
sage: q = 3
sage: d = 3
Create the finite field and the vector space.
sage: F = GF(q)
sage: V = F^d
Check what methods are available for V
using V.[TAB]
(ie press the tab key).
In particular we find:
sage: V.dimension()
3
sage: V.subspaces(dim=2)
<generator object FreeModule_generic_field.subspaces at 0x1eb45c650>
Check the inline documentation for the Poset
constructor:
sage: Poset?
sage: browse_sage_doc(Poset)
Or browse the posets page of the Sage documentation in your browser, using one of:
The documentation reveals one can create a poset from a dictionary of upper covers.
The "defaultdict" variant of a dictionary will be more convenient; import it:
sage: from collections import defaultdict
Now run through subspaces by decreasing dimension, and add each to the list of upper covers of its subspaces of the next dimension down:
sage: upper_covers = defaultdict(list)
sage: for d in range(V.dimension(), 0, -1):
....: S = V.subspaces(dim=d)
....: for B in S:
....: for A in B.subspaces(dim=d-1):
....: upper_covers[A].append(B)
....:
sage: P = Poset(data=upper_covers)
sage: P
Finite poset containing 28 elements
sage: p = P.plot()
sage: p.show()
Launched png viewer for Graphics object consisting of 107 graphics primitives
Labels in the rendered view are too verbose, so create a poset using the basis matrix of each subspace:
sage: upper_covers = defaultdict(list)
sage: for d in range(V.dimension(), 0, -1):
....: S = V.subspaces(dim=d)
....: for B in S:
....: for A in B.subspaces(dim=d-1):
....: upper_covers[A.basis_matrix()].append(B.basis_matrix())
....:
sage: P = Poset(data=upper_covers)
sage: P
Finite poset containing 28 elements
Adjust the shape and size of the nodes for plotting the graph:
sage: p = P.plot(element_shape='s', element_size=1500)
sage: p.show(figsize=20)
Launched png viewer for Graphics object consisting of 107 graphics primitives
2 | No.2 Revision |
The question is similar to a previous question, as pointed out by @rburing.
Let us however go through a step by step guided exploration of the question.
In passing we will recall ways to explore the documentation.
Choose the size of the finite field, and the dimension of the vector space.
sage: q = 3
sage: d = 3
Create the finite field and the vector space.
sage: F = GF(q)
sage: V = F^d
Check what methods are available for V
using V.[TAB]
(ie press the tab key).
In particular we find:
sage: V.dimension()
3
sage: V.subspaces(dim=2)
<generator object FreeModule_generic_field.subspaces at 0x1eb45c650>
Check the inline documentation for the Poset
constructor:and the LatticePoset
constructors:
sage: Poset?
sage: LatticePoset?
sage: browse_sage_doc(Poset)
sage: browse_sage_doc(LatticePoset)
Or browse the posets page of the Sage documentation in your browser, using one of:
The documentation reveals one can create a poset from a dictionary of upper covers.
The "defaultdict" variant of a dictionary will be more convenient; import it:
sage: from collections import defaultdict
Now run through subspaces by decreasing dimension, and add each to the list of upper covers of its subspaces of the next dimension down:
sage: upper_covers = defaultdict(list)
sage: for d in range(V.dimension(), 0, -1):
....: S = V.subspaces(dim=d)
....: for B in S:
....: for A in B.subspaces(dim=d-1):
....: upper_covers[A].append(B)
....:
sage: P = Poset(data=upper_covers)
LatticePoset(data=upper_covers)
sage: P
Finite poset containing 28 elements
sage: p = P.plot()
sage: p.show()
Launched png viewer for Graphics object consisting of 107 graphics primitives
Labels in the rendered view are too verbose, so create a poset using the basis matrix of each subspace:
sage: upper_covers = defaultdict(list)
sage: for d in range(V.dimension(), 0, -1):
....: S = V.subspaces(dim=d)
....: for B in S:
....: for A in B.subspaces(dim=d-1):
....: upper_covers[A.basis_matrix()].append(B.basis_matrix())
....:
sage: P = Poset(data=upper_covers)
LatticePoset(data=upper_covers)
sage: P
Finite poset containing 28 elements
Adjust the shape and size of the nodes for plotting the graph:
sage: p = P.plot(element_shape='s', element_size=1500)
sage: p.show(figsize=20)
Launched png viewer for Graphics object consisting of 107 graphics primitives