From 4f05d94f49ebe477fb310cee9e62ab1052932a04 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 12 Feb 2017 16:20:01 -0500 Subject: [PATCH] Add work-in-progress code for the Schur cone (from David Sossa's work). --- mjo/cone/schur.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mjo/cone/schur.py diff --git a/mjo/cone/schur.py b/mjo/cone/schur.py new file mode 100644 index 0000000..bea76b6 --- /dev/null +++ b/mjo/cone/schur.py @@ -0,0 +1,45 @@ +""" +The Schur cone, as described in the "Critical angles..." papers by +Seeger and Sossa. +""" + +from sage.all import * + +def is_pointed(P,Q): + newP = Cone([ list(p) for p in P ]) + newQ = Cone([ list(q) for q in Q ]) + return newP.intersection(-newQ).is_trivial() + +def ext_angles(P,Q): + angles = [] + for p in P: + for q in Q: + p = vector(SR, p) + q = vector(SR, q) + p = p/p.norm() + q = q/q.norm() + angles.append(arccos(p.inner_product(q))) + + return angles + +def schur(n): + r""" + Return the Schur cone in ``n`` dimensions. + + INPUT: + + - ``n`` -- the ambient dimension of the Schur cone and its ambient space. + + OUTPUT: + + A rational closed convex Schur cone of dimension ``n``. + """ + + hs = [] + for i in range(1,n): + h_i = [0]*n + h_i[i-1] = QQ(1) + h_i[i] = -QQ(1) + hs.append(vector(QQ,n,h_i)) + + return Cone(hs) -- 2.43.2