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.Sun, 01 Mar 2020 11:43:48 +0100Find sphere points in a latticehttps://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/Hello, say I have a lattice as in
Q = RootSystem('E8').weight_lattice()
with it's canonical bilinear form. How do I find the vectors $v$ such that $(v,v)=n$ for a positive integer $n$?
Edit: it would be even better if there's a way to get the points inside a cone, say the principal chamber in the above example.Tue, 04 Feb 2020 20:01:35 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/Comment by jipilab for <p>Hello, say I have a lattice as in </p>
<pre><code>Q = RootSystem('E8').weight_lattice()
</code></pre>
<p>with it's canonical bilinear form. How do I find the vectors $v$ such that $(v,v)=n$ for a positive integer $n$? </p>
<p>Edit: it would be even better if there's a way to get the points inside a cone, say the principal chamber in the above example.</p>
https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49845#post-id-49845Could you explain what is meant by "canonical bilinear form", the one coming from the geometric representation?
This will affect how to give you a better answer.Fri, 07 Feb 2020 18:52:55 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49845#post-id-49845Comment by heluani for <p>Hello, say I have a lattice as in </p>
<pre><code>Q = RootSystem('E8').weight_lattice()
</code></pre>
<p>with it's canonical bilinear form. How do I find the vectors $v$ such that $(v,v)=n$ for a positive integer $n$? </p>
<p>Edit: it would be even better if there's a way to get the points inside a cone, say the principal chamber in the above example.</p>
https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49870#post-id-49870The one coming from the Killing for on the Cartan algebra.Mon, 10 Feb 2020 13:51:22 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49870#post-id-49870Answer by jipilab for <p>Hello, say I have a lattice as in </p>
<pre><code>Q = RootSystem('E8').weight_lattice()
</code></pre>
<p>with it's canonical bilinear form. How do I find the vectors $v$ such that $(v,v)=n$ for a positive integer $n$? </p>
<p>Edit: it would be even better if there's a way to get the points inside a cone, say the principal chamber in the above example.</p>
https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?answer=49872#post-id-49872Here is a snippet of code that should do:
sage: Q = RootSystem('E8').weight_lattice()
sage: B = Q.basis()
sage: the_set = set()
sage: finished = False
sage: i = 1
sage: value = 4
sage: while not finished:
....: smaller_or_eq_values = False
....: int_vectors = IntegerVectors(n=i,k=8)
....: for vect in int_vectors:
....: weight = sum(vect[j]*B[j+1] for j in range(8)) # Create the weight
....: wns = weight.norm_squared()
....: if wns <= value:
....: smaller_or_eq_values = True
....: if wns == value:
....: print(weight)
....: the_set.add(weight)
....: if not smaller_or_eq_values:
....: finished = True
....: i += 1
You will get a set `the_set` which above contains all the (positive) weights that have the norm squared to be equal to `value=4`.
The norm squared seem to deliver the same as the symmetric form:
sage: B[1]+B[2]
Lambda[1] + Lambda[2]
sage: a_weight = B[1]+B[2]
sage: a_weight.symmetric_form(a_weight)
22
sage: a_weight.norm_squared()
22Mon, 10 Feb 2020 19:00:08 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?answer=49872#post-id-49872Comment by heluani for <p>Here is a snippet of code that should do:</p>
<pre><code>sage: Q = RootSystem('E8').weight_lattice()
sage: B = Q.basis()
sage: the_set = set()
sage: finished = False
sage: i = 1
sage: value = 4
sage: while not finished:
....: smaller_or_eq_values = False
....: int_vectors = IntegerVectors(n=i,k=8)
....: for vect in int_vectors:
....: weight = sum(vect[j]*B[j+1] for j in range(8)) # Create the weight
....: wns = weight.norm_squared()
....: if wns <= value:
....: smaller_or_eq_values = True
....: if wns == value:
....: print(weight)
....: the_set.add(weight)
....: if not smaller_or_eq_values:
....: finished = True
....: i += 1
</code></pre>
<p>You will get a set <code>the_set</code> which above contains all the (positive) weights that have the norm squared to be equal to <code>value=4</code>.</p>
<p>The norm squared seem to deliver the same as the symmetric form:</p>
<pre><code>sage: B[1]+B[2]
Lambda[1] + Lambda[2]
sage: a_weight = B[1]+B[2]
sage: a_weight.symmetric_form(a_weight)
22
sage: a_weight.norm_squared()
22
</code></pre>
https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49919#post-id-49919Thanks, that' works, but it's a bit less efficient that what I'm using now. This tests for all vectors in a box. You can use a ball which in higher dimensions is much smaller, and you can even account for the fact that in a root lattice case it's an ellipsoid. What I was wandering was if this was already implemented within Sage (which has the advantage of having precompiled cython code for example).Fri, 14 Feb 2020 13:27:43 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=49919#post-id-49919Comment by jipilab for <p>Here is a snippet of code that should do:</p>
<pre><code>sage: Q = RootSystem('E8').weight_lattice()
sage: B = Q.basis()
sage: the_set = set()
sage: finished = False
sage: i = 1
sage: value = 4
sage: while not finished:
....: smaller_or_eq_values = False
....: int_vectors = IntegerVectors(n=i,k=8)
....: for vect in int_vectors:
....: weight = sum(vect[j]*B[j+1] for j in range(8)) # Create the weight
....: wns = weight.norm_squared()
....: if wns <= value:
....: smaller_or_eq_values = True
....: if wns == value:
....: print(weight)
....: the_set.add(weight)
....: if not smaller_or_eq_values:
....: finished = True
....: i += 1
</code></pre>
<p>You will get a set <code>the_set</code> which above contains all the (positive) weights that have the norm squared to be equal to <code>value=4</code>.</p>
<p>The norm squared seem to deliver the same as the symmetric form:</p>
<pre><code>sage: B[1]+B[2]
Lambda[1] + Lambda[2]
sage: a_weight = B[1]+B[2]
sage: a_weight.symmetric_form(a_weight)
22
sage: a_weight.norm_squared()
22
</code></pre>
https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=50132#post-id-50132I see. If it is in Sage I would suspect that it is closer to the number theory and quadratic forms code, but I am not aware of it...Sun, 01 Mar 2020 11:43:48 +0100https://ask.sagemath.org/question/49784/find-sphere-points-in-a-lattice/?comment=50132#post-id-50132