sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

Point lattices (free Z-modules) generated by algebraic real vectors #21217

Open mkoeppe opened 8 years ago

mkoeppe commented 8 years ago

Point lattices (free Z-modules embedded into an ambient space) can be created as follows:

sage: (QQ^2).span([[1, 6], [1,0]], ZZ)
Free module of degree 2 and rank 2 over Integer Ring
Echelon basis matrix:
[1 0]
[0 6]

(There is also IntegerLattice in sage.modules.free_module_integer.)

However, I can't seem to build a point lattice with algebraic irrational generators, such as the 60-degree lattice in the plane.

sage: (AA^2).span([[1, 0], [1/2, AA(sqrt(3)/2)]], ZZ)
ValueError: Cannot coerce irrational Algebraic Real 0.866025403784439? to Rational
sage: K.<sqrt3> = NumberField(x^2 - 3, 'a', embedding=1.7)
sage: (K^2).span([[1, 0], [1/2, sqrt3/2]], ZZ)
ValueError: Argument gens (= [[1, 0], [1/2, 1/2*sqrt3]]) is not compatible with base_ring (= Integer Ring).

CC: @tscrim @videlec @novoselt @yuan-zhou @dimpase @mmasdeu @jplab

Component: linear algebra

Issue created by migration from https://trac.sagemath.org/ticket/21217

mkoeppe commented 8 years ago

Description changed:

--- 
+++ 
@@ -7,6 +7,8 @@
 [1 0]
 [0 6]

+(There is also IntegerLattice in sage.modules.free_module_integer.) + However, I can't seem to build a point lattice with algebraic irrational generators, such as the 60-degree lattice in the plane.